code: def create_binaural_wsj0mix2_reverb_csv(
      datapath,
      savepath,
      fs,
      version,
      savename="binaural_wsj0-2mix_reverb_",
      set_types=["tr", "cv", "tt"],
  ):
      """
      This function creates the csv files to get the speechbrain data loaders for the binaural-wsj0mix2 dataset.
  
      Arguments:
          datapath (str) : path for the binaural-wsj0mix dataset.
          savepath (str) : path where we save the csv file
      """
      if fs == 8000:
          sample_rate = "8k"
      elif fs == 16000:
          sample_rate = "16k"
      else:
          raise ValueError("Unsupported sampling rate")
  
      for set_type in set_types:
          mix_path = os.path.join(
              datapath,
              "wav{}".format(sample_rate),
              version,
              set_type,
              "mix/",
          )
          s1_path = os.path.join(
              datapath,
              "wav{}".format(sample_rate),
              version,
              set_type,
              "s1/",
          )
          s2_path = os.path.join(
              datapath,
              "wav{}".format(sample_rate),
              version,
              set_type,
              "s2/",
          )
  
          files = os.listdir(mix_path)
  
          mix_fl_paths = [mix_path + fl for fl in files]
          s1_fl_paths = [s1_path + fl for fl in files]
          s2_fl_paths = [s2_path + fl for fl in files]
  
          csv_columns = [
              "ID",
              "duration",
              "mix_wav",
              "mix_wav_format",
              "mix_wav_opts",
              "s1_wav",
              "s1_wav_format",
              "s1_wav_opts",
              "s2_wav",
              "s2_wav_format",
              "s2_wav_opts",
          ]
  
          with open(
              os.path.join(savepath, savename + set_type + ".csv"), "w"
          ) as csvfile:
              writer = csv.DictWriter(csvfile, fieldnames=csv_columns)
              writer.writeheader()
              for i, (mix_path, s1_path, s2_path) in enumerate(
                  zip(mix_fl_paths, s1_fl_paths, s2_fl_paths)
              ):
                  row = {
                      "ID": i,
                      "duration": 1.0,
                      "mix_wav": mix_path,
                      "mix_wav_format": "wav",
                      "mix_wav_opts": None,
                      "s1_wav": s1_path,
                      "s1_wav_format": "wav",
                      "s1_wav_opts": None,
                      "s2_wav": s2_path,
                      "s2_wav_format": "wav",
                      "s2_wav_opts": None,
                  }
                  writer.writerow(row)
  
imports: import os
  import csv
label_desc: Use image node_id 5 for calling a global function with example usage: create_binaural_wsj0mix2_reverb_csv(datapath, savepath, fs, version, savename, set_types) without return types