<div>I wrote a simple ffmpeg wrapper for extracting audio recently (<a href="https://github.com/jhurliman/node-pcm">https://github.com/jhurliman/node-pcm</a>). It's a node.js library but here is the relevant ffmpeg command:</div>
<div><br></div>var ffmpeg = spawn('ffmpeg', ['-i',filename,'-f','s16le','-ac',channels, '-acodec','pcm_s16le','-ar',sampleRate,'-y','pipe:1']);<br>
<br>Then read in stdout as a stream of 16-bit signed little endian integers and divide each by 32767.0 to convert to floating point. Hope that helps, and with any luck I'll make it this Thursday.<div><br></div><div>Best,</div>
<div>John Hurliman<br><div><br><div class="gmail_quote">On Mon, Mar 19, 2012 at 10:57 PM, gershon bialer <span dir="ltr"><<a href="mailto:gershon.bialer@gmail.com">gershon.bialer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Steve,<br>
<br>
Thats cool that you wrote that Stack Overflow answer.<br>
<br>
PyMIR looks like a good start. I see that Jeremy has a nice hack for<br>
importing from ffmpeg. I suppose we could try using ffmpeg's API<br>
directly, although that can be a tricky API to work with. I'd like to<br>
be able to play this at least as a sanity check. I suppose you might<br>
be able to play it with audiolab, but I think that requires converting<br>
from int16 to float. I suppose float might be better for fft and such,<br>
anyway. I tried feeding it back to ffplay with:<br>
   ffmpeg = Popen([<br>
            "ffplay",<br>
            "-i -"],<br>
            stdin=PIPE, stderr=open(os.devnull,"w"))<br>
   ffmpeg.communicate(mp3Array.tostring())<br>
but that doesn't seem to work. What do you think is the best way to do this?<br>
<br>
MFCC would be cool to work with. Is it invertible? How does it sound inverted?<br>
<br>
Does NMF give a sparse representation? What is a good reference on NMF?<br>
<br>
Thanks,<br>
Gershon Bialer<br>
<div class="HOEnZb"><div class="h5"><br>
On Mon, Mar 19, 2012 at 4:33 PM, Steve Tjoa <<a href="mailto:stjoa@izotope.com">stjoa@izotope.com</a>> wrote:<br>
> Hello Gershon, others,<br>
><br>
> Lurker here. That happens to be my code and Stack Overflow answer that you<br>
> linked to!<br>
><br>
> Regarding concerns in this email thread:<br>
><br>
> 1. Despite that "Python in Music" page, the lack of basic, simple<br>
> audio/music processing libraries in Python has motivated my friend Jeremy to<br>
> begin a Github repo for that very purpose named PyMIR:<br>
> (<a href="http://jsawruk.com/?p=141" target="_blank">http://jsawruk.com/?p=141</a>). Feel free to use or contribute.<br>
><br>
> 2. In there, you will find an MP3 importer that Jeremy wrote.<br>
><br>
> 3. I have custom-brewed stuff for audio feature extraction operations,<br>
> including MFCCs. I also have sparse coding and NMF stuff.  If there are<br>
> specific requests that I can fulfill, I will add them to the repo.<br>
><br>
> Please feel free to ask if you have any questions.<br>
><br>
> Steve<br>
> <a href="http://stevetjoa.com" target="_blank">http://stevetjoa.com</a><br>
><br>
><br>
> On Sun, Mar 18, 2012 at 10:59 PM, gershon bialer <<a href="mailto:gershon.bialer@gmail.com">gershon.bialer@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Yeah, thursday would be cool.<br>
>><br>
>> Friture looks interesting, I'll have to see I found some code at<br>
>> <a href="http://stackoverflow.com/questions/2459295/stft-and-istft-in-python" target="_blank">http://stackoverflow.com/questions/2459295/stft-and-istft-in-python</a><br>
>> for doing the spectogram. I couldn't find a good library for importing<br>
>> mp3's into python. Although, I suppose we can work with wav files for<br>
>> now.<br>
>><br>
>> On Sun, Mar 18, 2012 at 10:50 PM, Mike Schachter<br>
>> <<a href="mailto:mschachter@eigenminds.com">mschachter@eigenminds.com</a>> wrote:<br>
>> > Hey Gershon,<br>
>> ><br>
>> > Do you want to meet up this Thursday and talk about<br>
>> > time-frequency representations for sound? I'm looking<br>
>> > at various packages in python. One that struck my eye<br>
>> > was a real-time spectrogram package:<br>
>> ><br>
>> > <a href="http://tlecomte.github.com/friture/" target="_blank">http://tlecomte.github.com/friture/</a><br>
>> ><br>
>> > Anyone else interested in this kind of stuff too? I could<br>
>> > put something on the calendar and make an official-like<br>
>> > announcement.<br>
>> ><br>
>> >  mike<br>
>> ><br>
>> > On Thu, Mar 15, 2012 at 12:00 PM, Mike Schachter<br>
>> > <<a href="mailto:mschachter@eigenminds.com">mschachter@eigenminds.com</a>> wrote:<br>
>> >> That's awesome Gershon!<br>
>> >><br>
>> >> I can't come out tonight, but how about we meet<br>
>> >> up next Thursday and have a discussion about using<br>
>> >> deep nets for sound feature extraction? Spectrograms<br>
>> >> are also be invertible feature representation, as long<br>
>> >> as you use the overlapping windows for the FFT.<br>
>> >><br>
>> >>  mike<br>
>> >><br>
>> >><br>
>> >><br>
>> >> On Thu, Mar 15, 2012 at 11:42 AM, gershon bialer<br>
>> >> <<a href="mailto:gershon.bialer@gmail.com">gershon.bialer@gmail.com</a>> wrote:<br>
>> >>> Hi,<br>
>> >>><br>
>> >>> Do you want to meet again tonight?<br>
>> >>><br>
>> >>> I played a bit with trying to build a generative model for creating<br>
>> >>> music like we were talking about. I also read the papers and looked at<br>
>> >>> the tutorial on deep learning.<br>
>> >>><br>
>> >>> I think the first step is to find an invertible, sparse, feature,<br>
>> >>> representation. I think this would be MFCC or some sort of linear<br>
>> >>> predictive coding. I suppose you could then apply some of the deep<br>
>> >>> learning stuff to it for a generative model. Any thoughts?<br>
>> >>> --<br>
>> >>> ---------------------<br>
>> >>> Gershon Bialer<br>
>> >>> _______________________________________________<br>
>> >>> ml mailing list<br>
>> >>> <a href="mailto:ml@lists.noisebridge.net">ml@lists.noisebridge.net</a><br>
>> >>> <a href="https://www.noisebridge.net/mailman/listinfo/ml" target="_blank">https://www.noisebridge.net/mailman/listinfo/ml</a><br>
>><br>
>><br>
>><br>
>> --<br>
>> ---------------------<br>
>> Gershon Bialer<br>
>> _______________________________________________<br>
>> ml mailing list<br>
>> <a href="mailto:ml@lists.noisebridge.net">ml@lists.noisebridge.net</a><br>
>> <a href="https://www.noisebridge.net/mailman/listinfo/ml" target="_blank">https://www.noisebridge.net/mailman/listinfo/ml</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
---------------------<br>
Gershon Bialer<br>
_______________________________________________<br>
ml mailing list<br>
<a href="mailto:ml@lists.noisebridge.net">ml@lists.noisebridge.net</a><br>
<a href="https://www.noisebridge.net/mailman/listinfo/ml" target="_blank">https://www.noisebridge.net/mailman/listinfo/ml</a><br>
</div></div></blockquote></div><br></div></div>