code: def numpy_array_to_gst_buffer(
      frames, chunk_size, num_samples, sample_rate
  ):
      """gstreamer buffer to numpy array conversion"""
      buf = Gst.Buffer.new_wrapped(frames.astype("float32").tobytes())
      # Set its timestamp and duration
      buf.timestamp = Gst.util_uint64_scale(
          num_samples, Gst.SECOND, sample_rate
      )
      buf.duration = Gst.util_uint64_scale(
          chunk_size, Gst.SECOND, sample_rate
      )
      return buf
  
file_path: TimeSide/timeside/core/tools/gstutils.py
imports: from numpy import frombuffer
  import gi
  from gi.repository import GLib, GObject, Gst
  import threading
label_desc: Use image node_id 1 for calling a global function with example usage: numpy_array_to_gst_buffer(frames, chunk_size, num_samples, sample_rate) and returns: buf