This code works on 32bit Windows XP but on 64bit Windows 7 it raises an exception. (on any CPU configuration)

var format = NAudio.Wave.WaveFormat.CreateCustomFormat(
    WaveFormatEncoding.Pcm, 8000, 1, 16000, 1, 16)
BufferedWaveProvider myBufferedWaveProvider = new BufferedWaveProvider(format);
myWaveOut.Init(myBufferedWaveProvider);

Any help?

有帮助吗?

解决方案

You've created an invalid WaveFormat. PCM 8kHz mono 16 bit (which is what you seem to be trying to make) has a block align of 2. There's an easier way to make this WaveFormat in NAudio:

new WaveFormat(8000, 1);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top