code: def create_aishell1_dataframe(
      aishell1_dir, subdir, speakers_md, filename2transcript
  ):
      """Generate a dataframe that gather infos about the sound files in a
      aishell1 subdirectory"""
  
      print(
          f"Creating {subdir} metadata file in "
          f"{os.path.join(aishell1_dir, 'metadata')}"
      )
      # Get the current directory path
      dir_path = os.path.join(aishell1_dir, subdir)
      # Recursively look for .flac files in current directory
      sound_paths = glob.glob(
          os.path.join(dir_path, "**/*.wav"), recursive=True
      )
      # Create the dataframe corresponding to this directory
      dir_md = pd.DataFrame(
          columns=[
              "speaker_ID",
              "sex",
              "subset",
              "length",
              "origin_path",
              "transcript",
          ]
      )
  
      # Go through the sound file list
      for sound_path in tqdm(sound_paths, total=len(sound_paths)):
          # Get the ID of the speaker
          spk_id = sound_path.split("/")[-2]
          # Find Sex according to speaker ID in aishell1 metadata
          sex = speakers_md[speakers_md["speaker_ID"] == spk_id].iat[
              0, 1
          ]
          # Find subset according to speaker ID in aishell1 metadata
          subset = subdir
          # Get its length
          length = len(sf.SoundFile(sound_path))
          # Get the sound file relative path
          rel_path = os.path.relpath(sound_path, aishell1_dir)
          # Get the transcript
          filename = os.path.basename(sound_path).split(".")[0]
          if filename not in filename2transcript:
              continue
          transcript = filename2transcript[filename]
          # Add information to the dataframe
          dir_md.loc[len(dir_md)] = [
              spk_id,
              sex,
              subset,
              length,
              rel_path,
              transcript,
          ]
      return dir_md
  
file_path: speechbrain/recipes/Aishell1Mix/separation/scripts/create_aishell1_metadata.py
imports: import os
  import argparse
  import soundfile
  import pandas
  import glob
  from tqdm import tqdm
label_desc: Use image node_id 5 for calling a global function with example usage: create_aishell1_dataframe(aishell1_dir, subdir, speakers_md, filename2transcript) and returns: dir_md