我可以使用以下代码录制麦克风的音频:
private void buttonBeginToSpeak_Click(object sender, EventArgs e)
{
WaveIn wi;
WaveOut wo;
private BufferedWaveProvider bwp;
wo = new WaveOut();
wi = new WaveIn();
wi.DataAvailable += new EventHandler<WaveInEventArgs>(wi_DataAvailable);
bwp = new BufferedWaveProvider(wi.WaveFormat);
bwp.DiscardOnBufferOverflow = true;
wo.Init(bwp);
wi.StartRecording();
}
private void buttonFinishSpeaking_Click(object sender, EventArgs e)
{
wi.StopRecording();
wo.Play(); // this sentence plays the audio previously recorded
}
void wi_DataAvailable(object sender, WaveInEventArgs e)
{
bwp.AddSamples(e.Buffer, 0, e.BytesRecorded);
}
如何将此音频(不是直接通过文件)发送到Bing语音识别服务