我试图将两个 .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 文件都有相同的比特率,频道数。