Exemple #1
0
 /// <summary>
 ///     Called when an error is received;
 /// </summary>
 void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
 {
     Console.WriteLine("********* Error Detected *********");
     Console.WriteLine("{0}", e.SpeechErrorCode);
     Console.WriteLine("{0}", e.SpeechErrorText);
     Console.WriteLine();
 }
        /// <summary>
        /// Called when an error is received.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An object that contains the event data.</param>
        private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
        {
            // Not an exhaustive list of possible errors, and while we may be able to handle some
            // error conditions and continue, we should at least throw if login fails since this
            // is a common fatal error (the subscription key is invalid).
            if (e.SpeechErrorCode == SpeechClientStatus.HttpForbidden)
            {
                // Create an exception to represent this error
                this.conversationError = new InvalidOperationException(
                    nameof(BingSpeechRecognizer) +
                    ": Login failed. Please check that the subscription key that you supplied in the " +
                    nameof(BingSpeechRecognizerConfiguration) +
                    " object is valid and that your subscription is active. For details on obtaining " +
                    "a subscription to the Bing Speech API service, please see " +
                    "https://docs.microsoft.com/en-us/azure/cognitive-services/cognitive-services-apis-create-account");

                // Set a flag to indicate that this is a fatal error and the component should stop processing until the pipeline terminates
                this.fatalError = true;
            }

            // Do not post further errors if a fatal error condition exists - the pipeline may be shutting down
            if (!this.fatalError)
            {
                this.speechErrorEvent.Post(e, this.lastAudioOriginatingTime);
            }
        }
        // ----------------------------------------------------------------------------------------------------------------------------------------

        void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
        {
            Console.WriteLine("--- Error received by OnConversationErrorHandler() ---");
            Console.WriteLine("Error code: {0}", e.SpeechErrorCode.ToString());
            Console.WriteLine("Error text: {0}", e.SpeechErrorText);
            Console.WriteLine();
        }
Exemple #4
0
 /// <summary>
 /// Called when an error is received.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="SpeechErrorEventArgs"/> instance containing the event data.</param>
 private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
 {
     Dispatcher.Invoke(() =>
     {
         //TODO
         // _startButton.IsEnabled = true;
         // _radioGroup.IsEnabled = true;
     });
 }
Exemple #5
0
        //writes the error from Speech API if any to the onscreen display
        private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
        {
            TransitionHangUpGui();

            this.WriteLine("--- Error received by OnConversationErrorHandler() ---");
            this.WriteLine("Error code: {0}", e.SpeechErrorCode.ToString());
            this.WriteLine("Error text: {0}", e.SpeechErrorText);
            this.WriteLine();
        }
Exemple #6
0
        /// <summary>
        /// Called when an error is received.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="SpeechErrorEventArgs"/> instance containing the event data.</param>
        private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
        {
            Dispatcher.Invoke(() =>
            {
            });

            this.WriteLine("--- Error received by OnConversationErrorHandler() ---");
            this.WriteLine("Error code: {0}", e.SpeechErrorCode.ToString());
            this.WriteLine("Error text: {0}", e.SpeechErrorText);
        }
Exemple #7
0
        /// Called when an error is received.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="SpeechErrorEventArgs"/> instance containing the event data.</param>
        private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
        {
            this.WriteLine("--- Error received by OnConversationErrorHandler() ---");
            this.WriteLine("Error code: {0}", e.SpeechErrorCode.ToString());
            this.WriteLine("Error text: {0}", e.SpeechErrorText);

            this.micClient.StartMicAndRecognition();

            // this.WriteLine();
        }
 private void MicClient_OnConversationError(object sender, SpeechErrorEventArgs e)
 {
     Dispatcher.Invoke((Action)(() =>
     {
         textBox.Clear();
         this.textBox1.AppendText(("An error Occured" + "\n")); this.textBox1.ScrollToEnd();
         this.textBox1.AppendText("Error data:" + e.SpeechErrorText + "\n");
         this.StartCommandWaiting.Invoke(this, new EventArgs());
     }));
 }
        /// <summary>
        /// Called when an error is received.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="SpeechErrorEventArgs"/> instance containing the event data.</param>
        private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
        {
            Dispatcher.Invoke(() =>
            {
                _startButton.IsEnabled = true;
            });

            this._errorText.Text += "Error code: " + e.SpeechErrorCode.ToString() + "\n";
            this._errorText.Text += "Error text: " + e.SpeechErrorText + "\n";
        }
        private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
        {
            ClearTextBox(txtFinal);

            WriteTextBoxLine(txtFinal, String.Format("ERROR CODE: {0}", e.SpeechErrorCode.ToString()));
            WriteTextBoxLine(txtFinal, String.Format("ERROR TEXT: {0}", e.SpeechErrorText));
            WriteTextBoxLine(txtFinal, String.Empty);

            InitMicClient(true);
        }
Exemple #11
0
        private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
        {
            this.BeginInvoke((MethodInvoker) delegate() {
                btnSpeech.Enabled = true;
            });

            this.WriteLine("--- Error received by OnConversationErrorHandler() ---");
            this.WriteLine("Error code: {0}", e.SpeechErrorCode.ToString());
            this.WriteLine("Error text: {0}", e.SpeechErrorText);
            this.WriteLine();
        }
Exemple #12
0
 private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
 {
     if (OnErrorHandler != null)
     {
         OnErrorHandler(new ErrorEvent()
         {
             ErrorMessage   = $"{e.SpeechErrorCode} : {e.SpeechErrorText}",
             InnerException = null
         });
     }
 }
Exemple #13
0
        /// <summary>
        /// Event handler function for conversation errors.
        /// Will raise the status event with the error message
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnConversationErrorReceived(object sender, SpeechErrorEventArgs e)
        {
            if (_isMicRecording)
            {
                StopMicRecording();
            }

            string message             = $"Speech to text failed with status code: {e.SpeechErrorCode.ToString()}, and error message: {e.SpeechErrorText}";
            SpeechToTextEventArgs args = new SpeechToTextEventArgs(SttStatus.Error, message);

            RaiseSttStatusUpdated(args);
        }
Exemple #14
0
        /// <summary>
        ///     Called when an error is received.
        /// </summary>
        void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
        {
            Dispatcher.Invoke(() =>
            {
                _startButton.IsEnabled = true;
            });

            WriteLine("--- Error received by OnConversationErrorHandler() ---");
            WriteLine("Error code: {0}", e.SpeechErrorCode.ToString());
            WriteLine("Error text: {0}", e.SpeechErrorText);
            WriteLine();
        }
Exemple #15
0
        /// <summary>
        /// 输出信息告诉用户:出错了。
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="SpeechErrorEventArgs"/>该类型的实例包含服务端发生的错误信息。</param>
        private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
        {
            Dispatcher.Invoke(() =>
            {
                this.ShortPhraseStartButton.IsEnabled   = true;
                this.LongDictationStartButton.IsEnabled = true;
            });

            this.WriteLine("--- Error received by OnConversationErrorHandler() ---");
            this.WriteLine("Error code: {0}", e.SpeechErrorCode.ToString());
            this.WriteLine("Error text: {0}", e.SpeechErrorText);
            this.WriteLine();
        }
        /// <summary>
        /// 在收到错误时调用。
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="SpeechErrorEventArgs"/> instance containing the event data.</param>
        private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
        {
            Dispatcher.Invoke(() =>
            {
                _startButton.IsEnabled = true;
                _radioGroup.IsEnabled  = true;
            });

            this.WriteLine("--- 出现错误 ---");
            this.WriteLine("错误代码: {0}", e.SpeechErrorCode.ToString());
            this.WriteLine("错误文本: {0}", e.SpeechErrorText);
            this.WriteLine();
        }
Exemple #17
0
        private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
        {
            Dispatcher.Invoke(() =>
            {
                //_startButton.IsEnabled = true;
                //_radioGroup.IsEnabled = true;
            });

            MessageBox.Show("Error received by OnConversationErrorHandler(): " + e.SpeechErrorText, "Error", MessageBoxButton.OK);

            this.WriteLine("--- Error received by OnConversationErrorHandler() ---");
            this.WriteLine("Error code: {0}", e.SpeechErrorCode.ToString());
            this.WriteLine("Error text: {0}", e.SpeechErrorText);
            this.WriteLine();
        }
        private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
        {
            switch (e.SpeechErrorCode)
            {
            case SpeechClientStatus.Timeout:
            case SpeechClientStatus.ConnectionFailed:
            case SpeechClientStatus.NameNotFound:
                MainListener.Instance.SubListenereInternetError();
                break;

            default:
                MainListener.Instance.SubListenereError();
                break;
            }
        }
        /// <summary>
        /// Called when an error is received.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An object that contains the event data.</param>
        private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
        {
            switch (e.SpeechErrorCode)
            {
            // Authentication failure
            case SpeechClientStatus.HttpForbidden:
            case SpeechClientStatus.HttpUnauthorized:
                // Create an exception to represent this error
                this.conversationError = new InvalidOperationException(
                    nameof(BingSpeechRecognizer) +
                    ": Login failed. Please check that the subscription key that you supplied in the " +
                    nameof(BingSpeechRecognizerConfiguration) +
                    " object is valid and that your subscription is active. For details on obtaining " +
                    "a subscription to the Bing Speech API service, please see " +
                    "https://docs.microsoft.com/en-us/azure/cognitive-services/cognitive-services-apis-create-account");

                // Set a flag to indicate that this is a fatal error and the component should stop processing until the pipeline terminates
                this.fatalError = true;
                break;

            // Incorrect message format error - usually as a result of sending up an unsupported audio format
            case SpeechClientStatus.WebSocketInvalidPayloadData:
                // Audio/message format error
                this.conversationError = new InvalidOperationException(
                    e.SpeechErrorText +
                    " The speech service rejected the last message that was sent to it. This could be due " +
                    "to an incorrect audio format header, or some other audio encoding or message formatting " +
                    "error. Please check to ensure that the audio being sent is encoded as one-channel 16-bit " +
                    "PCM sampled at 16 kHz.");

                // Set a flag to indicate that this is a fatal error and the component should stop processing until the pipeline terminates
                this.fatalError = true;
                break;

            default:
                // Other (possibly transient) error
                this.conversationError = new Exception(e.SpeechErrorText);
                break;
            }

            // Do not post further errors if a fatal error condition exists - the pipeline may be shutting down
            if (!this.fatalError)
            {
                this.PostWithOriginatingTimeConsistencyCheck(this.SpeechErrorEvent, e, this.lastAudioOriginatingTime);
            }
        }
 private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
 {
     WriteLine($"ERROR: {e.SpeechErrorText}");
 }
Exemple #21
0
 void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
 {
     Console.WriteLine(e.SpeechErrorCode.ToString());
     Console.WriteLine(e.SpeechErrorText);
 }
Exemple #22
0
 private void OnConversationError(object sender, SpeechErrorEventArgs e)
 => this.Log($"ERROR: {e.SpeechErrorCode} - {e.SpeechErrorText}");
Exemple #23
0
 /// <summary>
 /// Called when an error is received.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="SpeechErrorEventArgs"/> instance containing the event data.</param>
 private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
 {
     Query = $"Error code: [{e.SpeechErrorCode}] " + e.SpeechErrorText;
 }
 void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
 {
     Console.WriteLine(e.SpeechErrorCode.ToString());
     Console.WriteLine(e.SpeechErrorText);
 }
Exemple #25
0
 private static void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
 {
     log.Debug(string.Format("    --> OnConversationErrorHandler:[{0}]", e.SpeechErrorText));
 }
Exemple #26
0
 private void OnConversationError(object sender, SpeechErrorEventArgs e)
 {
     WriteToLog($"SpeechErrorCode: {e.SpeechErrorCode}. SpeechErrorText: {e.SpeechErrorText}");
 }
Exemple #27
0
 private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
 {
     WriteLine("Error: {0}", e.SpeechErrorText);
     WriteLine("");
 }
Exemple #28
0
 private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
 {
     WriteLine(string.Format("Error from speech server. {0}:{1}", e.SpeechErrorCode, e.SpeechErrorText));
     this.SendMessage(WebSocketMessageType.Error);
 }
 /// <summary>
 ///     Called when an error is received; 
 /// </summary>
 void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
 {
     Console.WriteLine("********* Error Detected *********");
     Console.WriteLine("{0}", e.SpeechErrorCode);
     Console.WriteLine("{0}", e.SpeechErrorText);
     Console.WriteLine();
 }
Exemple #30
0
 private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
 {
     RecognizeText.Add(e.SpeechErrorText);
     RecognizeText.Add(e.SpeechErrorCode.ToString());
     Error = true;
 }
Exemple #31
0
 private static void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
 {
     Console.WriteLine($"Exception: {e}");
 }
Exemple #32
0
 private void OnConversationErrorHandler(object sender, SpeechErrorEventArgs e)
 {
     this.SetText(metaText, "--- OnConversationErrorHandler ---");
 }
 private void OnConversationError(object sender, SpeechErrorEventArgs e)
 {
     Debug.WriteLine(e.SpeechErrorText);
     this._failedCallback.Invoke(e.SpeechErrorText);
 }