code: def filter_wave_2(speaker_wav):
      # Filtering for microphone input, as it has BG noise, maybe silence in beginning and end
      # This is fast filtering not perfect
  
      # Apply all on demand
      lowpassfilter = denoise = trim = loudness = True
  
      if lowpassfilter:
          lowpass_highpass = "lowpass=8000,highpass=75,"
      else:
          lowpass_highpass = ""
  
      if trim:
          # better to remove silence in beginning and end for microphone
          trim_silence = "areverse,silenceremove=start_periods=1:start_silence=0:start_threshold=0.02,areverse,silenceremove=start_periods=1:start_silence=0:start_threshold=0.02,"
      else:
          trim_silence = ""
  
      try:
          out_filename = (
              speaker_wav + str(uuid.uuid4()) + ".wav"
          )  # ffmpeg to know output format
  
          # we will use newer ffmpeg as that has afftn denoise filter
          shell_command = f"./ffmpeg -y -i {speaker_wav} -af {lowpass_highpass}{trim_silence} {out_filename}".split(
              " "
          )
  
          command_result = subprocess.run(
              [item for item in shell_command],
              capture_output=False,
              text=True,
              check=True,
          )
          speaker_wav = out_filename
          print("Filtered microphone input")
      except subprocess.CalledProcessError:
          # There was an error - command exited with non-zero code
          print(
              "Error: failed filtering, use original microphone input"
          )
      return speaker_wav
  
imports: from __future__ import annotations
  import functools
  import io
  import os
  import tempfile
  import numpy
  import uuid
  import subprocess
  import time
  from src.tts_sentence_parsing import init_sentence_state, get_sentence, clean_sentence, detect_language
  from src.tts_utils import prepare_speech, get_no_audio, chunk_speed_change
  from src.utils import cuda_vis_check
  import torch
label_desc: Use image node_id 12 for calling a global function with example usage: filter_wave_2(speaker_wav) and returns: speaker_wav