code: def create_json(wav_list, json_file):
      """
      Creates the json file given a list of wav files.
  
      Arguments
      ---------
      wav_list : list of str
          The list of wav files.
      json_file : str
          The path of the output json file
      """
      # Processing all the wav files in the list
      json_dict = {}
      for wav_file in wav_list:
          # Reading the signal (to retrieve duration in seconds)
          signal = read_audio(wav_file)
          duration = signal.shape[0] / SAMPLERATE
  
          # Manipulate path to get relative path and uttid
          path_parts = wav_file.split(os.path.sep)
          uttid, _ = os.path.splitext(path_parts[-1])
          relative_path = os.path.join("{data_root}", *path_parts[-5:])
  
          # Getting speaker-id from utterance-id
          spk_id = uttid.split("-")[0]
  
          # Create entry for this utterance
          json_dict[uttid] = {
              "wav": relative_path,
              "length": duration,
              "spk_id": spk_id,
          }
  
      # 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/templates/speaker_id/mini_librispeech_prepare.py
imports: import os
  import json
  import shutil
  import random
  import logging
  from speechbrain.utils.data_utils import get_all_files, download_file
  from speechbrain.dataio.dataio import read_audio
label_desc: Use image node_id 2 for calling a global function with example usage: create_json(wav_list, json_file) without return types