我想從TCP套接字在C#中「流」語音識別。我遇到的問題是SpeechRecognitionEngine.SetInputToAudioStream()似乎需要一個可以查找的定義長度的Stream。現在我能想到的,使這項工作的唯一方法是隨着越來越多的輸入進來的重複運行在一個MemoryStream識別器Streaming輸入到System.Speech.Recognition.SpeechRecognitionEngine
下面是一些代碼來說明:
SpeechRecognitionEngine appRecognizer = new SpeechRecognitionEngine();
System.Speech.AudioFormat.SpeechAudioFormatInfo formatInfo = new System.Speech.AudioFormat.SpeechAudioFormatInfo(8000, System.Speech.AudioFormat.AudioBitsPerSample.Sixteen, System.Speech.AudioFormat.AudioChannel.Mono);
NetworkStream stream = new NetworkStream(socket,true);
appRecognizer.SetInputToAudioStream(stream, formatInfo);
// At the line above a "NotSupportedException" complaining that "This stream does not support seek operations."
有誰知道怎麼弄在這附近?它必須支持某種類型的流輸入,因爲它可以使用SetInputToDefaultAudioDevice()與麥克風正常工作。
謝謝,肖恩
也許'SetInputToDefaultAudioDevice()'是微軟 「黑魔法」(通用),或像你建議對其進行某種配料。 – 2009-11-05 19:21:13