dictation button problems
Hello
I am getting a weird error, when I press the button again, to stop the recorder. I was following the Microsoft sample code.
This is the error I am getting: The text associated with this error code could not be found
This is the code that I have
and this is happening, when I click the button again.
I also want to keep what I have written
if someone can help me, I would appreciate it
Universal Windows Platform (UWP)
-
Fay Wang - MSFT • 5,221 Reputation points
2019-12-20T03:07:05.613+00:00 Are you following the code from Scenario_ContinuousDictation.xaml.cs in SpeechRecognitionAndSynthesis official sample? If it is, by checking this official sample, before stoping the recorder, it adds the detection of speechRecognizer state. If its state is not equal to Idle, you can use StopAsunc() to stop it. But if its state is equal to Idle which indicates that speech recognition is not active and the speech recognizer is not capturing (listening for) audio input, if you still use StopAsync() to stop it, it will throw the exception. First, you can check if this error is caused by this. Then if you still receive this error, can you provide a simple sample that can be reproduced to test? In addition, I'm confused about this sentence "I also want to keep what I have written", what does it mean?
-
Eduardo Gomez 3,431 Reputation points
2019-12-23T13:17:41.26+00:00 It meant that I want to concatenate what I have, with what I spoke
-
Eduardo Gomez 3,431 Reputation points
2019-12-23T13:20:49.25+00:00 but I dont understand, I am disposing the speechSyntetizer and turning the button of, it shouldn't not do throw that error
-
Fay Wang - MSFT • 5,221 Reputation points
2019-12-24T03:31:07.243+00:00 Did you receive the error when you triggered the ContinuousRecognitionSession_CompletedAsync() method and stopped the speechRecognizer? If it is, as I explained, the speech recognition is not active and the speech recognizer is not capturing audio input, if you still use StopAsync() to stop it, it will throw the exception. If not, can you show more details about which behavior caused this error? And can you provide a simple sample that can be reproduced?
-
Eduardo Gomez 3,431 Reputation points
2019-12-24T03:44:22.607+00:00 Thanks for the reply and merry xmas, I hope you are having a terrific time.
I do not know where is the error, becouse whhe I use breakpoints,
I get "The text associated with this error code could not be found"
here are my methods
I want to turn off the Systetizer, when I press the button, also I want to concatenate what I have spoken with what I have written
-
Fay Wang - MSFT • 5,221 Reputation points
2019-12-24T08:49:45.247+00:00 From your code, you can't put stopAsync() method in the ContinuousRecognitionSession_CompletedAsync() event. When you call the StopAsync, when an error occurs, or when the user has stopped speaking, the session ends and the complete event will be triggered. So if you put stopAsync() in the complete event, it may cause errors. When you remove the method from complete event, will the same issue occur? in addition, you can refer to the code in the official sample to check the difference.
-
Eduardo Gomez 3,431 Reputation points
2019-12-25T21:04:43.36+00:00 Where do you recommend to put it?, for what I was following in the code, they check the status, I don't want that, I want to call the StopAsync(), when the user click the button again and turn off the button, I also want to concatenate what I have written with what I have spoken
-
Fay Wang - MSFT • 5,221 Reputation points
2019-12-26T01:20:51.117+00:00 As you described, you can add a button to stop recording. You can put the stopAsync() method in the button click event instead of putting it in complete event. For specific operations, you can refer to the official sample.
-
Eduardo Gomez 3,431 Reputation points
2019-12-26T02:45:03.26+00:00 I could do that, But I was thinking using the same button. I also tried to use the example, and broke when I modify it
-
Fay Wang - MSFT • 5,221 Reputation points
2019-12-26T03:07:04.157+00:00 OK, if you add the stopAsync() in the same button and trigger it, will the same issue occur? If it still occurs, can you please provide a simple and complete sample that can be reproduced for us to test?
-
Eduardo Gomez 3,431 Reputation points
2019-12-26T03:27:44.49+00:00 I get an error
-
Fay Wang - MSFT • 5,221 Reputation points
2019-12-26T05:47:33.77+00:00 When I tested, it worked well. Did you get this error when you first clicked the button which Tag is equal '0'? In addition, the code in screenshot is different from this code you shared, so can you share the code currently in use for us to test?
-
Eduardo Gomez 3,431 Reputation points
2019-12-26T15:38:39.777+00:00 I am sorry jajaja I will try with that code, but if you clicked of the button again to turn if off, it will throw and error, because I put the StopAsync() in the completed method of the speechSyntentetizer
-
Eduardo Gomez 3,431 Reputation points
2019-12-26T16:10:56.787+00:00 This is all my code
-
Eduardo Gomez 3,431 Reputation points
2019-12-26T16:19:24.193+00:00 When I click again I get this error {"The text associated with this error code could not be found.\r\n\r\nThe text associated with this error code could not be found.\r\n"}
-
Fay Wang - MSFT • 5,221 Reputation points
2019-12-27T05:15:06.08+00:00 Based on your source code, I created a simple sample for you, here is the link. You can download and check it. In addition, if you want to dispose the speechRecognizer, you need to initialize it again before the next start. And I put the stopAsync method into the button event instead of complete event.
-
Fay Wang - MSFT • 5,221 Reputation points
2020-01-02T08:17:34.28+00:00 Hi, can this sample help you? Have you solved your issue?
Sign in to comment