code: def convert_audio_and_make_label(
      input_dir, subset, output_dir, output_file
  ):
      """Optionally convert AAC to WAV and make speaker labels.
      Args:
          input_dir: the directory which holds the input dataset.
          subset: the name of the specified subset. e.g. vox1_dev_wav
          output_dir: the directory to place the newly generated csv files.
          output_file: the name of the newly generated csv file. e.g. vox1_dev_wav.csv
      """
  
      logging.info(
          "Preprocessing audio and label for subset %s" % subset
      )
      source_dir = os.path.join(input_dir, subset)
  
      files = []
      # Convert all AAC file into WAV format. At the same time, generate the csv
      for root, _, filenames in gfile.Walk(source_dir):
          for filename in filenames:
              name, ext = os.path.splitext(filename)
              if ext.lower() == ".wav":
                  _, ext2 = os.path.splitext(name)
                  if ext2:
                      continue
                  wav_file = os.path.join(root, filename)
              elif ext.lower() == ".m4a":
                  # Convert AAC to WAV.
                  aac_file = os.path.join(root, filename)
                  wav_file = aac_file + ".wav"
                  if not gfile.Exists(wav_file):
                      if not decode_aac_with_ffmpeg(aac_file, wav_file):
                          raise RuntimeError("Audio decoding failed.")
              else:
                  continue
              speaker_name = root.split(os.path.sep)[-2]
              if speaker_name not in speaker_id_dict:
                  num = len(speaker_id_dict)
                  speaker_id_dict[speaker_name] = num
              # wav_filesize = os.path.getsize(wav_file)
              wav_length = len(sf.read(wav_file)[0])
              files.append(
                  (
                      os.path.abspath(wav_file),
                      wav_length,
                      speaker_id_dict[speaker_name],
                      speaker_name,
                  )
              )
  
      # Write to CSV file which contains four columns:
      # "wav_filename", "wav_length_ms", "speaker_id", "speaker_name".
      csv_file_path = os.path.join(output_dir, output_file)
      df = pandas.DataFrame(
          data=files,
          columns=[
              "wav_filename",
              "wav_length_ms",
              "speaker_id",
              "speaker_name",
          ],
      )
      df.to_csv(csv_file_path, index=False, sep="\t")
      logging.info(
          "Successfully generated csv file {}".format(csv_file_path)
      )
  
file_path: TTS/TTS/speaker_encoder/utils/prepare_voxceleb.py
imports: import os
  import sys
  import zipfile
  import subprocess
  import hashlib
  import pandas
  from absl import logging
  import tensorflow
  import soundfile
label_desc: Use image node_id 4 for calling a global function with example usage: convert_audio_and_make_label(input_dir, subset, output_dir, output_file) without return types