Skip to content

Instantly share code, notes, and snippets.

@youpy
Created March 27, 2009 08:55
Show Gist options
  • Save youpy/86608 to your computer and use it in GitHub Desktop.
Save youpy/86608 to your computer and use it in GitHub Desktop.
import sys
import echonest.audio as audio
def main(filename):
inputFile = audio.LocalAudioFile(filename)
inputChunks = inputFile.analysis.beats
modifiedAudio = audio.getpieces(inputFile, sorted(inputChunks, compare))
modifiedAudio.encode('sorted.mp3')
def compare(a, b):
return cmp(a.duration, b.duration)
main(sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment