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

Class AudioQuantum

source code


A unit of musical time, identified at minimum with a start time and a duration, both in seconds. It most often corresponds with a section, bar, beat, tatum, or (by inheritance) segment obtained from an Analyze API call.

Additional properties include:

end
computed time offset for convenience: start + duration
container
a circular reference to the containing AudioQuantumList, created upon creation of the AudioQuantumList that covers the whole track
Instance Methods [hide private]
 
__init__(self, start=0, duration=0, kind=None, confidence=None, source=None)
Initializes an AudioQuantum.
source code
 
get_end(self) source code
 
get_source(self)
Returns itself or its parent.
source code
 
set_source(self, value) source code
 
parent(self)
Returns the containing AudioQuantum in the rhythm hierarchy: a tatum returns a beat, a beat returns a bar, and a bar returns a section. Note that some AudioQuantums have no parent. None will be returned in this case.
source code
 
children(self)
Returns an AudioQuantumList of the AudioQuanta that it contains, one step down the hierarchy. A beat returns tatums, a bar returns beats, and a section returns bars.
source code
 
mean_pitches(self)
Returns a pitch vector that is the mean of the pitch vectors of any segments that overlap this AudioQuantum. Note that this means that some segments will appear in more than one AudioQuantum.
source code
 
mean_timbre(self)
Returns a timbre vector that is the mean of the pitch vectors of any segments that overlap this AudioQuantum. Note that this means that some segments will appear in more than one AudioQuantum.
source code
 
mean_loudness(self)
Returns the mean of the maximum loudness of any segments that overlap this AudioQuantum. Note that this means that some segments will appear in more than one AudioQuantum.
source code
 
group(self)
Returns the children() of the AudioQuantum's parent(). In other words: 'siblings'. If no parent is found, then return the AudioQuantumList for the whole track.
source code
 
prev(self, step=1)
Step backwards in the containing AudioQuantumList. Returns self if a boundary is reached.
source code
 
next(self, step=1)
Step forward in the containing AudioQuantumList. Returns self if a boundary is reached.
source code
 
__str__(self)
Lists the AudioQuantum.kind with start and end times, in seconds, e.g.:
source code
 
__repr__(self)
A string representing a constructor, including kind, start time, duration, and (if it exists) confidence, e.g.:
source code
 
local_context(self)
Returns a tuple of (index, length) within rhythm siblings, where index is the (zero-indexed) position within its group(), and length is the number of siblings within its group().
source code
 
absolute_context(self)
Returns a tuple of (index, length) within the containing AudioQuantumList, where index is the (zero-indexed) position within its container, and length is the number of siblings within the container.
source code
 
context_string(self)
Returns a one-indexed, human-readable version of context. For example:
source code
 
__getstate__(self)
Eliminates the circular reference for pickling.
source code
 
toxml(self, context=None) source code
 
render(self, start=0.0, to_audio=None, with_source=None) source code

Inherited from AudioRenderable: encode, resolve_source, sources

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

Static Methods [hide private]

Inherited from AudioRenderable: init_audio_data

Properties [hide private]
  end
A computed property: the sum of start and duration.
  source
The AudioData source for the AudioQuantum.
  segments
Returns any segments that overlap or are in the same timespan as the AudioQuantum. Note that this means that some segments will appear in more than one AudioQuantum. This function, thus, is NOT suited to rhythmic modifications.

Inherited from object: __class__

Method Details [hide private]

__init__(self, start=0, duration=0, kind=None, confidence=None, source=None)
(Constructor)

source code 
Initializes an AudioQuantum.
Parameters:
  • start - offset from the start of the track, in seconds
  • duration - length of the AudioQuantum
  • kind - string containing what kind of rhythm unit it came from
  • confidence - float between zero and one
Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

Lists the AudioQuantum.kind with start and end times, in seconds, e.g.:

"segment (20.31 - 20.42)"
Overrides: object.__str__

__repr__(self)
(Representation operator)

source code 

A string representing a constructor, including kind, start time, duration, and (if it exists) confidence, e.g.:

"AudioQuantum(kind='tatum', start=42.198267, duration=0.1523394)"
Overrides: object.__repr__

Property Details [hide private]

end

A computed property: the sum of start and duration.
Get Method:
get_end(self)

source

The AudioData source for the AudioQuantum.
Get Method:
get_source(self) - Returns itself or its parent.
Set Method:
set_source(self, value)

segments

Returns any segments that overlap or are in the same timespan as the AudioQuantum. Note that this means that some segments will appear in more than one AudioQuantum. This function, thus, is NOT suited to rhythmic modifications.
Get Method:
unreachable.segments(self) - Returns any segments that overlap or are in the same timespan as the AudioQuantum. Note that this means that some segments will appear in more than one AudioQuantum. This function, thus, is NOT suited to rhythmic modifications.