TCP ソケットから C# で「ストリーミング」音声認識を実行しようとしています。私が抱えている問題は、 SpeechRecognitionEngine.SetInputToAudioStream() がシークできる定義された長さのストリームを必要とするように見えることです。今のところ、これを機能させるために考えられる唯一の方法は、より多くの入力が入るたびに MemoryStream で認識エンジンを繰り返し実行することです。
説明するコードを次に示します。
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() を使用してマイクで正常に動作するため、何らかのストリーミング入力をサポートする必要があります。
ありがとう、ショーン