I am trying to use portaudio (being cross platform capability), to read in from microphone, then i want to put that data through a FFT, but i am not so sure how to do it.
Alot of people have told me: 1.get the data, 2.apply fft,
but the problem is i am not so sure how to get the data, portaudio doesn’t have much tutorials on grabbing input from mic, if you know any code, tutorials or any other resource it would be great full. I been searching on this for a while now. Please help
I am trying to use portaudio (being cross platform capability), to read in from
Share
The portaudio distribution has documentation in the form of example C programs. They are in the
testdirectory and are usually calledpatest_.... There is lots of good material there and the docs contain an overview with very short description,The one you want to look at is
patest_record, which does asynchronous recording via a call-back. This is the way to go if you want to do anything serious, IMHO. But there is alsopatest_read_record.c, which does synchronous (blocking) IO.The code is actually very easy, here are the relevant parts (lots of stuff left out):
1/ you malloc a buffer 2/ you install a callback 3/ in the callback, you copy the data to your buffer
Again, this is simplified, but you get the idea. There is a fair amount of bookkeeping and the sample code isn’t the squeeky cleanest, but it is easy to adapt to your purposes.