code: def generate_sample_file(
      filename,
      samples_dir,
      gst_audio_encoder,
      sample_array,
      overwrite=False,
  ):
      sample_file = os.path.join(samples_dir, filename)
      if overwrite or not os.path.exists(sample_file):
          gst_builder = gst_BuildSample(
              sample_array=sample_array,
              output_file=sample_file,
              gst_audio_encoder=gst_audio_encoder,
          )
          gst_builder.run()
      return sample_file
  
imports: from __future__ import division
  import gi
  from gi.repository import GLib, Gst
  import numpy
  import scipy.signal.waveforms
  import os.path
  import ffmpeg
label_desc: Use image node_id 1 for calling a global function with example usage: generate_sample_file(filename, samples_dir, gst_audio_encoder, sample_array, overwrite) and returns: sample_file