You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -72,7 +72,7 @@ The [Recognizer class](/cpp/cognitive-services/speech/speechrecognizer) for the
72
72
Single-shot recognition asynchronously recognizes a single utterance. The end of a single utterance is determined by listening for silence at the end or until a maximum of 15 seconds of audio is processed. Here's an example of asynchronous single-shot recognition via [`RecognizeOnceAsync`](/cpp/cognitive-services/speech/speechrecognizer#recognizeonceasync):
73
73
74
74
```cpp
75
-
auto result = recognizer->RecognizeOnceAsync().get();
75
+
auto result = speechRecognizer->RecognizeOnceAsync().get();
76
76
```
77
77
78
78
You need to write some code to handle the result. This sample evaluates [`result->Reason`](/cpp/cognitive-services/speech/recognitionresult#reason) and:
@@ -114,8 +114,8 @@ Continuous recognition is a bit more involved than single-shot recognition. It r
114
114
Start by defining the input and initializing [`SpeechRecognizer`](/cpp/cognitive-services/speech/speechrecognizer):
Next, create a variable to manage the state of speech recognition. Declare `promise<void>` because at the start of recognition, you can safely assume that it's not finished:
@@ -132,12 +132,12 @@ Next, subscribe to the events that [`SpeechRecognizer`](/cpp/cognitive-services/
132
132
*[`Canceled`](/cpp/cognitive-services/speech/asyncrecognizer#canceled): Signal for events that contain canceled recognition results. These results indicate a recognition attempt that was canceled as a result or a direct cancellation request. Alternatively, they indicate a transport or protocol failure.
A common task for speech recognition is specifying the input (or source) language. The following example shows how you would change the input language to German. In your code, find your [`SpeechConfig`](/cpp/cognitive-services/speech/speechconfig) instance and add this line directly below it:
[`SetSpeechRecognitionLanguage`](/cpp/cognitive-services/speech/speechconfig#setspeechrecognitionlanguage) is a parameter that takes a string as an argument. Refer to the [list of supported speech-to-text locales](../../../language-support.md?tabs=stt).
195
195
196
+
## Language identification
197
+
198
+
You can use [language identification](../../../language-identification.md?pivots=programming-language-cpp#speech-to-text) with Speech-to-text recognition when you need to identify the language in an audio source and then transcribe it to text.
199
+
200
+
For a complete code sample, see [language identification](../../../language-identification.md?pivots=programming-language-cpp#speech-to-text).
201
+
196
202
## Use a custom endpoint
197
203
198
204
With [Custom Speech](../../../custom-speech-overview.md), you can upload your own data, test and train a custom model, compare accuracy between models, and deploy a model to a custom endpoint. The following example shows how to set a custom endpoint.
The previous examples use single-shot recognition, which recognizes a single utterance. The end of a single utterance is determined by listening for silence at the end or until a maximum of 15 seconds of audio is processed.
187
187
188
-
In contrast, you use continuous recognition when you want to control when to stop recognizing. It requires you to subscribe to the `Recognizing`, `Recognized`, and `Canceled` events to get the recognition results. To stop recognition, you must call [`StopContinuousRecognitionAsync`](/dotnet/api/microsoft.cognitiveservices.speech.speechrecognizer.stopcontinuousrecognitionasync). Here's an example of how continuous recognition is performed on an audio input file.
188
+
In contrast, you use continuous recognition when you want to control when to stop recognizing. It requires you to subscribe to the `Recognizing`, `Recognized`, and `Canceled` events to get the recognition results. To stop recognition, you must call [`StopContinuousRecognitionAsync`](/dotnet/api/microsoft.cognitiveservices.speech.speechspeechRecognizer.stopcontinuousrecognitionasync). Here's an example of how continuous recognition is performed on an audio input file.
189
189
190
190
Start by defining the input and initializing [`SpeechRecognizer`](/dotnet/api/microsoft.cognitiveservices.speech.speechrecognizer):
Then create a `TaskCompletionSource<int>` instance to manage the state of speech recognition:
@@ -202,18 +202,18 @@ var stopRecognition = new TaskCompletionSource<int>();
202
202
203
203
Next, subscribe to the events that `SpeechRecognizer` sends:
204
204
205
-
*[`Recognizing`](/dotnet/api/microsoft.cognitiveservices.speech.speechrecognizer.recognizing): Signal for events that contain intermediate recognition results.
206
-
*[`Recognized`](/dotnet/api/microsoft.cognitiveservices.speech.speechrecognizer.recognized): Signal for events that contain final recognition results, which indicate a successful recognition attempt.
207
-
*[`SessionStopped`](/dotnet/api/microsoft.cognitiveservices.speech.recognizer.sessionstopped): Signal for events that indicate the end of a recognition session (operation).
208
-
*[`Canceled`](/dotnet/api/microsoft.cognitiveservices.speech.speechrecognizer.canceled): Signal for events that contain canceled recognition results. These results indicate a recognition attempt that was canceled as a result or a direct cancellation request. Alternatively, they indicate a transport or protocol failure.
205
+
*[`Recognizing`](/dotnet/api/microsoft.cognitiveservices.speech.speechspeechRecognizer.recognizing): Signal for events that contain intermediate recognition results.
206
+
*[`Recognized`](/dotnet/api/microsoft.cognitiveservices.speech.speechspeechRecognizer.recognized): Signal for events that contain final recognition results, which indicate a successful recognition attempt.
207
+
*[`SessionStopped`](/dotnet/api/microsoft.cognitiveservices.speech.speechRecognizer.sessionstopped): Signal for events that indicate the end of a recognition session (operation).
208
+
*[`Canceled`](/dotnet/api/microsoft.cognitiveservices.speech.speechspeechRecognizer.canceled): Signal for events that contain canceled recognition results. These results indicate a recognition attempt that was canceled as a result or a direct cancellation request. Alternatively, they indicate a transport or protocol failure.
The [`SpeechRecognitionLanguage`](/dotnet/api/microsoft.cognitiveservices.speech.speechconfig.speechrecognitionlanguage) property expects a language-locale format string. Refer to the [list of supported speech-to-text locales](../../../language-support.md?tabs=stt).
270
270
271
+
## Language identification
272
+
273
+
You can use [language identification](../../../language-identification.md?pivots=programming-language-csharp#speech-to-text) with Speech-to-text recognition when you need to identify the language in an audio source and then transcribe it to text.
274
+
275
+
For a complete code sample, see [language identification](../../../language-identification.md?pivots=programming-language-csharp#speech-to-text).
0 commit comments