Jump to content
  • Advertisement
Sign in to follow this  
ouraqt

Sound Recording and Playback at the Same Time

This topic is 2993 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

I am running Windows 7, 64-bit, programming in C++. I want to feed audio input from a microphone to the speakers in real time. I tried using the Win32 WaveIn and WaveOut APIs, but the latency was much to large (as in, > 800 ms). What is the smallest delay I can expect to achieve, and what audio library would allow me to do so? I am looking into OpenAL (and considering FMOD as well?). DirectSound also sounds promising, but it is technically deprecated and being phased out, it seems. Audacity seems to do a fairly decent job at software playthrough (you can enable it in the preferences). I want to achieve at least that level of performance.

Share this post


Link to post
Share on other sites
Advertisement
You can do that very easily without writing any code at all: http://blogs.msdn.com/larryosterman/archive/2009/08/04/a-few-of-my-favorite-win7-sound-features-capture-monitor-aka-listen-to.aspx

However if you want to do it with code so you can say process the data the main thing to note is when doing that you want really small buffers (a few hundred samples at most). The bigger the buffer the more latency you get. For example at a standard 44.1 KHz sampling rate 441 samples take 10ms to play.

You could also look into ASIO which is an API aimed specifically at low latency audio, but not all hardware supports it.

There's also WASAPI.

Share this post


Link to post
Share on other sites
Small buffers - got it. But I'm also trying to do an FFT on the data - and from my knowledge of FFTs, larger buffers give more accurate fourier transforms. I'm trying to determine the fundamental pitch of the mic input in real time - I guess the problem is using a small buffer size with FFTs doesn't work very well.

Hmmm...I wonder how autotune does it.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!