code: def create_cs_data(
      intermediate_cs_manifest_list: list,
      audio_save_folder: str,
      manfest_save_path: str,
      audio_amplitude_normalization: int,
      pause_beg_msec: int,
      pause_join_msec: int,
      pause_end_msec: int,
      cs_data_sampling_rate: int,
      is_lid_manifest: bool,
  ):
      """
      Args:
          intermediate_cs_manifest_list: the intermediate cs manifest obtained from code_switching_manifest_creation.py as a list
          audio_save_folder: Absolute path to save the generated audio samples
          manfest_save_path: Absolute path to save the corresponding manifest
          audio_amplitude_normalization: The amplitude to scale to after normalization
          pause_beg_msec: Pause to be added at the beginning of the sample (msec)
          pause_join_msec: Pause to be added between different phrases of the sample (msec)
          pause_end_msec: Pause to be added at the end of the sample (msec)
          cs_data_sampling_rate: Desired sampling rate of the generated samples
          is_lid_manifest: If true, generate manifest in the multi-sample lid format, else the standard manifest format
  
      Returns:
  
      """
  
      fs = cs_data_sampling_rate
      incorrect_sample_flag = 0
  
      with open(manfest_save_path, "w") as outfile:
          for data in tqdm(intermediate_cs_manifest_list):
              combined_audio = []
  
              staring_pause = np.zeros(int(pause_beg_msec * fs / 1000))
              combined_audio += list(staring_pause)
  
              text_entry_list = []
              for index in range(len(data["lang_ids"])):
                  phrase_entry = {}
                  # dictionary to store the phrase information which will be added to the complete sentence
  
                  data_sample, fs_sample = librosa.load(
                      data["paths"][index], sr=fs
                  )
                  # Alternative-  fs_sample, data_sample = wavfile.read(data['paths'][index])
  
                  if fs_sample != fs:
                      logging.error(
                          "Sampling rate error inside create_cs_data function"
                      )
                      exit
  
                  # Remove leading and trailing zeros
                  data_sample = np.trim_zeros(data_sample)
  
                  # take care of empty arrays: rare
                  if data_sample.size == 0:
                      incorrect_sample_flag = 1
                      continue
  
                  # normalizing data
                  data_sample_norm = (
                      data_sample
                      / np.maximum(
                          np.abs(data_sample.max()),
                          np.abs(data_sample.min()),
                      )
                      * audio_amplitude_normalization
                  )
  
                  combined_audio += list(data_sample_norm)
  
                  phrase_entry["str"] = data["texts"][index]
                  phrase_entry["lang"] = data["lang_ids"][index]
  
                  text_entry_list.append(phrase_entry)
  
                  # adding small pause between semgments
                  if index != (len(data["lang_ids"]) - 1):
                      pause = np.zeros(int(pause_join_msec * fs / 1000))
                      combined_audio += list(pause)
  
              if incorrect_sample_flag == 1:
                  incorrect_sample_flag = 0
                  continue
  
              ending_pause = np.zeros(int(pause_end_msec * fs / 1000))
              combined_audio += list(ending_pause)
  
              sample_id = data["uid"]
              audio_file_path = (
                  audio_save_folder + "/" + str(sample_id) + ".wav"
              )
  
              # saving audio
              wavfile.write(
                  audio_file_path,
                  fs,
                  np.array(combined_audio).astype(np.int16),
              )
              # Alternative-  librosa.output.write_wav(audio_file_path, combined_audio, fs)
  
              metadata_json = {}
              metadata_json["audio_filepath"] = audio_file_path
              metadata_json["duration"] = float(
                  len(combined_audio) / fs
              )
              if is_lid_manifest:
                  metadata_json["text"] = text_entry_list
              else:
                  metadata_json["text"] = " ".join(data["texts"])
  
              metadata_json["language_ids"] = data["lang_ids"]
              metadata_json["original_texts"] = data["texts"]
              metadata_json["original_paths"] = data["paths"]
              metadata_json["original_durations"] = data["durations"]
  
              s = json.dumps(metadata_json)
              outfile.write(s + "\n")
  
file_path: NeMo/scripts/speech_recognition/code_switching/code_switching_audio_data_creation.py
imports: import argparse
  import json
  import logging
  import os
  import librosa
  import numpy
  from joblib import Parallel, delayed
  from scipy.io import wavfile
  from tqdm import tqdm
  from nemo.collections.asr.parts.utils.manifest_utils import read_manifest
label_desc: Use image node_id 3 for calling a global function with example usage: create_cs_data(intermediate_cs_manifest_list, audio_save_folder, manfest_save_path, audio_amplitude_normalization, pause_beg_msec, pause_join_msec, pause_end_msec, cs_data_sampling_rate, is_lid_manifest) without return types