code: def main_gen_single_process(
      params, proc_idx, st_idx, ed_idx, total_procs
  ):
      clean_source_files = []
      clean_clipped_files = []
      clean_low_activity_files = []
      noise_source_files = []
      noise_clipped_files = []
      noise_low_activity_files = []
  
      file_num = st_idx
      clean_index = round(
          len(params["cleanfilenames"]) / total_procs * proc_idx
      )
      noise_index = round(
          len(params["noisefilenames"]) / total_procs * proc_idx
      )
  
      while file_num < ed_idx:
          if (file_num - st_idx) % 10 == 9:
              print(
                  "[INFO] (noisyspeech_synthesizer.py, \
                   process {}) generating wav mixture no. {} / {}".format(
                      proc_idx, file_num - st_idx + 1, ed_idx - st_idx
                  ),
                  file=sys.stderr,
              )
          # generate clean speech
          clean, clean_sf, clean_cf, clean_laf, clean_index = gen_audio(
              True, params, clean_index
          )
  
          # generate noise
          noise, noise_sf, noise_cf, noise_laf, noise_index = gen_audio(
              False, params, noise_index, len(clean)
          )
  
          clean_clipped_files += clean_cf
          clean_low_activity_files += clean_laf
          noise_clipped_files += noise_cf
          noise_low_activity_files += noise_laf
  
          # get rir files and config
  
          # mix clean speech and noise
          # if specified, use specified SNR value
          if not params["randomize_snr"]:
              snr = params["snr"]
          # use a randomly sampled SNR value between the specified bounds
          else:
              snr = np.random.randint(
                  params["snr_lower"], params["snr_upper"]
              )
  
          (
              clean_snr,
              noise_snr,
              noisy_snr,
              target_level,
          ) = segmental_snr_mixer(
              params=params, clean=clean, noise=noise, snr=snr
          )
          # Uncomment the below lines if you need segmental SNR
          # and comment the above lines using snr_mixer
          # clean_snr, noise_snr, noisy_snr, target_level = \
          #      segmental_snr_mixer(params=params,
          #                           clean=clean,
          #                           noise=noise,
          #                           snr=snr)
          # unexpected clipping
          if (
              is_clipped(clean_snr)
              or is_clipped(noise_snr)
              or is_clipped(noisy_snr)
          ):
              print(
                  "Warning: File #"
                  + str(file_num)
                  + " has unexpected clipping, "
                  + "returning without writing audio to disk"
              )
              continue
  
          clean_source_files += clean_sf
          noise_source_files += noise_sf
  
          # write resultant audio streams to files
          hyphen = "-"
          clean_source_filenamesonly = [
              i[:-4].split(os.path.sep)[-1] for i in clean_sf
          ]
          clean_files_joined = hyphen.join(clean_source_filenamesonly)[
              :MAXFILELEN
          ]
          noise_source_filenamesonly = [
              i[:-4].split(os.path.sep)[-1] for i in noise_sf
          ]
          noise_files_joined = hyphen.join(noise_source_filenamesonly)[
              :MAXFILELEN
          ]
  
          noisyfilename = (
              clean_files_joined
              + "_"
              + noise_files_joined
              + "_snr"
              + str(snr)
              + "_tl"
              + str(target_level)
              + "_fileid_"
              + str(file_num)
              + ".wav"
          )
          cleanfilename = "clean_fileid_" + str(file_num) + ".wav"
          noisefilename = "noise_fileid_" + str(file_num) + ".wav"
  
          noisypath = os.path.join(
              params["noisyspeech_dir"], noisyfilename
          )
          cleanpath = os.path.join(
              params["clean_proc_dir"], cleanfilename
          )
          noisepath = os.path.join(
              params["noise_proc_dir"], noisefilename
          )
  
          audio_signals = [noisy_snr, clean_snr, noise_snr]
          file_paths = [noisypath, cleanpath, noisepath]
  
          file_num += 1
          for i in range(len(audio_signals)):
              try:
                  audiowrite(
                      file_paths[i], audio_signals[i], params["fs"]
                  )
              except Exception as e:
                  print(str(e))
  
      return (
          clean_source_files,
          clean_clipped_files,
          clean_low_activity_files,
          noise_source_files,
          noise_clipped_files,
          noise_low_activity_files,
      )
  
file_path: espnet/egs2/dns_icassp22/enh1/local/noisyspeech_synthesizer.py
imports: import argparse
  import configparser
  import glob
  import multiprocessing
  import os
  import sys
  from pathlib import Path
  from random import shuffle
  import librosa
  import numpy
  import pandas
  from audiolib import activitydetector, audioread, audiowrite, is_clipped, segmental_snr_mixer
  from scipy import signal
  import utils
label_desc: Use image node_id 4 for calling a global function with example usage: main_gen_single_process(params, proc_idx, st_idx, ed_idx, total_procs) and returns: clean_source_files,  clean_clipped_files,  clean_low_activity_files,  noise_source_files,  noise_clipped_files,  noise_low_activity_files