code: def main():
      args = get_args()
  
      input_manifest_path = args.input_manifest
      output_manifest_path = args.output_manifest
      input_audio_dir = args.input_audio_dir
      output_audio_dir = args.output_audio_dir
      overwrite_audio = args.overwrite_audio
      overwrite_manifest = args.overwrite_manifest
      num_workers = args.num_workers
      max_entries = args.max_entries
      output_sample_rate = args.output_sample_rate
      output_format = args.output_format
      volume_level = args.volume_level
      min_duration = args.min_duration
      max_duration = args.max_duration
      filter_file = args.filter_file
  
      if output_manifest_path.exists():
          if overwrite_manifest:
              print(
                  f"Will overwrite existing manifest path: {output_manifest_path}"
              )
          else:
              raise ValueError(
                  f"Manifest path already exists: {output_manifest_path}"
              )
  
      if args.trim_config_path:
          audio_trimmer_config = OmegaConf.load(args.trim_config_path)
          audio_trimmer = instantiate(audio_trimmer_config)
      else:
          audio_trimmer = None
  
      if output_format:
          if output_format.upper() not in sf.available_formats():
              raise ValueError(
                  f"Unsupported output audio format: {output_format}"
              )
          output_format = f".{output_format}"
  
      output_audio_dir.mkdir(exist_ok=True, parents=True)
  
      entries = read_manifest(input_manifest_path)
      if max_entries:
          entries = entries[:max_entries]
  
      # 'threading' backend is required when parallelizing torch models.
      job_outputs = Parallel(n_jobs=num_workers, backend="threading")(
          delayed(_process_entry)(
              entry=entry,
              input_audio_dir=input_audio_dir,
              output_audio_dir=output_audio_dir,
              overwrite_audio=overwrite_audio,
              audio_trimmer=audio_trimmer,
              output_sample_rate=output_sample_rate,
              output_format=output_format,
              volume_level=volume_level,
          )
          for entry in tqdm(entries)
      )
  
      output_entries = []
      filtered_entries = []
      original_durations = 0.0
      output_durations = 0.0
      for (
          output_entry,
          original_duration,
          output_duration,
      ) in job_outputs:
          original_durations += original_duration
  
          if (
              output_duration == 0.0
              or (min_duration and output_duration < min_duration)
              or (max_duration and output_duration > max_duration)
          ):
              if output_duration != original_duration:
                  output_entry["original_duration"] = original_duration
              filtered_entries.append(output_entry)
              continue
  
          output_durations += output_duration
          output_entries.append(output_entry)
  
      write_manifest(
          output_path=output_manifest_path,
          target_manifest=output_entries,
          ensure_ascii=False,
      )
      if filter_file:
          write_manifest(
              output_path=str(filter_file),
              target_manifest=filtered_entries,
              ensure_ascii=False,
          )
  
      logging.info(
          f"Duration of original audio: {original_durations / 3600:.2f} hours"
      )
      logging.info(
          f"Duration of processed audio: {output_durations / 3600:.2f} hours"
      )
  
file_path: NeMo/scripts/dataset_processing/tts/preprocess_audio.py
imports: import argparse
  import os
  from pathlib import Path
  from typing import Tuple
  import librosa
  import soundfile
  from hydra.utils import instantiate
  from joblib import Parallel, delayed
  from omegaconf import OmegaConf
  from tqdm import tqdm
  from nemo.collections.asr.parts.utils.manifest_utils import read_manifest, write_manifest
  from nemo.collections.tts.parts.preprocessing.audio_trimming import AudioTrimmer
  from nemo.collections.tts.parts.utils.tts_dataset_utils import get_abs_rel_paths, normalize_volume
  from nemo.utils import logging
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types