Speech Namespace

The Speech namespace provides access to speech-recognition services.

Classes

SFSpeechAudioBufferRecognitionRequest

An SFSpeechRecognitionRequest that takes its input from an audio buffer.

SFSpeechRecognitionRequest

Abstract base class for speech recognition requests (see SFSpeechAudioBufferRecognitionRequest and SFSpeechUrlRecognitionRequest).

SFSpeechRecognitionResult

Contains transcriptions of a speech recognition task.

SFSpeechRecognitionTask

Object that holds state and provides control of an asynchronous speech recognition task.

SFSpeechRecognitionTaskDelegate

Delegate object whose members are called in reaction to speech-recognition events.

SFSpeechRecognitionTaskDelegate_Extensions

Extension methods to the ISFSpeechRecognitionTaskDelegate interface to support all the methods from the SFSpeechRecognitionTaskDelegate protocol.

SFSpeechRecognizer

Encapsulates the speech recognition facilities.

SFSpeechRecognizerDelegate

Delegate object for SFSpeechRecognizer.

SFSpeechRecognizerDelegate_Extensions

Extension methods to the ISFSpeechRecognizerDelegate interface to support all the methods from the SFSpeechRecognizerDelegate protocol.

SFSpeechUrlRecognitionRequest

A SFSpeechRecognitionRequest whose audio source is specified in a URL

SFTranscription

A conversion of speech into text.

SFTranscriptionSegment

Interfaces

ISFSpeechRecognitionTaskDelegate

Interface representing the required methods (if any) of the protocol SFSpeechRecognitionTaskDelegate.

ISFSpeechRecognizerDelegate

Interface representing the required methods (if any) of the protocol SFSpeechRecognizerDelegate.

Enums

SFSpeechRecognitionTaskHint
SFSpeechRecognitionTaskState

Enumerates the states of a SFSpeechRecognitionTask.

SFSpeechRecognizerAuthorizationStatus

Enumeration of the permission status of speech recognition.

Remarks

The Speech namespace, added in iOS 10, provides developers the ability to use speech recognition in their apps above-and-beyond the system-provided keyboard dictation or SiriKit.

Speech recognition is performed by a SFSpeechRecognizer object. A speech request is encapsulated in an SFSpeechRecognitionRequest and an SFSpeechRecognitionTask.

The T:HomeKit.Speech.SFSpeechRecognizer asynchronously processes the SFSpeechRecognitionTask and calls a handler delegate (possibly several times). The result contains the best and alternate matches, as shown in the following example:

var result = speechRecognizer.GetRecognitionTask(recognitionRequest, (recoResult, recoErr) =>
		{
			if (recoErr != null) { // ... etc ... }
			else
			{
				if (recoResult.BestTranscription != null)
				{
					textView.Text = recoResult.BestTranscription.FormattedString;
				}
        //...etc...
			}
		});

The SFSpeechRecognitionRequest is an abstract base class for SFSpeechAudioBufferRecognitionRequest, which is used with hardware devices and SFSpeechUrlRecognitionRequest, which transcribes audio already stored in a URL-available resource. Developers who use SFSpeechAudioBufferRecognitionRequest objects must add the following keys, with appropriate descriptions, to their applications' info.plist file:

<key>NSMicrophoneUsageDescription</key>
<string>Your microphone will be used to record your speech when you press the "Start Recording" button.</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>Speech recognition will be used to determine which words you speak into this device's microphone.</string>          

If an application does not have these keys, the operating system will execute a "silent" shutdown at runtime, with no exception or ability to log the mistake.

Speech recognition requires Internet access.