The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
Continues dictation RRS feed

  • Question

  • Hello I am using continues dictation in my app, but I have a problem, even though I put the silence time out to 1 day, it will still timeout after a while.

    What I am trying to do, is that the user press the button and I start speaking, and If I hit the button again it will stop listening. For some reason. I also want the app to type, while I am speaking 

         case "0":
                        dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
                        speechRecognizer = new SpeechRecognizer();
                        await speechRecognizer.CompileConstraintsAsync();
                        speechRecognizer.ContinuousRecognitionSession.ResultGenerated += ContinuousRecognitionSession_ResultGenerated;
                        speechRecognizer.ContinuousRecognitionSession.AutoStopSilenceTimeout = TimeSpan.FromDays(1);
                        speechRecognizer.ContinuousRecognitionSession.Completed += ContinuousRecognitionSession_Completed;
                        await speechRecognizer.ContinuousRecognitionSession.StartAsync();
                        textToSpeech.Background = (SolidColorBrush)Resources[ON];
                        break;
                    case "1":
                        if (richEbitBox.Document.Selection.CharacterFormat.Bold == FormatEffect.On) {
                            richEbitBox.Document.Selection.CharacterFormat.Bold = FormatEffect.Off;
                            FormatBoltText.Background = (SolidColorBrush)Resources[OFF];
                        } else {
                            richEbitBox.Document.Selection.CharacterFormat.Bold = FormatEffect.On;
                            FormatBoltText.Background = (SolidColorBrush)Resources[ON];
                        }
                        break;
                    case "2":
                        if (richEbitBox.Document.Selection.CharacterFormat.Italic == FormatEffect.On) {
                            richEbitBox.Document.Selection.CharacterFormat.Italic = FormatEffect.Off;
                            formatItalicText.Background = (SolidColorBrush)Resources[OFF];
                        } else {
                            richEbitBox.Document.Selection.CharacterFormat.Italic = FormatEffect.On;
                            formatItalicText.Background = (SolidColorBrush)Resources[ON];
                        }
                        break;
                    case "3":
                        if (richEbitBox.Document.Selection.CharacterFormat.Underline == UnderlineType.Single) {
                            richEbitBox.Document.Selection.CharacterFormat.Underline = UnderlineType.None;
                            formatUnderlineText.Background = (SolidColorBrush)Resources[OFF];
                        } else {
                            richEbitBox.Document.Selection.CharacterFormat.Underline = UnderlineType.Single;
                            formatUnderlineText.Background = (SolidColorBrush)Resources[ON];
                        }
                        break;
                    case "4":
                        if (Ink_cnvas.Visibility == Visibility.Collapsed) {
                            formatDraw.Background = (SolidColorBrush)Resources[ON];
                            Ink_cnvas.Visibility = Visibility.Visible;
                            richEbitBox.Visibility = Visibility.Collapsed;
                        } else if (Ink_cnvas.Visibility == Visibility.Visible) {
                            Ink_cnvas.Visibility = Visibility.Collapsed;
                            formatDraw.Background = (SolidColorBrush)Resources[OFF];
                            richEbitBox.Visibility = Visibility.Visible;
                        }
                        break;
                    default:
                        break;
                }
            }
    
            private async void ContinuousRecognitionSession_Completed(SpeechContinuousRecognitionSession sender, SpeechContinuousRecognitionCompletedEventArgs args) {
    
                await speechRecognizer.ContinuousRecognitionSession.StartAsync();
            }
    
            private async void ContinuousRecognitionSession_ResultGenerated(SpeechContinuousRecognitionSession sender, SpeechContinuousRecognitionResultGeneratedEventArgs args) {
    
                await dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => {
    
                        richEbitBox.Document.GetText(TextGetOptions.AdjustCrlf, out string value);
                        richEbitBox.Document.SetText(TextSetOptions.None, value + args.Result.Text);
                        textToSpeech.Background = (SolidColorBrush)Resources[OFF]; // This will indicate that my button is off
                        await speechRecognizer.ContinuousRecognitionSession.StopAsync();    
                });
            }



    • Edited by EG87 Tuesday, November 12, 2019 1:26 PM
    Tuesday, November 12, 2019 1:22 PM

All replies

  • Hi,

    My teammate has commented in your question in Microsoft Q&A, please check that.

    Best regards.

    Roy


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Wednesday, November 13, 2019 8:14 AM
    Moderator