SpeechClientRecognizeAsync Method |
Streams audio asynchronously to the speech service for recognition.
Namespace:
Microsoft.Bing.Speech
Assembly:
Microsoft.Bing.Speech (in Microsoft.Bing.Speech.dll) Version: 2.0.1.0 (2.0.1)
Syntax public Task RecognizeAsync(
SpeechInput speechInput,
CancellationToken token
)
Public Function RecognizeAsync (
speechInput As SpeechInput,
token As CancellationToken
) As Task
public:
virtual Task^ RecognizeAsync(
SpeechInput^ speechInput,
CancellationToken token
) sealed
abstract RecognizeAsync :
speechInput : SpeechInput *
token : CancellationToken -> Task
override RecognizeAsync :
speechInput : SpeechInput *
token : CancellationToken -> Task
Parameters
- speechInput
- Type: Microsoft.Bing.SpeechSpeechInput
The speech service input parameters. - token
- Type: System.ThreadingCancellationToken
The cancellation token used to cancel your request at any time, or to set a request time out.
Return Value
Type:
Task
A task that completes once the request completes. In ShortPhrase mode, the task completes after getting the
RecognitionResult.
In LongDictation mode, the task completes after the final
RecognitionResult.
Implements
ISpeechClientRecognizeAsync(SpeechInput, CancellationToken)Exceptions Remarks
The API utilizes a single websocket connection per request. For optimal user experience, the API will attempt to reconnect to the speech service and start the recognition from the last
RecognitionResult.
For example, consider a two minutes long audio, after successfully streaming for a minute, and some network interruption occurs,
the API will resend any audio it did not receive a successful
RecognitionResult for.
Note: the API keeps internal buffer for such cases.
Examples var task = speechClient.RecognizeAsync(speechInput, cancellationToken);
See Also