pyechonest.track
index
http://pyechonest.googlecode.com/svn/trunk/doc/track.py

 
Modules
       
hashlib
json
urllib2
pyechonest.util

 
Classes
       
pyechonest.proxies.TrackProxy(pyechonest.proxies.GenericProxy)
Track

 
class Track(pyechonest.proxies.TrackProxy)
    Represents an audio analysis from The Echo Nest.
 
All methods in this module return Track objects.
 
Attributes:
 
    analysis_channels       int: the number of audio channels used during analysis
 
    analysis_sample_rate    float: the sample rate used during analysis
 
    analyzer_version        str: e.g. '3.01a'
 
    artist                  str or None: artist name
 
    bars                    list of dicts: timing of each measure
 
    beats                   list of dicts: timing of each beat
 
    bitrate                 int: the bitrate of the input mp3 (or other file)
    
    danceability            float: relative danceability (0 to 1)
 
    duration                float: length of track in seconds
    
    energy                  float: relative energy (0 to 1)
 
    end_of_fade_in          float: time in seconds track where fade-in ends
 
    id                      str: Echo Nest Track ID, e.g. 'TRTOBXJ1296BCDA33B'
 
    key                     int: between 0 (key of C) and 11 (key of B flat) inclusive
 
    key_confidence          float: confidence that key detection was accurate
 
    loudness                float: overall loudness in decibels (dB)
 
    md5                     str: 32-character checksum of the input mp3
 
    meta                    dict: other track metainfo
 
    mode                    int: 0 (major) or 1 (minor)
 
    mode_confidence         float: confidence that mode detection was accurate
 
    num_samples             int: total samples in the decoded track
 
    release                 str or None: the album name
 
    sample_md5              str: 32-character checksum of the decoded audio file
 
    samplerate              int: sample rate of input mp3
 
    sections                list of dicts: larger sections of song (chorus, bridge, solo, etc.)
 
    segments                list of dicts: timing, pitch, loudness and timbre for each segment
 
    start_of_fade_out       float: time in seconds where fade out begins
 
    status                  str: analysis status, e.g. 'complete', 'pending', 'error'
 
    tatums                  list of dicts: the smallest metrical unit (subdivision of a beat)
 
    tempo                   float: overall BPM (beats per minute)
 
    tempo_confidence        float: confidence that tempo detection was accurate
 
    title                   str or None: song title
 
Each bar, beat, section, segment and tatum has a start time, a duration, and a confidence,
in addition to whatever other data is given.
 
Examples:
 
>>> t = track.track_from_id('TRXXHTJ1294CD8F3B3')
>>> t
<track - Neverwas Restored (from Neverwas Soundtrack)>
>>> t = track.track_from_md5('b8abf85746ab3416adabca63141d8c2d')
>>> t
<track - Neverwas Restored (from Neverwas Soundtrack)>
>>>
 
 
Method resolution order:
Track
pyechonest.proxies.TrackProxy
pyechonest.proxies.GenericProxy
__builtin__.object

Methods defined here:
__repr__(self)
__str__(self)

Methods inherited from pyechonest.proxies.TrackProxy:
__init__(self, identifier, md5, properties)
You should not call this constructor directly, rather use the convenience functions
that are in track.py. For example, call track.track_from_filename
Let's always get the bucket `audio_summary`

Methods inherited from pyechonest.proxies.GenericProxy:
get_attribute(self, method_name, **kwargs)
post_attribute(self, method_name, **kwargs)

Data descriptors inherited from pyechonest.proxies.GenericProxy:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
track_from_file(file_object, filetype)
Create a track object from a file-like object.
 
Args:
    file_object: a file-like Python object
    filetype: the file type (ex. mp3, ogg, wav)
track_from_filename(filename, filetype=None)
Create a track object from a filename.
 
Args:
    filename: A string containing the path to the input file.
    filetype: A string indicating the filetype; Defaults to None (type determined by file extension).
track_from_id(identifier)
Create a track object from an Echo Nest track ID.
 
Args:
    identifier: A string containing the ID of a track already analyzed (looks like "TRLMNOP12345678901").
track_from_md5(md5)
Create a track object from an md5 hash.
 
Args:
    md5: A string 32 characters long giving the md5 checksum of a track already analyzed.
track_from_reanalyzing_id(identifier)
Create a track object from an Echo Nest track ID, reanalyzing the track first.
 
Args:
    identifier: A string containing the ID of a track already analyzed (looks like "TRLMNOP12345678901").
track_from_reanalyzing_md5(md5)
Create a track object from an md5 hash, reanalyzing the track first.
 
Args:
    md5: A string containing the md5 of a track already analyzed (looks like "TRLMNOP12345678901").
track_from_url(url)
Create a track object from a public http URL.
 
Args:
    url: A string giving the URL to read from. This must be on a public machine accessible by HTTP.