0

私はこのコード は、このコードは行うが、一度だけ、(UWP C#の)

SpeechRecognitionResult speechRecognitionResult = await speechRecognizer.RecognizeAsync(); 
textBox1.Text = speechRecognitionResult.Text; 

しかし、それは出力のみの1時間を提供を使用してみました、テキストボックスに音声入力をしたいが、私は私が閉じるまで、出力の連続取得したいですそれは自分。 どうすればいいのか教えてください。

私はこの方法を試みましたが、何も提供しませんでした。

await speechRecognizer.CompileConstraintsAsync(); 
speechRecognizer.ContinuousRecognitionSession.ResultGenerated += async (s, e1) => 
{ 
    if ((e1.Result != null)) 
    { 
     await this.Dispatcher.RunAsync(CoreDispatcherPriority.Low,() => 
     { 
      var result = e1.Result.Text; 
      textBox1.Text = result; 
     }); 
     speechRecognizer.ContinuousRecognitionSession.Resume(); 
    } 
}; 
await speechRecognizer.ContinuousRecognitionSession.StartAsync(SpeechContinuousRecognitionMode.PauseOnRecognition); 

ご協力ありがとうございます。返信する必要があります。 :)

+0

フォーマットが間違っています。修正してください。 – IInspectable

答えて

2

連続音声認識結果を得るには、Continuous dictationを参照してください。このドキュメントでは、ロングフォームの継続的な口述音声入力を取得して認識する方法について説明します。このドキュメントの手順に従って、独自に実装することができます。また、GitHubには公式のSpeech recognition and synthesis sampleがあります。

認識を開始するには、StartAsync() メソッドを呼び出すだけで済みます。認識結果が生成された後、音声認識が引き続き音声入力を受信して​​処理する必要があります。そして、speechRecognizer.ContinuousRecognitionSession.Resume();ResultGeneratedイベントハンドラに使用する必要はありません。コードから安全に削除できます。

関連する問題