Package echonest :: Package remix :: 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 uses (but does not wrap) pyechonest.track to allow transparent caching of the audio analysis of an audio file.
  AudioRenderable
An object that gives an AudioData in response to a call to its render() method. Intended to be an abstract class that helps enforce the AudioRenderable protocol. Picked up a couple of convenience methods common to many descendants.
  AudioData
Handles audio data transparently. A smart audio container with accessors that include:
  AudioData32
A 32-bit variant of AudioData, intended for data collection on audio rendering with headroom.
    Audio-plus-Analysis Classes
  LocalAudioFile
The basic do-everything class for remixing. Acts as an AudioData object, but with an added analysis selector which is an AudioAnalysis object. It conditianally uploads the file it was initialized with. If the file is already known to the Analyze API, then it does not bother uploading the file.
  LocalAnalysis
Like LocalAudioFile, it conditionally uploads the file with which it was initialized. Unlike LocalAudioFile, it is not a subclass of AudioData, so contains no sample data.
    Building Blocks
  AudioQuantum
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.
  AudioSegment
Subclass of AudioQuantum for the data-rich segments returned by the Analyze API.
  ModifiedRenderable
Class that contains any AudioRenderable, but overrides the render() method with nested effects, called sequentially on the result of the preceeding effect.
  AudioQuantumList
A container that enables content-based selection and filtering. A List that contains AudioQuantum objects, with additional methods for manipulating them.
    Effects
  AudioEffect
  LevelDB
  AmplitudeFactor
  TimeTruncateFactor
  TimeTruncateLength
  Simultaneous
Stacks all contained AudioQuanta atop one another, adding their respective samples. The rhythmic length of the segment is the duration of the first AudioQuantum, but there can be significant overlap caused by the longest segment.
    Exception Classes
  FileTypeError
  EchoNestRemixError
Error raised by the Remix API.
Functions [hide private]
 
get_os()
returns is_linux, is_mac, is_windows
source code
    Audio helper functions
 
getpieces(audioData, segs)
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).
source code
 
assemble(audioDataList, numChannels=1, sampleRate=44100, verbose=True)
Collects audio samples for output. Returns a new AudioData object assembled by concatenating all the elements of audioDataList.
source code
 
mix(dataA, dataB, mix=0.5)
Mixes two AudioData objects. Assumes they have the same sample rate and number of channels.
source code
 
megamix(dataList)
Mix together any number of AudioData objects. Keep the shape of the first one in the list. Assume they all have the same sample rate and number of channels.
source code
    ffmpeg helper functions
 
ffmpeg(infile, outfile=None, overwrite=True, bitRate=None, numChannels=None, sampleRate=None, verbose=True)
Executes ffmpeg through the shell to convert or read media files.
source code
 
settings_from_ffmpeg(parsestring)
Parses the output of ffmpeg to determine sample rate and frequency of an audio file.
source code
 
ffmpeg_error_check(parsestring)
Looks for known errors in the ffmpeg output
source code
    Utility functions
 
_dataParser(tag, nodes) source code
 
_attributeParser(tag, nodes) source code
 
_segmentsParser(nodes) source code
Variables [hide private]
  MP3_BITRATE = 128
  ffmpeg_install_instructions = '\nen-ffmpeg not found! Please m...
  __package__ = 'echonest.remix'
  __warningregistry__ = {('Not importing directory \'/home/thor/...
Function Details [hide private]

getpieces(audioData, segs)

source code 
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

assemble(audioDataList, numChannels=1, sampleRate=44100, verbose=True)

source code 
Collects audio samples for output. Returns a new AudioData object assembled by concatenating all the elements of audioDataList.
Parameters:

mix(dataA, dataB, 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 dataA in the final mix.


Variables Details [hide private]

ffmpeg_install_instructions

Value:
'''
en-ffmpeg not found! Please make sure ffmpeg is installed and create a\
 link as follows:
    sudo ln -s `which ffmpeg` /usr/local/bin/en-ffmpeg
'''

__warningregistry__

Value:
{('Not importing directory \'/home/thor/Code/remix/pyechonest\': missi\
ng __init__.py',
  <type 'exceptions.ImportWarning'>,
  40): True}