我正在創建一個使用UWP的智能鏡像應用程序,我嘗試將應用程序與持續語音識別進行集成,以便用戶可以使用語音來控制它。但是Bing Speech REST API不支持連續的語音識別,所以我可以使用其他任何功能?如果你有源代碼,那會更好。連續語音識別UWP
1
A
回答
1
我從這段代碼中找到了一些想法,我希望它也能幫助你。
public sealed partial class MainPage : Page
{ public MainPage()
{
this.InitializeComponent();
}
//連続音聲認識のためのオブジェクト
private SpeechRecognizer contSpeechRecognizer;
private CoreDispatcher dispatcher;
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
//ハックグラウンドスレッドからUIスレッドを呼び出すためのDispatcher
dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
//初期化
contSpeechRecognizer =
new Windows.Media.SpeechRecognition.SpeechRecognizer();
await contSpeechRecognizer.CompileConstraintsAsync();
//認識中の処理定義
contSpeechRecognizer.HypothesisGenerated +=
ContSpeechRecognizer_HypothesisGenerated;
contSpeechRecognizer.ContinuousRecognitionSession.ResultGenerated +=
ContinuousRecognitionSession_ResultGenerated;
// 音聲入力ないままタイムアウト(20秒位)した場合の処理
contSpeechRecognizer.ContinuousRecognitionSession.Completed += ContinuousRecognitionSession_Completed;
//認識開始
await contSpeechRecognizer.ContinuousRecognitionSession.StartAsync();
}
private async void ContinuousRecognitionSession_Completed(SpeechContinuousRecognitionSession sender, SpeechContinuousRecognitionCompletedEventArgs args)
{
await dispatcher.RunAsync(CoreDispatcherPriority.Normal,() =>
{
textBlock1.Text = "Timeout.";
});
// 音聲を再度待ち受け
await contSpeechRecognizer.ContinuousRecognitionSession.StartAsync();
}
private async void ContSpeechRecognizer_HypothesisGenerated(
SpeechRecognizer sender, SpeechRecognitionHypothesisGeneratedEventArgs args)
{
//認識途中に畫面表示
await dispatcher.RunAsync(CoreDispatcherPriority.Normal,() =>
{
textBlock1.Text = args.Hypothesis.Text;
});
}
private async void ContinuousRecognitionSession_ResultGenerated(
SpeechContinuousRecognitionSession sender, SpeechContinuousRecognitionResultGeneratedEventArgs args)
{
//認識完了後に畫面に表示
await dispatcher.RunAsync(CoreDispatcherPriority.Normal,() =>
{
textBlock1.Text = "Waiting ...";
output.Text += args.Result.Text + "。\n";
});
}
}
0
Windows.Media.SpeechRecognition
支持連續識別。 UWP的Microsoft Github在其Speech recognition and synthesis sample中有一個例子,或者查看Microsoft Docs的Windows.Media.SpeechRecognition
相關問題
- 1. UWP連續語音識別
- 2. 連續語音識別Android
- 3. 連續語音識別
- 4. 啓用識別連續語音
- 5. 歌唱時連續語音識別?
- 6. 連續語音識別終點檢測
- 7. 語音識別 - 連續運行
- 8. 用於連續語音識別的HTML5語音輸入API
- 9. 使用Webkit語音API進行連續語音識別
- 10. 連續Android語音識別與藍牙連接
- 11. 語音識別/識別
- 12. 語音/語音識別 - PhoneGap
- 13. 語音識別
- 14. 語音識別
- 15. 麥克風的連續語音識別pocketsphinx
- 16. android語音識別連續沒有答案
- 17. 1分鐘後不重新啓動連續語音識別
- 18. 在Android 4.0中訪問連續語音識別
- 19. 安卓系統,連續語音識別和錯誤IO異常
- 20. 語音識別連接錯誤
- 21. Java語音識別
- 22. 語音識別,nodeJS
- 23. PHP語音識別?
- 24. 語音識別vb6
- 25. Android語音識別?
- 26. android語音識別
- 27. 語音識別API
- 28. 語音識別API
- 29. JavaScript語音識別
- 30. C#語音識別