Jump to content
  • Advertisement
Sign in to follow this  
eternovsky

Low-level Audio Programming

This topic is 5064 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 have a bit of a project I want to undertake. It's essence lies in taking a wave-form input from the microphone, taking the wave's inverse, mixing it with any sound being outputted via the sound card, and then outputting the mixed sound (preferably to a set of non-leaky earphones). What this should theoretically create is a background-noise cancelling effect. What I'm wondering is what should I use for programming the code. After looking at some libraries like OpenAL and SDL, I'm not too sure they will be able to achieve the effect I need. Which brings forth the question of something very low-level with direct access to the audio card. I've been looking around, but haven't really been able to find anything to suit my needs. Solutions for both Windows or Linux are OK. Can anyone please give me suggestions as to how to best approach this problem from a what-tool-to-use perspective? Thanks in advance, -Evgeny Ternovsky Marc Garneau Collegiate Institute

Share this post


Link to post
Share on other sites
Advertisement
As far as I know, ASIO drivers offer the lowest latency on most operating systems. The catch is you have to have a card that has ASIO drivers in the first place. If you have such a card, you can get the sdk here. If your card doesn't have ASIO drivers, native OpenAL drivers are probably slightly faster than DSound, but again, not many cards have those either.

Audigy, nForce2, and most other higher-end cards do have ASIO drivers however. Alternatively, PortAudio that lonesock gave you a link for has an ASIO wrapper (as well as a DSound and WMM) if you want to go that route.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
if you have a sblive/audigy series card, look into the kx driver project.

Share this post


Link to post
Share on other sites
Just off the top of my head...

Your simple wave-inversion idea will not work. That type of cancalling needs to be extremely low-latency. I doubt any PC could pull it off. If you're the slightest bit behind the sampling then you might still cancel out some of the low frequency noise, but you'll end up amplifying some of the higher frequency noise. In fact you'll probably have bands of louder, and softer pitch throughout the frequency range.

Ideally, I think you probablly need to get an exact measure of this delay, and then do a fft on the wave and reconstruct a signal with the same frequency components where each frequency is phase shifted by the correct amount, according to the fixed delay. This is in itself a 'chicken and egg' scenario as the resulting code, causes the delay to be different from the initial measurement.

This is all assuming that you orient your speakers and mic in exactly the right direction.

Good luck anyway!

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!