Package timeside :: Package decoder :: Module core :: Class ArrayDecoder
[hide private]
[frames] | no frames]

Class ArrayDecoder

source code

         object --+        
                  |        
component.Component --+    
                      |    
         core.Processor --+
                          |
                         ArrayDecoder

Decoder taking Numpy array as input

Nested Classes [hide private]

Inherited from core.Processor: __metaclass__

Instance Methods [hide private]
 
__init__(self, samples, samplerate=44100, start=0, duration=None)
Construct a new ArrayDecoder from an numpy array
source code
 
setup(self, channels=None, samplerate=None, blocksize=None)
Allocate internal resources and reset state, so that this processor is ready for a new run.
source code
 
get_frames(self)
Define an iterator that will return frames at the given blocksize
source code
 
process(self, frames=None, eod=False)
Process input frames and return a (output_frames, eod) tuple.
source code
 
channels(self)
Number of channels in the data returned by process().
source code
 
samplerate(self)
Samplerate of the data returned by process().
source code
 
blocksize(self)
The total number of frames that this processor can output for each step in the pipeline, or None if the number is unknown.
source code
 
totalframes(self)
The total number of frames that this processor will output, or None if the number is unknown.
source code
 
release(self)
Release resources owned by this processor.
source code
 
mediainfo(self)
Information about the media object uri start duration
source code
 
__del__(self) source code
 
format(self)
Return a user-friendly file format string
source code
 
encoding(self)
Return a user-friendly encoding string
source code
 
resolution(self)
Return the sample width (8, 16, etc..) of original audio file/stream, or None if not applicable/known
source code
 
metadata(self)
Return the metadata embedded into the encoded stream, if any.
source code

Inherited from core.Processor: __or__, post_process, uuid

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
id()
Short alphanumeric, lower-case string which uniquely identify this processor, suitable for use as an HTTP/GET argument value, in filenames, etc...
source code
Class Variables [hide private]
  mimetype = ''
  output_blocksize = 8192
  output_samplerate = None
hash(x)
  output_channels = None
hash(x)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

id()
Static Method

source code 

Short alphanumeric, lower-case string which uniquely identify this processor, suitable for use as an HTTP/GET argument value, in filenames, etc...

Decorators:
  • @interfacedoc

__init__(self, samples, samplerate=44100, start=0, duration=None)
(Constructor)

source code 

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

Overrides: object.__init__

setup(self, channels=None, samplerate=None, blocksize=None)

source code 

Allocate internal resources and reset state, so that this processor is ready for a new run.

The channels, samplerate and/or blocksize and/or totalframes arguments may be required by processors which accept input. An error will occur if any of these arguments is passed to an output-only processor such as a decoder.

Overrides: core.Processor.setup
(inherited documentation)

process(self, frames=None, eod=False)

source code 

Process input frames and return a (output_frames, eod) tuple. Both input and output frames are 2D numpy arrays, where columns are channels, and containing an undetermined number of frames. eod=True means that the end-of-data has been reached.

Output-only processors (such as decoders) will raise an exception if the frames argument is not None. All processors (even encoders) return data, even if that means returning the input unchanged.

Warning: it is required to call setup() before this method.

Decorators:
  • @interfacedoc
Overrides: core.Processor.process

channels(self)

source code 

Number of channels in the data returned by process(). May be different from the number of channels passed to setup()

Decorators:
  • @interfacedoc
Overrides: core.Processor.channels

samplerate(self)

source code 

Samplerate of the data returned by process(). May be different from the samplerate passed to setup()

Decorators:
  • @interfacedoc
Overrides: core.Processor.samplerate

blocksize(self)

source code 

The total number of frames that this processor can output for each step in the pipeline, or None if the number is unknown.

Decorators:
  • @interfacedoc
Overrides: core.Processor.blocksize

totalframes(self)

source code 

The total number of frames that this processor will output, or None if the number is unknown.

Decorators:
  • @interfacedoc
Overrides: core.Processor.totalframes

release(self)

source code 

Release resources owned by this processor. The processor cannot be used anymore after calling this method.

Decorators:
  • @interfacedoc
Overrides: core.Processor.release

mediainfo(self)

source code 

Information about the media object uri start duration

Decorators:
  • @interfacedoc
Overrides: core.Processor.mediainfo

__del__(self)
(Destructor)

source code 
Overrides: core.Processor.__del__

format(self)

source code 

Return a user-friendly file format string

Decorators:
  • @interfacedoc

encoding(self)

source code 

Return a user-friendly encoding string

Decorators:
  • @interfacedoc

resolution(self)

source code 

Return the sample width (8, 16, etc..) of original audio file/stream, or None if not applicable/known

Decorators:
  • @interfacedoc

metadata(self)

source code 

Return the metadata embedded into the encoded stream, if any.

Decorators:
  • @interfacedoc