code: def gen_audio(is_clean, params, index, audio_samples_length=-1):
      """Calls build_audio() to get an audio signal, and verify that it meets the
      activity threshold"""
  
      clipped_files = []
      low_activity_files = []
      if audio_samples_length == -1:
          audio_samples_length = int(
              params["audio_length"] * params["fs"]
          )
      if is_clean:
          activity_threshold = params["clean_activity_threshold"]
      else:
          activity_threshold = params["noise_activity_threshold"]
  
      while True:
          audio, source_files, new_clipped_files, index = build_audio(
              is_clean, params, index, audio_samples_length
          )
  
          clipped_files += new_clipped_files
          if len(audio) < audio_samples_length:
              continue
  
          if activity_threshold == 0.0:
              break
  
          percactive = activitydetector(audio=audio)
          if percactive > activity_threshold:
              break
          else:
              low_activity_files += source_files
  
      return (
          audio,
          source_files,
          clipped_files,
          low_activity_files,
          index,
      )
  
imports: import sys
  import os
  from pathlib import Path
  import random
  import time
  import numpy
  from scipy import signal
  from scipy.io import wavfile
  import librosa
  import utils
  from audiolib import segmental_snr_mixer, activitydetector, is_clipped
  import pandas
  import json
  from functools import partial
  from typing import Dict
  from collections import defaultdict
  import speechbrain
  import webdataset
  from hyperpyyaml import load_hyperpyyaml
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: gen_audio(is_clean, params, index, audio_samples_length) and returns: audio,  source_files,  clipped_files,  low_activity_files,  index