code: def write_audio(input_path, out_path):
      """do vad and save the audio after vad"""
      try:
          audio, sample_rate = read_wave(input_path)
      except Exception as e:
          print(e)
      vad = webrtcvad.Vad(2)
      frames = frame_generator(30, audio, sample_rate)
      frames = list(frames)
      segments = vad_collector(sample_rate, 30, 30, vad, frames)
  
      total_segment = bytes()
  
      for i, segment in enumerate(segments):
          total_segment += segment
  
      # abandon short emotions (< 0.2s)
      if len(total_segment) > 6400:  # 0.2 * 16000 * 2
          write_wave(out_path, total_segment, sample_rate)
  
file_path: speechbrain/recipes/ZaionEmotionDataset/emotion_diarization/datasets/vad.py
imports: import collections
  import webrtcvad
  import contextlib
  import wave
  import os
label_desc: Use image node_id 6 for calling a global function with example usage: write_audio(input_path, out_path) without return types