Class YSKPhraseSpotter

Class for voice activation.

Voice activation technology allows detecting set phrases in the audio stream. The list of phrases is set in the voice activation model (an example of the model can be viewed at reference). Phrase detection can be performed continuously. It does not require an internet connection. All computations are performed on the device.
Note.
When starting an object of the YSKPhraseSpotter class with the default audio source or any other source that uses the standard device input, you should correctly configure the app's audio session. The YSKAudioSessionHandler class makes it easier to configure the audio session:
  • If your app uses an audio session only when working with the SpeechKit library, we recommend using this class to configure the audio session.

  • If your app uses the audio session outside the library (for audio and video playback, audio recording, and so on), you can also use this class or configure the audio session independently. If you decide to configure an audio session yourself, pay attention to the settings which may affect the operation of the YSKPhraseSpotter class object (the audio session settings are described in the YSKAudioSessionHandler class). Without appropriate settings, the YSKPhraseSpotter class object returns the YSKErrorAudioRecording error in the phraseSpotter:didFailWithError: method. Possible error codes are listed in YSKErrorCode.

Instance Methods

-initWithSettings:

Initializes an object of the YSKPhraseSpotter class with the specified settings.

-initWithSettings:audioSource:

Initializes an object of the YSKPhraseSpotter class with the specified settings and audio source.

-prepare

Prepares an object of the YSKPhraseSpotter class for recognizing phrases from the voice activation model.

-start

Starts an object of the YSKPhraseSpotter class.

-stop

Stops an object of the YSKPhraseSpotter class.

Properties

audioSource

Audio source that passes an audio for recognition to an object of the YSKPhraseSpotter class.

delegate

Delegate that receives notifications from an object of the YSKPhraseSpotter class.

settings

Settings of an object of the YSKPhraseSpotter class.

Method Detail

-initWithSettings:

- (instancetype)initWithSettings:(YSKPhraseSpotterSettings *)settings 

Initializes an object of the YSKPhraseSpotter class with the specified settings.

YSKAutoAudioSource will be used as an audio source. To enable it, correctly configure the app's audio session either through the YSKAudioSessionHandler class or independently.
Parameters:
settings

Settings of an object of the YSKPhraseSpotter class.

Returns:

An object of the YSKPhraseSpotter class.

-initWithSettings:audioSource:

- (instancetype)initWithSettings:(YSKPhraseSpotterSettings *)settings
                     audioSource:(id< YSKAudioSource >)audioSource 

Initializes an object of the YSKPhraseSpotter class with the specified settings and audio source.

If the audio source uses the standard device input, you should correctly configure the app's audio session either through the YSKAudioSessionHandler class or independently. This method is a designated initializer for the YSKPhraseSpotter class.
Parameters:
settings

Settings of an object of the YSKPhraseSpotter class.

audioSource

Audio source that passes an audio for recognition to an object of the YSKPhraseSpotter class.

Returns:

An object of the YSKPhraseSpotter class.

-prepare

- (void)prepare

Prepares an object of the YSKPhraseSpotter class for recognizing phrases from the voice activation model.

Makes preparation for speech recognition in advance. If the method is not called explicitly, it is called automatically in the start method. Asynchronous execution.We recommend that you call this method before running an object of the YSKPhraseSpotter class.

-start

- (void)start

Starts an object of the YSKPhraseSpotter class.

The method runs asynchronously; when recording starts, the phraseSpotterDidStarted: callback method is called.

-stop

- (void)stop

Stops an object of the YSKPhraseSpotter class.

Asynchronous execution.

Property Detail

audioSource

(strong, readonly) id< YSKAudioSource > audioSource

Audio source that passes an audio for recognition to an object of the YSKPhraseSpotter class.

If the audio source uses the standard device input, you should correctly configure the app's audio session either through the YSKAudioSessionHandler class or independently.

delegate

(weak, readwrite) id< YSKPhraseSpotterDelegate > delegate

Delegate that receives notifications from an object of the YSKPhraseSpotter class.

settings

(copy, readonly) YSKPhraseSpotterSettings * settings

Settings of an object of the YSKPhraseSpotter class.

In the settings, you can set the path to the voice activation model.