Package echonest :: Package remix :: Module audio :: Class AudioRenderable
[hide private]
[frames] | no frames]

Class AudioRenderable

source code


An object that gives an AudioData in response to a call to its render() method. Intended to be an abstract class that helps enforce the AudioRenderable protocol. Picked up a couple of convenience methods common to many descendants.

Every AudioRenderable must provide three things:

render()
A method returning the AudioData for the object. The rhythmic duration (point at which any following audio is appended) is signified by the endindex accessor, measured in samples.
source
An accessor pointing to the AudioData that contains the original sample data of (a superset of) this audio object.
duration
An accessor returning the rhythmic duration (in seconds) of the audio object.
Instance Methods [hide private]
 
resolve_source(self, alt)
Given an alternative, fallback alt source, return either self's source or the alternative. Throw an informative error if no source is found.
source code
 
sources(self) source code
 
encode(self, filename)
Shortcut function that takes care of the need to obtain an AudioData object first, through render.
source code

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

Static Methods [hide private]
 
init_audio_data(source, num_samples)
Convenience function for rendering: return a pre-allocated, zeroed AudioData.
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

resolve_source(self, alt)

source code 

Given an alternative, fallback alt source, return either self's source or the alternative. Throw an informative error if no source is found.

Utility code that ended up being replicated in several places, so it ended up here. Not necessary for use in the RenderableAudioObject protocol.