class_docstr: Represents in-memory audio data of a certain (convertible) representation.
  
  Attributes
  ----------
  audio_type : str
      See `__init__`.
  audio_format : util.audio.AudioFormat
      See `__init__`.
  audio : binary
      Audio data represented as indicated by `audio_type`
  duration : float
      Audio duration of the sample in seconds
class_docstr_tok: ["Represents","in-memory","audio","data","of","a","certain","(","convertible",")","representation",".","Attributes","--","--","--","--","--","audio_type",":","str","See","`","__init__","`",".","audio_format",":","util.audio.AudioFormat","See","`","__init__","`",".","audio",":","binary","Audio","data","represented","as","indicated","by","`","audio_type","`","duration",":","float","Audio","duration","of","the","sample","in","seconds"]
docstr: Parameters
  ----------
  audio_type : str
      Audio data representation type
      Supported types:
          - util.audio.AUDIO_TYPE_OPUS: Memory file representation (BytesIO) of Opus encoded audio
              wrapped by a custom container format (used in SDBs)
          - util.audio.AUDIO_TYPE_WAV: Memory file representation (BytesIO) of a Wave file
          - util.audio.AUDIO_TYPE_PCM: Binary representation (bytearray) of PCM encoded audio data (Wave file without header)
          - util.audio.AUDIO_TYPE_NP: NumPy representation of audio data (np.float32) - typically used for GPU feeding
  raw_data : binary
      Audio data in the form of the provided representation type (see audio_type).
      For types util.audio.AUDIO_TYPE_OPUS or util.audio.AUDIO_TYPE_WAV data can also be passed as a bytearray.
  audio_format : util.audio.AudioFormat
      Required in case of audio_type = util.audio.AUDIO_TYPE_PCM or util.audio.AUDIO_TYPE_NP,
      as this information cannot be derived from raw audio data.
  sample_id : str
      Tracking ID - should indicate sample's origin as precisely as possible
docstr_tok: ["Parameters","--","--","--","--","--","audio_type",":","str","Audio","data","representation","type","Supported","types",":","-","util.audio.AUDIO_TYPE_OPUS",":","Memory","file","representation","(","BytesIO",")","of","Opus","encoded","audio","wrapped","by","a","custom","container","format","(","used","in","SDBs",")","-","util.audio.AUDIO_TYPE_WAV",":","Memory","file","representation","(","BytesIO",")","of","a","Wave","file","-","util.audio.AUDIO_TYPE_PCM",":","Binary","representation","(","bytearray",")","of","PCM","encoded","audio","data","(","Wave","file","without","header",")","-","util.audio.AUDIO_TYPE_NP",":","NumPy","representation","of","audio","data","(","np.float32",")","-","typically","used","for","GPU","feeding","raw_data",":","binary","Audio","data","in","the","form","of","the","provided","representation","type","(","see","audio_type",")",".","For","types","util.audio.AUDIO_TYPE_OPUS","or","util.audio.AUDIO_TYPE_WAV","data","can","also","be","passed","as","a","bytearray",".","audio_format",":","util.audio.AudioFormat","Required","in","case","of","audio_type","=","util.audio.AUDIO_TYPE_PCM","or","util.audio.AUDIO_TYPE_NP",",","as","this","information","can","not","be","derived","from","raw","audio","data",".","sample_id",":","str","Tracking","ID","-","should","indicate","sample","'s","origin","as","precisely","as","possible"]
code: def __init__(
      self, audio_type, raw_data, audio_format=None, sample_id=None
  ):
      """
      Parameters
      ----------
      audio_type : str
          Audio data representation type
          Supported types:
              - util.audio.AUDIO_TYPE_OPUS: Memory file representation (BytesIO) of Opus encoded audio
                  wrapped by a custom container format (used in SDBs)
              - util.audio.AUDIO_TYPE_WAV: Memory file representation (BytesIO) of a Wave file
              - util.audio.AUDIO_TYPE_PCM: Binary representation (bytearray) of PCM encoded audio data (Wave file without header)
              - util.audio.AUDIO_TYPE_NP: NumPy representation of audio data (np.float32) - typically used for GPU feeding
      raw_data : binary
          Audio data in the form of the provided representation type (see audio_type).
          For types util.audio.AUDIO_TYPE_OPUS or util.audio.AUDIO_TYPE_WAV data can also be passed as a bytearray.
      audio_format : util.audio.AudioFormat
          Required in case of audio_type = util.audio.AUDIO_TYPE_PCM or util.audio.AUDIO_TYPE_NP,
          as this information cannot be derived from raw audio data.
      sample_id : str
          Tracking ID - should indicate sample's origin as precisely as possible
      """
      self.audio_type = audio_type
      self.audio_format = audio_format
      self.sample_id = sample_id
      if audio_type in SERIALIZABLE_AUDIO_TYPES:
          self.audio = (
              raw_data
              if isinstance(raw_data, io.BytesIO)
              else io.BytesIO(raw_data)
          )
          self.duration = read_duration(audio_type, self.audio)
          if not self.audio_format:
              self.audio_format = read_format(audio_type, self.audio)
      else:
          self.audio = raw_data
          if self.audio_format is None:
              raise ValueError(
                  'For audio type "{}" parameter "audio_format" is mandatory'.format(
                      self.audio_type
                  )
              )
          if audio_type == AUDIO_TYPE_PCM:
              self.duration = get_pcm_duration(
                  len(self.audio), self.audio_format
              )
          elif audio_type == AUDIO_TYPE_NP:
              self.duration = get_np_duration(
                  len(self.audio), self.audio_format
              )
          else:
              raise ValueError(
                  "Unsupported audio type: {}".format(self.audio_type)
              )
  
imports: import collections
  import ctypes
  import io
  import math
  import numpy
  import os
  import pyogg
  import tempfile
  import wave
  from .helpers import LimitingPool
  from collections import namedtuple
  from .io import open_remote, remove_remote, copy_remote, is_remote_path
label_desc: Use image node_id 1 to create a new Sample object  with example: obj = Sample(audio_type, raw_data, audio_format, sample_id)