Created
July 1, 2013 04:29
-
-
Save kscottz/5898352 to your computer and use it in GitHub Desktop.
Convert mp3 to numpy array. Ugly, but it works.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import scipy.io.wavfile as wav | |
# install lame | |
# install bleeding edge scipy (needs new cython) | |
fname = 'XC135672-Red-winged\ Blackbird1301.mp3' | |
oname = 'temp.wav' | |
cmd = 'lame --decode {0} {1}'.format( fname,oname ) | |
os.system(cmd) | |
data = wav.read(oname) | |
# your code goes here | |
print len(data[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment