开发者

Reducing channel count when recording in NAudio

开发者 https://www.devze.com 2023-03-31 14:54 出处:网络
I\'m recording in NAudio with a PS3Eye camera, using CLEye drivers. The camera has a 4 microphone array, a开发者_运维知识库nd presents 4 channels of audio to the system.

I'm recording in NAudio with a PS3Eye camera, using CLEye drivers. The camera has a 4 microphone array, a开发者_运维知识库nd presents 4 channels of audio to the system.

By default, all of the channels are being recorded by NAudio. I'm recording to PCM wave, and getting a 4-channel WAV output file.

When I try to play the file in NAudio, I receive an MmException 'NoDriver' calling acmFormatSuggest. Stereo files play fine.

My sound card can only output 2 channels, which appears to cause the error. Setting my Windows audio settings to Quadraphonic does not resolve this issue.

Perhaps I can ask NAudio to record only 2 channels, or implement my own WaveStream somewhere?

Does anybody have any ideas for down-sampling the number of channels in NAudio? (preferably at record time). Big thanks!


isn't it as simple as declaring it in your WaveFormat? 12000 is the sample rate and "1" is the number of channels.

 waveInStream = new WaveIn(WaveCallbackInfo.FunctionCallback());
 waveInStream.WaveFormat = new WaveFormat(12000, 1);
 waveInStream.DeviceNumber = 2;

 AudioWriter = new WaveFileWriter("c:\\MyAudio.wav", waveInStream.WaveFormat);
 waveInStream.DataAvailable += waveInStream_DataAvailable;
 waveInStream.StartRecording();

thats how i setup my code for a basic webcam recorder and with stereo mics it outputs mono wav files.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号