NAudio WaveMixerStream32混合多个.wav文件

时间:2013-11-04 16:41:10

标签: naudio

我尝试将两个.wav文件合并为一个,但无法弄清楚为什么混合的.wav文件时间是任何混合.wav文件的两倍。有人可以解释一下,我做错了什么?

WaveMixerStream32 mixer = new WaveMixerStream32();
WaveFileReader[] reader = new WaveFileReader[micDevices.Count];
WaveChannel32[] stream = new WaveChannel32[micDevices.Count];
mixer.AutoStop = true;
bool doMixing = false;
for (int i = 0; i < micDevices.Count; i++)
{
   bool mixChannel = micDevices[i].enabled == true;
   micDevices[i].stopRecording();
   if (mixChannel == false)
        continue;
   reader[i] = new WaveFileReader(micDevices[i].tmpWavFileName);
   stream[i] = new WaveChannel32(reader[i]);
   mixer.AddInputStream(stream[i]);
   doMixing = true;
}
if (doMixing)
{
   mixer.Position = 0;
   Wave32To16Stream wavmixer = new Wave32To16Stream(mixer);
   WaveFileWriter.CreateWaveFile(tmpwavFileName, wavmixer);
   wavmixer.Dispose();
   mixer.Dispose();
}

所有.wav文件都具有相同的比特率,通道数。

0 个答案:

没有答案