code: def __init__(self, array, samplerate):
      self.appsrc = Gst.ElementFactory.make("appsrc")
      self.pos = 0
      self.samplerate = samplerate
      if array.ndim == 1:
          array.resize((array.shape[0], 1))
      self.length, self.channels = array.shape
      self.array = array.astype("float32")
      self.per_sample = Gst.SECOND // samplerate
      self.fac = self.channels * array.dtype.itemsize
      # self.appsrc.set_property("size", (self.length * self.channels *
      #                                  array.dtype.itemsize))
      self.appsrc.set_property("format", Gst.Format.TIME)
      capstr = """audio/x-raw,format=F32LE,
                      layout=interleaved,
                      rate=%d,
                      channels=%d""" % (
          self.samplerate,
          self.channels,
      )
      self.appsrc.set_property("caps", Gst.caps_from_string(capstr))
      self.appsrc.set_property("stream-type", 0)  # Seekable
      self.appsrc.set_property("block", True)
  
      self.appsrc.connect("need-data", self.need_data)
      self.appsrc.connect("seek-data", self.seek_data)
      self.appsrc.connect("enough-data", self.enough_data)
  
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 to create a new NumpySrc object  with example: obj = NumpySrc(array, samplerate)