code: def main():
      start = time.time()
      parser = argparse.ArgumentParser(
          description="Freesound data resample"
      )
      parser.add_argument(
          "--data_dir", required=True, default=None, type=str
      )
      parser.add_argument(
          "--resampled_dir", required=True, default=None, type=str
      )
      parser.add_argument("--sample_rate", default=16000, type=int)
      args = parser.parse_args()
  
      data_dir = args.data_dir
      resampled_dir = args.resampled_dir
      sample_rate = args.sample_rate
  
      wav_files = sorted(glob.glob(os.path.join(data_dir, "*/*.wav")))
      flac_files = sorted(glob.glob(os.path.join(data_dir, "*/*.flac")))
  
      with Parallel(n_jobs=-1, verbose=10) as parallel:
          wav_files_failed = parallel(
              delayed(resample_file)(
                  resampled_dir,
                  filepath,
                  ext="wav",
                  sample_rate=sample_rate,
              )
              for filepath in wav_files
          )
  
          flac_files_failed = parallel(
              delayed(resample_file)(
                  resampled_dir,
                  filepath,
                  ext="flac",
                  sample_rate=sample_rate,
              )
              for filepath in flac_files
          )
  
      with open("dataset_conversion_logs.txt", "w") as f:
          for file in wav_files_failed:
              if file is not None:
                  f.write(f"{file}\n")
  
          for file in flac_files_failed:
              if file is not None:
                  f.write(f"{file}\n")
  
      end = time.time()
      print(
          f"Resample data in {data_dir} and save to {resampled_dir} takes {end-start} seconds."
      )
  
file_path: NeMo/scripts/freesound_download_resample/freesound_resample.py
imports: import argparse
  import glob
  import os
  import time
  import librosa
  import sox
  from joblib import Parallel, delayed
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types