Skip to content

Instantly share code, notes, and snippets.

@therabidbanana
Created July 2, 2010 01:10
Show Gist options
  • Save therabidbanana/460776 to your computer and use it in GitHub Desktop.
Save therabidbanana/460776 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# encoding: utf=8
from pyechonest import config
config.ECHO_NEST_API_KEY=""
import echonest.audio as audio
from echonest.selection import fall_on_the
from echonest.sorting import duration
new_song_q = audio.AudioQuantumList()
song1 = audio.LocalAudioFile("Teen Horniness Is Not A Crime.mp3")
song2 = audio.LocalAudioFile("Youre The Best Around.mp3")
song3 = audio.LocalAudioFile("Thunderstruck.mp3")
# song4 = audio.LocalAudioFile("Tom Sawyer.mp3")
# song5 = audio.LocalAudioFile("Crawling.mp3")
# song6 = audio.LocalAudioFile("Hip-Hop Hooray.mp3")
beats2 = song2.analysis.beats
beats = song1.analysis.beats
ones = beats.that(fall_on_the(1))
twos = beats2.that(fall_on_the(2))
threes = song3.analysis.beats
i = 0
for beat in ones:
i = i+1
a = beat
if(len(twos) > 0):
b = twos.pop()
new_song_q.append(b)
new_song_q.append(a)
if(i % 3 > 1): new_song_q.append(a)
if(i % 3 < 2): new_song_q.append(b)
if(len(threes) > 0):
c = threes.pop()
if(i % 2 > 0): new_song_q.append(c)
new_song_q.encode("myNewSong.mp3")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment