code: def write_noise(out_dir, seg, audio, sig, tag, fs, cnt):
      sig_noise = sig[np.nonzero(tag)]
      for i in range(math.floor(len(sig_noise) / (seg * fs))):
          siw.write(
              out_dir + "/noise" + str(cnt) + ".wav",
              fs,
              sig_noise[i * seg * fs : (i + 1) * seg * fs],
          )
          cnt += 1
      return cnt
  
file_path: espnet/egs2/chime7_task1/diar_asr1/local/extract_noises.py
imports: import argparse
  import json
  import math
  import os
  import sys
  import numpy
  import scipy.io.wavfile
label_desc: Use image node_id 4 for calling a global function with example usage: write_noise(out_dir, seg, audio, sig, tag, fs, cnt) and returns: cnt