Package echonest :: 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)
Initializes an AudioQuantum.
source code
 
get_end(self) source code
call graph 
 
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.
source code
call graph 
 
children(self)
Returns an AudioQuantumList of the AudioQuanta that it contains, one step down the hierarchy.
source code
call graph 
 
group(self)
Returns the children() of the AudioQuantum's parent().
source code
call graph 
 
prev(self, step=1)
Step backwards in the containing AudioQuantumList.
source code
 
next(self, step=1)
Step forward in the containing AudioQuantumList.
source code
 
__str__(self)
Lists the AudioQuantum.kind with start and end times, in seconds, e.g.:
source code
call graph 
 
__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
call graph 
 
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
call graph 
 
context_string(self)
Returns a one-indexed, human-readable version of context.
source code
call graph 
 
__getstate__(self)
Eliminates the circular reference for pickling.
source code

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

Properties [hide private]
  end
A computed property: the sum of start and duration.

Inherited from object: __class__

Method Details [hide private]

__init__(self, start=0, duration=0, kind=None, confidence=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__

children(self)

source code 
call graph 
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.

group(self)

source code 
call graph 
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.

prev(self, step=1)

source code 
Step backwards in the containing AudioQuantumList. Returns self if a boundary is reached.

next(self, step=1)

source code 
Step forward in the containing AudioQuantumList. Returns self if a boundary is reached.

__str__(self)
(Informal representation operator)

source code 
call graph 

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__

context_string(self)

source code 
call graph 

Returns a one-indexed, human-readable version of context. For example:

"bar 4 of 142, beat 3 of 4, tatum 2 of 3"

Property Details [hide private]

end

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