code: def prepare_voicebank(
      data_folder, save_folder, valid_speaker_count=2, skip_prep=False
  ):
      """
      Prepares the json files for the Voicebank dataset.
  
      Expects the data folder to be the same format as the output of
      ``download_vctk_slr()`` below.
  
      Arguments
      ---------
      data_folder : str
          Path to the folder where the original Voicebank dataset is stored.
      save_folder : str
          The directory where to store the json files.
      valid_speaker_count : int
          The number of validation speakers to use (out of 28 in train set).
      skip_prep: bool
          If True, skip data preparation.
  
      Example
      -------
      >>> data_folder = '/path/to/datasets/Voicebank'
      >>> save_folder = 'exp/Voicebank_exp'
      >>> prepare_voicebank(data_folder, save_folder)
      """
  
      if skip_prep:
          return
  
      # Setting ouput files
      save_json_train = os.path.join(save_folder, TRAIN_JSON)
      save_json_valid = os.path.join(save_folder, VALID_JSON)
      save_json_test = os.path.join(save_folder, TEST_JSON)
  
      # Check if this phase is already done (if so, skip it)
      if skip(save_json_train, save_json_test, save_json_valid):
          logger.info(
              "Preparation completed in previous run, skipping."
          )
          return
  
      train_clean_folder = os.path.join(
          data_folder, "clean_trainset_28spk_wav_16k"
      )
      train_noisy_folder = os.path.join(
          data_folder, "reverb_trainset_28spk_wav_16k"
      )
  
      test_clean_folder = os.path.join(
          data_folder, "clean_testset_wav_16k"
      )
      test_noisy_folder = os.path.join(
          data_folder, "reverb_testset_wav_16k"
      )
  
      # Setting the save folder
      if not os.path.exists(save_folder):
          os.makedirs(save_folder)
          """
      # Additional checks to make sure the data folder contains Voicebank
      check_voicebank_folders(
          train_clean_folder,
          train_noisy_folder,
          train_txts,
          test_clean_folder,
          test_noisy_folder,
          test_txts,
      )
      """
      logger.debug("Creating lexicon...")
      logger.info("Creating json files for noisy VoiceBank...")
  
      logger.debug("Collecting files...")
      extension = [".wav"]
      valid_speakers = TRAIN_SPEAKERS[:valid_speaker_count]
      wav_lst_train = get_all_files(
          train_noisy_folder,
          match_and=extension,
          exclude_or=valid_speakers,
      )
      wav_lst_valid = get_all_files(
          train_noisy_folder,
          match_and=extension,
          match_or=valid_speakers,
      )
      wav_lst_test = get_all_files(
          test_noisy_folder, match_and=extension
      )
  
      logger.debug("Creating json files for reverb VoiceBank...")
      create_json(wav_lst_train, save_json_train, train_clean_folder)
      create_json(wav_lst_valid, save_json_valid, train_clean_folder)
      create_json(wav_lst_test, save_json_test, test_clean_folder)
  
file_path: speechbrain/recipes/Voicebank/dereverb/MetricGAN-U/voicebank_revb_prepare.py
imports: import os
  import json
  import string
  import logging
  from speechbrain.utils.data_utils import get_all_files
  from speechbrain.dataio.dataio import read_audio
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_voicebank(data_folder, save_folder, valid_speaker_count, skip_prep) without return types