tags:

views:

712

answers:

3

I'd like to pull a stream of PCM samples from a Mac's line-in or built-in mic and do a little live analysis (the exact nature doesn't pertain to this question, but it could be an FFT every so often, or some basic statistics on the sample levels, or what have you).

What's a good fit for this? Writing an AudioUnit that just passes the sound through and incidentally hands it off somewhere for analysis? Writing a JACK-aware app and figuring out how to get it to play with the JACK server? Ecasound?

This is a cheesy proof-of-concept hobby project, so simplicity of API is the driving factor (followed by reasonable choice of programming language).

+2  A: 

Sample code for reading and writing audio data here:

http://developer.apple.com/samplecode/SimplePlayThru/index.html#//apple_ref/doc/uid/DTS10003350

And of course lots of good information at

http://developer.apple.com/audio/

Mark Harrison
+2  A: 

I think portaudio is what you need. Reading from the mike from a console app is a 10 line C file (see patests in the portaudio distrib).

diciu
You're right -- portaudio is ridiculously easy to get going with.
undees
+3  A: 
Chris Hanson
Hi, Chris. Audio Queue Services do indeed present a nice, clean API. I ended up going with portaudio with this project for Tiger compatibility, but have been gazing enviously at AQRecord.
undees