Universal Windows Platform (UWP)
A Microsoft platform for building and publishing apps for Windows desktop devices.
3,019 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi
I have a click button event in which i use speech synthesizer to generate a speech.
When the narrator achieved speaking i would like to start a dispatchertimer.
How can i know when the speak is completed ?
Thanks
Hello,
Welcome to Microsoft Q&A.
We can judge whether it has completed the recognition by the state change of SpeechRecognizer
private SpeechRecognizer speechRecognizer;
public MainPage()
{
this.InitializeComponent();
this.speechRecognizer = new SpeechRecognizer();
speechRecognizer.StateChanged += SpeechRecognizer_StateChanged;
}
private void SpeechRecognizer_StateChanged(SpeechRecognizer sender, SpeechRecognizerStateChangedEventArgs args)
{
if(args.State== SpeechRecognizerState.SoundEnded)
{
// The subsequent input of audio is not detected,
// which can be understood as the speaker has finished speaking,
// but SpeechRecognizer has not stopped audio monitoring
}
else if(args.State==SpeechRecognizerState.Idle)
{
// SpeechRecognizer stops listening
}
else if (args.State == SpeechRecognizerState.Paused)
{
// (Used for continuous recognition state) SpeechRecognizer pause is recognition
}
}
You can modify the above code according to your needs, and start DispatcherTimer in the state you need.
Thanks.