Selecting a recording device

Apr 22, 2010 at 2:52 AM

I'm trying to figure out how to record audio with NAudio and I'm looking at the sample project NAudioWPF demo. I see where the WaveIn object is created to do the recording, but what if the computer you are working on has multiple soundcards, or multiple driver suchs as ASIO and WDM? Is there some way to specify the hardware and or driver you want to record from?


Eric

Coordinator
Apr 22, 2010 at 2:24 PM

With WaveIn you can specify the DeviceNumber. NAudio doesn't support WDM, and its ASIO support is currently not reliable enough for general use (doesn't work with all soundcards).

Mark

Apr 23, 2010 at 5:54 PM

Ahh I was being stupid. I was using a IWaveIn variable not a WaveIn variable so I wasn't seeing the DeviceNumber property

IWaveIn captureDevice; 
captureDevice = new WaveIn(); 
So now how can I figure out what devices are installed in the current computer and what their number is?

Apr 23, 2010 at 6:01 PM

Ahh wait I think I found it.

 

WaveIn.DeviceCount;
WaveIn.GetCapabilities(i).ProductName;
WaveIn.GetCapabilities(i).Channels;

 

Is that right?

 

Apr 23, 2010 at 6:10 PM

That seems to work. I find that there is one Device on my computer with a product name "SoundMAX HD Audio". However, if I try to retrieve the number of channels using WaveIn.GetCapabilities(i).Channels it returns -1.

 

Coordinator
Apr 28, 2010 at 11:55 AM

hmm, not sure what that means. I guess you'll just have to try to open the device and see if it works

Mark