• Advertisement
Sign in to follow this  

Getting audio signals from the sound chip?!

This topic is 3956 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all. I need to experiment with the FFT algorithm. So I need to get the audio signals from the sound chip, for example from signals from a mic. How can I do this? I found many tutorials about loading wav or mp3 files, but this is not what I need. I really need to get the signals real time. I want to draw a diagram/curve with the fft from the signals from the mic. This is what I want to do. I took OpenAl into account, but this seems not the right api for me. To game programming orientated, I think, but I realy have no idea! What about DirectX or fmod? I have no idea how to do it, so please be patient with me! ;) Grateful for any hint!!! Thanks Alex

Share this post


Link to post
Share on other sites
Advertisement
You need to read the docs on recording audio with whatever api you use, fmod has some sample code, and there should be samples in the directx sdk.
Imho the most sensible portable api for doing it is portaudio though.

Do you have strict latency requirements? If so you are in for a fun time with windows, unless you use a professional (i.e. not gamer) card with good ASIO drivers.

Share this post


Link to post
Share on other sites
Hi.

Wow, thanks for relying.
Before going into deep with sound cards, I would say the onboard sound chip must
be sufficient for the moment. I dont want to produce music or something similar, Im just interested in the math which applies to it and the programming experience.

Thanks for the link.
In the DirectX SDK I found somthing about sound programming. I think, this is the first place to start the journey.

Thanks and greetings
Alex

Share this post


Link to post
Share on other sites
DirectX is far more complicated than you need (as is fmod), that would be why I suggested portaudio. There's a really cool sensible tute for it here, and the steps for your portaudio app would be

* Write a callback function that will be called by PortAudio when audio processing is needed.
* Initialize the PA library and open a stream for audio input.
* Start the stream. Your callback function will be now be called repeatedly by PA in the background.
* In your callback do the FFT of the input buffer. Put the results somewhere accessable by the main thread. Watch out for thread synchronisation issues, and DON'T draw to screen from the callback.
* Call a stop function to stop the stream.
* Close the stream and terminate the library.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement