问题
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?
回答1:
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);
来源:https://stackoverflow.com/questions/22126148/invalidparameter-calling-waveoutopen-mmexception