SpeechRecognizer.RecognizeAsync method

Begins a speech recognition session for a SpeechRecognizer object.

Syntax

public IAsyncOperation<SpeechRecognitionResult> RecognizeAsync()
Public Function RecognizeAsync() As IAsyncOperation(Of SpeechRecognitionResult)
public:
IAsyncOperation<SpeechRecognitionResult>^ RecognizeAsync()

Parameters

This method has no parameters.

Return value

Type: IAsyncOperation<SpeechRecognitionResult>

The result of the speech recognition session that was initiated by the SpeechRecognizer object.

Remarks

For more information about how to use the RecognizeAsync method, see Starting speech recognition for Windows Phone.

Multiple concurrent RecognizeAsync calls on the same speech recognizer object raises an InvalidOperationException. In addition, calling serially may also result in an exception if the existing running RecognizeAsync call is not in a final state such as error, cancelled, or completed. To avoid this problem, use the await keyword with this method and do not attempt another speech recognition attempt until the first attempt completes.

If the speech recognizer uses a developer-authored grammar, there is no limit on the audio length of the speech recognition attempt. However, if the speech recognizer uses a pre-defined grammar type, the maximum audio length is approximately 10 seconds. The SPERR_AUDIO_LIMIT_EXCEEDED error returns in cases where the audio length is longer than the maximum value.

The RecognizeAsync method can return an important error related to the speech privacy policy. You should handle this error in your app for the best user experience. For more information about the speech privacy policy error and other errors and exceptions in speech recognition, see Handling errors in speech apps.

Requirements

Minimum supported client

None supported

Minimum supported server

None supported

Minimum supported phone

Windows Phone 8

Namespace

Windows.Phone.Speech.Recognition Windows::Phone::Speech::Recognition [C++]

Metadata

Windows.WinMD

Capabilities

ID_CAP_SPEECH_RECOGNITION [Windows Phone] ID_CAP_MICROPHONE [Windows Phone] ID_CAP_NETWORKING [Windows Phone]

See also

SpeechRecognizer