Mp3 parsing in Python
This is something I have been trying to do for a while, and is more of an
open ended question. If anyone has any knowledge that can help me shed
some light on this, it would be very much appreciated.
I want to decode the audio stream in an mp3 and use that to drive
animation, all using python. As I understand it, the audio data in an mp3
is stored in frames of 32 frequency subbands (or frequency bins), which is
ideal for me - if I could take an mp3 and extract an amplitude for each
subband on each frame, that would be perfect for what I want to do.
I found solution here https://bitbucket.org/portalfire/pymp3 where all the
processing seems to be done in python. It's quite slow, but even if I
could use that to extract what I want, it would be good - I'm struggling
to understand what's going on in that code though. I also had a solution
where I converted to wav and then used fft to extract frequencies from the
wav. This was very noisy and seems like a stupid way to do it as the data
I want is stored directly in the mp3 - converting back to a sound wave
seems unnecessary. This was actually faster than the first one though.
Here's what I ended up with:
http://www.youtube.com/watch?v=f_0FORxlK4A
Well if anyone has any advice, or experience they want to share, or ideas
for libraries I should look at, I'd really like to hear.
Thanks!
Henry
No comments:
Post a Comment