Tôi đang cố gắng thực hiện nhận dạng giọng nói "streaming" trong C# từ một ổ cắm TCP. Vấn đề tôi gặp phải là SpeechRecognitionEngine.SetInputToAudioStream() dường như yêu cầu một Stream có độ dài xác định có thể tìm kiếm. Ngay bây giờ cách duy nhất tôi có thể nghĩ đến để làm việc này là để liên tục chạy trình nhận dạng trên một MemoryStream làm đầu vào hơn do thỏa thuận hợpĐầu vào trực tiếp vào System.Speech.Recognition.SpeechRecognitionEngine
Dưới đây là một số mã để minh họa:.
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."
Có ai biết làm thế nào để có được xung quanh điều này? Nó phải hỗ trợ đầu vào trực tuyến của một số loại, vì nó hoạt động tốt với micro bằng cách sử dụng SetInputToDefaultAudioDevice().
Cảm ơn, Sean
lẽ 'SetInputToDefaultAudioDevice() 'là Microsoft "ma thuật đen"(phổ biến), hoặc nó thực hiện một số loại trạm trộn như bạn đề nghị. –