code: def filter_manifest_line(manifest_line):
      split_manifest = []
      audio_path = manifest_line["audio_filepath"]
      start = manifest_line.get("offset", 0)
      dur = manifest_line["duration"]
      label = manifest_line["label"]
      endname = os.path.splitext(audio_path.split(label, 1)[-1])[0]
      to_path = os.path.join(CWD, "segments", label)
      to_path = os.path.join(to_path, endname[1:])
      os.makedirs(os.path.dirname(to_path), exist_ok=True)
  
      if dur >= min(DURATIONS):
          signal, sr = sf.read(audio_path)
          remaining_dur = dur - start
  
          segments = DURATIONS.copy()
          mode = int(remaining_dur // sum(DURATIONS))
          rem = remaining_dur % sum(DURATIONS)
          segments = mode * segments
  
          for val in DURATIONS:
              if rem >= val:
                  segments.append(val)
                  rem = rem - val
  
          for temp_dur in segments:
              segment_audio = signal[
                  int(start * sr) : int(start * sr + temp_dur * sr)
              ]
              if l.feature.rms(y=segment_audio).mean() > MIN_ENERGY:
                  final_string = "_" + str(start) + "_" + str(temp_dur)
                  final_string = final_string.replace(".", "-")
                  to_file = to_path + final_string + ".wav"
  
                  c_start = int(float(start * sr))
                  c_end = c_start + int(float(temp_dur * sr))
                  segment = signal[c_start:c_end]
                  sf.write(to_file, segment, sr)
  
                  meta = manifest_line.copy()
                  meta["audio_filepath"] = to_file
                  meta["offset"] = 0
                  meta["duration"] = temp_dur
                  split_manifest.append(meta)
  
              start = start + temp_dur
  
      return split_manifest
  
file_path: NeMo/scripts/speaker_tasks/filelist_to_manifest.py
imports: import argparse
  import json
  import os
  import random
  import librosa
  import numpy
  import soundfile
  import sox
  from sklearn.model_selection import StratifiedShuffleSplit
  from tqdm.contrib.concurrent import process_map
  from nemo.collections.asr.parts.utils.manifest_utils import read_manifest
label_desc: Use image node_id 1 for calling a global function with example usage: filter_manifest_line(manifest_line) and returns: split_manifest