class_docstr: Decoder taking Numpy array as input
class_docstr_tok: ["Decoder","taking","Numpy","array","as","input"]
docstr: Construct a new ArrayDecoder from an numpy array
  
  Parameters
  ----------
  samples : numpy array of dimension 1 (mono) or 2 (multichannel)
          if shape = (n) or (n,1) : n samples, mono
          if shape = (n,m) : n samples with m channels
  start : float
      start time of the segment in seconds
  duration : float
      duration of the segment in seconds
docstr_tok: ["Construct","a","new","ArrayDecoder","from","an","numpy","array","Parameters","--","--","--","--","--","samples",":","numpy","array","of","dimension","1","(","mono",")","or","2","(","multichannel",")","if","shape","=","(","n",")","or","(","n,1",")",":","n","samples",",","mono","if","shape","=","(","n",",","m",")",":","n","samples","with","m","channels","start",":","float","start","time","of","the","segment","in","seconds","duration",":","float","duration","of","the","segment","in","seconds"]
code: def __init__(self, samples, samplerate=44100, start=0, duration=None):
      """
      Construct a new ArrayDecoder from an numpy array
  
      Parameters
      ----------
      samples : numpy array of dimension 1 (mono) or 2 (multichannel)
              if shape = (n) or (n,1) : n samples, mono
              if shape = (n,m) : n samples with m channels
      start : float
          start time of the segment in seconds
      duration : float
          duration of the segment in seconds
      """
      super(ArrayDecoder, self).__init__(start=start, duration=duration)
  
      # Check array dimension
      if samples.ndim > 2:
          raise TypeError(
              "Wrong number of dimensions for argument samples"
          )
      if samples.ndim == 1:
          samples = samples[:, np.newaxis]  # reshape to 2D array
  
      self.samples = samples.astype(
          "float32"
      )  # Create a 2 dimensions array
      self.input_samplerate = samplerate
      self.input_channels = self.samples.shape[1]
  
      self.uri = "_".join(
          [
              "raw_audio_array",
              "x".join([str(dim) for dim in samples.shape]),
              samples.dtype.type.__name__,
          ]
      )
      from .utils import sha1sum_numpy
  
      self._sha1 = sha1sum_numpy(self.samples)
      self.frames = self.get_frames()
  
file_path: TimeSide/timeside/plugins/decoder/array.py
imports: from timeside.core import implements, interfacedoc
  from timeside.core.decoder import Decoder, IDecoder
  import numpy
label_desc: Use image node_id 2 to create a new ArrayDecoder object from inherited base classes: Decoder with example: obj = ArrayDecoder(samples, samplerate, start, duration)