code: def prepare_emovdb(
      data_folder,
      save_json,
      seed=12,
  ):
      """
      Prepares the json files for the EmoV-DB dataset.
      Arguments
      ---------
      data_original : str
          Path to the folder where the original EmoV-DB dataset is stored.
      save_json : str
          Path where the data specification file will be saved.
      seed : int
          Seed for reproducibility
      """
      random.seed(seed)
  
      # Check if this phase is already done (if so, skip it)
      if skip(save_json):
          logger.info(
              "Preparation completed in previous run, skipping."
          )
          return
  
      # wavs of EmoV-DB are saved in double instead of int16
      logger.info("Converting format from double to int16 ...")
      all_paths = Path(data_folder).rglob("*.wav")
      # paths = copy.deepcopy(all_paths)
  
      for repo in repos:
          if not os.path.exists(
              os.path.join(data_folder, "converted", repo)
          ):
              os.makedirs(os.path.join(data_folder, "converted", repo))
  
      for path in all_paths:
          convert_path = os.path.join(
              data_folder,
              "converted",
              str(path).split("EmoV-DB/")[-1],
          )
          if "converted" not in str(path):
              os.system(
                  f"sox -v 0.99 {str(path)} -b 16 -e signed-integer {convert_path}"
              )
      logger.info("Converting Finished")
  
      logger.info("Applying VAD and resampling ...")
      for repo in repos:
          source_folder = os.path.join(data_folder, "converted", repo)
          destin_folder = os.path.join(
              data_folder, "processed", repo.split("_")[0]
          )
          if not os.path.exists(destin_folder):
              os.makedirs(destin_folder)
  
          # webrtcvad does not deal with 44100Hz, so resampling before VAD
          resampling_for_folder(source_folder, destin_folder)
          vad_for_folder(destin_folder, destin_folder)
  
      logger.info("vad and resampling finished")
      logger.info("Start EmoV-DB concatenation ...")
      data_json = concat_wavs(data_folder, save_json)
      logger.info("EmoV-DB concatenation finished ...")
      return data_json
  
file_path: speechbrain/recipes/ZaionEmotionDataset/emotion_diarization/datasets/prepare_EMOVDB.py
imports: import numpy
  import os
  import random
  from pydub import AudioSegment
  import json
  from datasets.vad import vad_for_folder
  from pathlib import Path
  import logging
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_emovdb(data_folder, save_json, seed) and returns: data_json