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

Module audio

source code

The main Echo Nest Remix API module for manipulating audio files and their associated Echo Nest Analyze API analyses.

AudioData, and getpieces by Robert Ochshorn on 2008-06-06. Some refactoring and everything else by Joshua Lifton 2008-09-07. Refactoring by Ben Lacker 2009-02-11. Other contributions by Adam Lindsay.


Version: $Revision: 0 $

Classes [hide private]
    Base Classes
  AudioAnalysis
This class wraps echonest.web to allow transparent caching of the audio analysis of an audio file.
  AudioData
Handles audio data transparently.
    Audio-plus-Analysis Classes
  AudioFile
The basic do-everything class for remixing.
  ExistingTrack
Analysis only (under the analysis selector), with a local file known to be already analyzed by The Echo Nest's servers.
  LocalAudioFile
Like AudioFile, but with conditional upload: recommended.
  LocalAnalysis
Like LocalAudioFile, it conditionally uploads the file with which it was initialized.
    Building Blocks
  AudioQuantum
A unit of musical time, identified at minimum with a start time and a duration, both in seconds.
  AudioSegment
Subclass of AudioQuantum for the data-rich segments returned by the Analyze API.
  AudioQuantumList
A container that enables content-based selection and filtering.
Functions [hide private]
    Audio helper functions
 
getpieces(audioData, segs)
Collects audio samples for output.
source code
call graph 
 
mix(audioDataA, audioDataB, mix=0.5)
Mixes two AudioData objects.
source code
    Utility functions
 
chain_from_mixed(iterables)
Helper function to flatten a list of elements and lists into a list of elements.
source code
    Parsers
 
dataParser(tag, doc)
Generic XML parser for bars, beats, and tatums.
source code
 
attributeParser(tag, doc)
Generic XML parser for sections and (optionally) segments.
source code
 
globalParserFloat(doc)
Generic XML parser for tempo, duration, loudness, end_of_fade_in, and start_of_fade_out.
source code
 
globalParserInt(doc)
Generic XML parser for key, mode, and time_signature.
source code
 
barsParser(doc) source code
 
beatsParser(doc) source code
 
tatumsParser(doc) source code
 
sectionsParser(doc) source code
 
segmentsParser(doc) source code
 
metadataParser(doc)
Creates a dictionary of metadata values from the Analyze API call.
source code
 
fullSegmentsParser(doc)
Full-featured parser for the XML returned by get_segment in the Analyze API.
source code
Variables [hide private]
  PARSERS = {'bars': barsParser, 'beats': beatsParser, 'sections...
A shorthand input for AudioAnalysis, associating keys (which are also exposed as accessors via AudioAnalysis.__getattribute__()) with parsing functions.
Function Details [hide private]

getpieces(audioData, segs)

source code 
call graph 
Collects audio samples for output. Returns a new AudioData where the new sample data is assembled from the input audioData according to the time offsets in each of the elements of the input segs (commonly an AudioQuantumList).
Parameters:
  • audioData - an AudioData object
  • segs - an iterable containing objects that may be accessed as slices or indices for an AudioData

mix(audioDataA, audioDataB, mix=0.5)

source code 

Mixes two AudioData objects. Assumes they have the same sample rate and number of channels.

Mix takes a float 0-1 and determines the relative mix of two audios. i.e., mix=0.9 yields greater presence of audioDataA in the final mix.


Variables Details [hide private]

PARSERS

A shorthand input for AudioAnalysis, associating keys (which are also exposed as accessors via AudioAnalysis.__getattribute__()) with parsing functions.
Value:
{'bars': barsParser, 'beats': beatsParser, 'sections': sectionsParser,\
 'segments': fullSegmentsParser, 'tatums': tatumsParser, 'metadata': m\
etadataParser, 'tempo': globalParserFloat, 'duration': globalParserFlo\
at, 'loudness': globalParserFloat, 'end_of_fade_in': globalParserFloat\
, 'start_of_fade_out': globalParserFloat, 'key': globalParserInt, 'mod\
e': globalParserInt, 'time_signature': globalParserInt,}