我試圖設計一個使用C#語言的文本編輯器,併爲普通文件特徵實現語音識別,這是否可以實現。 如果我重複之前詢問過的問題,我非常抱歉。 我只想知道是否有方法將語音轉換爲使用C#的文本。 你的幫助真的很有價值。 等待回覆。 在此先感謝。使用C語言對文本進行語音識別
回答
如果我記得正確Microsoft Speech SDK支持語音文本。
還有iSpeech API,它可以用於語音識別作爲網絡服務。
下面是使用C#和System.Speech用於從語音轉換成文本
的代碼可以被劃分爲兩個主要部分的完整例如:
配置SpeechRecognitionEngine對象(及其所需的元件) 處理SpeechRecognized和SpeechHypothesized事件。
步驟1:配置SpeechRecognitionEngine
_speechRecognitionEngine = new SpeechRecognitionEngine();
_speechRecognitionEngine.SetInputToDefaultAudioDevice();
_dictationGrammar = new DictationGrammar();
_speechRecognitionEngine.LoadGrammar(_dictationGrammar);
_speechRecognitionEngine.RecognizeAsync(RecognizeMode.Multiple);
在這一點上你的對象是準備開始從麥克風錄製音頻。您需要處理一些事件,以便實際訪問結果。
步驟2:處理所述SpeechRecognitionEngine活動
_speechRecognitionEngine.SpeechRecognized - =新的EventHandler(SpeechRecognized); _speechRecognitionEngine.SpeechHypothesized - = new EventHandler(SpeechHypothesizing);
_speechRecognitionEngine.SpeechRecognized + = new EventHandler(SpeechRecognized); _speechRecognitionEngine.SpeechHypothesized + = new EventHandler(SpeechHypothesizing);從發動機 串realTimeResults = e.Result.Text
私人無效SpeechHypothesizing(對象發件人, SpeechHypothesizedEventArgs E){ ///實時結果; }
私人無效SpeechRecognized(對象發件人,SpeechRecognizedEventArgs e)從發動機串finalAnswer = e.Result.Text { ///最終答案; }
就是這樣。如果您想使用預先錄製的.wav文件而不是麥克風,您可以使用
_speechRecognitionEngine。SetInputToWaveFile(pathToTargetWavFile);
代替
_speechRecognitionEngine.SetInputToDefaultAudioDevice();
在這些類中有一堆不同的選項,它們值得探索更多細節。
- 1. Android語音識別 - 使用語言
- 2. C語言中的Windows語音識別#
- 3. 改進語音識別C#
- 4. 語音識別和文本到語音
- 5. 使用MediaRecorder進行語音識別 - Android
- 6. 使用RecyclerView進行Android語音識別
- 7. 使用python進行語音識別
- 8. 使用C#語音識別庫進行語音用戶界面或語音識別
- 9. 語音識別的可用語言
- 10. C#語音識別錯誤 - 語法語言與語音識別器的語言不匹配
- 11. C#語音識別 - 識別語音和執行任務
- 12. C語言識別#
- 13. 語音識別進行文件搜索
- 14. 語音到文本識別
- 15. C#語音識別
- 16. C#語音識別
- 17. 文本到語音(語音生成)和語音到文本(語音識別)API?
- 18. 語音識別中的新語言
- 19. 其他語言的語音識別
- 20. 語音識別語言模型
- 21. 語言學習語音識別工具
- 22. 多種語言的Vista語音識別
- 23. 在使用文本到語音之前停止語音識別
- 24. 語音/語音識別 - PhoneGap
- 25. 開源在Windows中使用C++進行簡單語音識別
- 26. 語音到文字/語音識別
- 27. 語言識別
- 28. 語音識別 - 語音到文本 - 用於BlackBerry OS 7
- 29. c中的語音識別#
- 30. Windows語音識別C#
歡迎SharpSphinx A C#版本堆棧溢出。截至目前它並不那麼準確。請閱讀[無論發生什麼語音識別?](http://www.codinghorror.com/blog/2010/06/whatever-happened-to-voice-recognition.html) – naveen