Class AudioAnalysis
source code
This class wraps echonest.web to allow transparent caching of the
audio analysis of an audio file.
For example, the following script will display the bars of a track
twice:
from echonest import *
a = audio.AudioAnalysis('YOUR_TRACK_ID_HERE')
a.bars
a.bars
The first time a.bars is called, a network request is made of the
Echo Nest Analyze API. The second time time a.bars is called, the
cached value is returned immediately.
An AudioAnalysis object can be created using an existing ID, as in
the example above, or by specifying the audio file to upload in
order to create the ID, as in:
a = audio.AudioAnalysis(filename='FULL_PATH_TO_AUDIO_FILE')
|
|
|
| Call Graph |
|
|
|
refreshCachedVariables(self)
Forces all cached variables to be updated over the network. |
source code
|
|
|
|
|
| Call Graph |
|
|
|
__setstate__(self,
state)
Recreates circular references after unpickling. |
source code
|
|
|
Inherited from object:
__delattr__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__,
__str__
|
|
|
CACHED_VARIABLES = ('bars', 'beats', 'duration', 'end_of_fade_...
Any variable in this listing is fetched over the network once
and then cached.
|
|
Inherited from object:
__class__
|
|
| Call Graph |
Constructor. If the argument is a valid local path or a URL,
the track ID is generated by uploading the file to the Echo Nest
Analyze API. Otherwise, the argument is assumed to be
the track ID.
- Parameters:
audio - A string representing either a path to a local
file, a valid URL, or the ID of a file that has already
been uploaded for analysis.
parsers - A dictionary of keys consisting of cached
variable names and values consisting of functions to
be used to parse those variables as they are cached.
No parsing is done for variables without parsing functions
or if the parsers argument is None.
- Overrides:
object.__init__
|
|
| Call Graph |
This function has been modified to support caching of
variables retrieved over the network. As a result, each
of the CACHED_VARIABLES is available as an accessor.
- Overrides:
object.__getattribute__
|
CACHED_VARIABLES
Any variable in this listing is fetched over the network once
and then cached. Calling refreshCachedVariables will force a
refresh.
- Value:
('bars',
'beats',
'duration',
'end_of_fade_in',
'key',
'loudness',
'metadata',
'mode',
...
|
|