code: def prepare_iemocap(
      data_folder,
      save_json,
      seed=12,
  ):
      """
      Prepares the json files for the IEMOCAP dataset.
      Arguments
      ---------
      data_original : str
          Path to the folder where the original IEMOCAP 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
  
      logger.info("Applying VAD ...")
      dict = {}
      emotion_wavs = []
      neutral_wavs = []
      annotations = Path(data_folder).rglob(
          "*/dialog/EmoEvaluation/*.txt"
      )
      for i in annotations:
          lines = load_utterInfo(i)
          for line in lines:
              id = line[2]
              if line[3] == "hap":
                  dict[id] = "happy"
                  append_path_after_vad(data_folder, id, emotion_wavs)
  
              if line[3] == "exc":
                  dict[id] = "happy"
                  append_path_after_vad(data_folder, id, emotion_wavs)
  
              if line[3] == "sad":
                  dict[id] = "sad"
                  append_path_after_vad(data_folder, id, emotion_wavs)
  
              if line[3] == "ang":
                  dict[id] = "angry"
                  append_path_after_vad(data_folder, id, emotion_wavs)
  
              if line[3] == "neu":
                  dict[id] = "neutral"
                  append_path_after_vad(data_folder, id, neutral_wavs)
  
      logger.info("VAD finished")
      logger.info("Start IEMOCAP concatenation ...")
      data_json = concat_wavs(
          data_folder, save_json, emotion_wavs, neutral_wavs, dict
      )
      logger.info("IEMOCAP concatenation finished ...")
      return data_json
  
file_path: speechbrain/recipes/ZaionEmotionDataset/emotion_diarization/datasets/prepare_IEMOCAP.py
imports: import numpy
  import re
  import os
  import random
  from pydub import AudioSegment
  import json
  from datasets.vad import write_audio
  from pathlib import Path
  import logging
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_iemocap(data_folder, save_json, seed) and returns: data_json