我正在尝试同时在两个不同的设备上录制音频,并且文件的输出应保存在波形文件中
使用 NAudio 我尝试解决问题,如下所示,但我仍然没有得到它
WaveInEvent waveSource1 = new WaveInEvent();
waveSource1.DeviceNumber = DeviceID1;
waveSource1.WaveFormat = new WaveFormat(44100, 2);
waveSource1.DataAvailable += new EventHandler<WaveInEventArgs>(waveSource_DataAvailable);
string tempFile1 = (@"C:\Users\Nirmalkumar\Desktop\speech1.wav");
waveFile1 = new WaveFileWriter(tempFile1, waveSource1.WaveFormat);
waveSource.StartRecording();
waveSource1.StartRecording();
Console.Beep();
int milliseconds = 5000;
Thread.Sleep(milliseconds);
waveSource.StopRecording();
waveSource1.StopRecording();
这是第一个波源
WaveInEvent waveSource = new WaveInEvent();
waveSource.DeviceNumber = DeviceID;
waveSource.WaveFormat = new WaveFormat(44100, 16, 2);
waveSource.DataAvailable += new EventHandler<WaveInEventArgs>(waveSource_DataAvailable);
string tempFile = (@"C:\Users\Nirmalkumar\Desktop\speech.wav");
waveFile = new WaveFileWriter(tempFile, waveSource.WaveFormat);
static void waveSource_DataAvailable(object sender, WaveInEventArgs e)
{
waveFile.Write(e.Buffer, 0, e.BytesRecorded);
}
吃鸡游戏
相关分类