code: def create_json(
      wav_lst,
      json_file,
      uppercase,
      phn_set,
  ):
      """
      Creates the json file given a list of wav files.
  
      Arguments
      ---------
      wav_lst : list
          The list of wav files of a given data split.
      json_file : str
              The path of the output json file.
      uppercase : bool
          Whether this is the uppercase version of timit.
      phn_set : {60, 48, 39}, optional,
          Default: 39
          The phoneme set to use in the phn label.
      """
  
      # Adding some Prints
      msg = "Creating %s..." % (json_file)
      logger.info(msg)
      json_dict = {}
  
      for wav_file in wav_lst:
          # Getting sentence and speaker ids
          spk_id = wav_file.split("/")[-2]
          snt_id = wav_file.split("/")[-1].replace(".wav", "")
          snt_id = spk_id + "_" + snt_id
  
          # Reading the signal (to retrieve duration in seconds)
          signal = read_audio(wav_file)
          duration = len(signal) / SAMPLERATE
  
          # Retrieving words and check for uppercase
          if uppercase:
              wrd_file = wav_file.replace(".WAV", ".WRD")
          else:
              wrd_file = wav_file.replace(".wav", ".wrd")
  
          if not os.path.exists(os.path.dirname(wrd_file)):
              err_msg = "the wrd file %s does not exists!" % (wrd_file)
              raise FileNotFoundError(err_msg)
  
          words = [
              line.rstrip("\n").split(" ")[2] for line in open(wrd_file)
          ]
          words = " ".join(words)
  
          # Retrieving phonemes
          if uppercase:
              phn_file = wav_file.replace(".WAV", ".PHN")
          else:
              phn_file = wav_file.replace(".wav", ".phn")
  
          if not os.path.exists(os.path.dirname(phn_file)):
              err_msg = "the wrd file %s does not exists!" % (phn_file)
              raise FileNotFoundError(err_msg)
  
          # Getting the phoneme and ground truth ends lists from the phn files
          phonemes, ends = get_phoneme_lists(phn_file, phn_set)
  
          json_dict[snt_id] = {
              "wav": wav_file,
              "duration": duration,
              "spk_id": spk_id,
              "phn": phonemes,
              "wrd": words,
              "ground_truth_phn_ends": ends,
          }
  
      # Writing the dictionary to the json file
      with open(json_file, mode="w") as json_f:
          json.dump(json_dict, json_f, indent=2)
  
      logger.info(f"{json_file} successfully created!")
  
file_path: speechbrain/recipes/TIMIT/timit_prepare.py
imports: import os
  import json
  import logging
  from speechbrain.utils.data_utils import get_all_files
  from speechbrain.dataio.dataio import read_audio
label_desc: Use image node_id 5 for calling a global function with example usage: create_json(wav_lst, json_file, uppercase, phn_set) without return types