This project has moved and is read-only. For the latest updates, please go here.

Change Default Audio Device?

Feb 2, 2015 at 11:05 AM
I'm doing some voice recognition work, but in the System.Speech .NET libraries, there are only two relevant options: SetInputToDefaultAudioDevice, or SetInputToAudioStream. Since a lot of users don't have the correct audio device set in Windows, I can't really rely on the first one.

So, I have two options:

A) Find a way to set the Default Audio Device for them from a list of devices. Is this possible in NAudio?
B) Find a way to configure any device into a standard .NET AudioStream, which I have no idea how to do.

Any ideas, guys? Thanks in advance.
Feb 2, 2015 at 1:41 PM
The Windows WASAPI APIs are probably the best way to access these. NAudio exposes these APIs with the MMDeviceEnumerator.

I'm not sure exactly what you mean by the second question. Might be best to ask on a forum where people know about the System.Speech libraries.
Feb 3, 2015 at 2:52 AM
Thanks, Mark! I'll take a look at those APIs tomorrow.
Feb 3, 2015 at 3:17 AM
Well, it looks like I can't change the default recording device by design from Microsoft. There appear to be a few hacky/unsupported/internal API stuff that might do it, but it all seems difficult and dodgy and not uniform across versions of windows.

On the second option, I don't know, I don't really want to be constantly shifting data into a MemoryBuffer and using that.

Is there at least a way I can programmatically open up the "Recording Devices" control panel window from NAudio/WASAPI? = P
Feb 4, 2015 at 2:03 PM
yeah there is a way of opening it, you don't need NAudio to do it though.
Process.Start("control.exe", "mmsys.cpl,,1")
A bit ugly, but gets the job done