KIOSRecognizerDelegate Protocol Reference

Conforms to NSObject
Declared in KIOSRecognizer.h

Overview

The KIOSRecognizerDelegate protocol defines optional methods implemented by delegates of the KIOSRecognizer class.

Partial recognition result is a result that’s periodically (100ms or so) reported while recognition is still in progress.

Final recognition result is a result that’s reported after the engine determined that there hasn’t been any voice activity for a predefined duration of time, as specifed by VAD endpointing settings.

Mandatory callback methods

– unwindAppAudioBeforeAudioInterrupt required method

This method is called when audio interrupt occurs. It will be called in synchronous manner immediately before KIOSRecognizer starts unwinding its audio stack. You would use this method to stop playing any audio that is controlled directly by your app. Your app should not modify AVAudioSession state nor interact with the recognizer at this point.

- (void)unwindAppAudioBeforeAudioInterrupt

Discussion

Warning: NOTE: this method will be called during app wind-down when audio interrupt occurs or the app goes to the background. It is crucial that this method performs quickly, otherwise KIOSRecognizer may not have sufficient time to properly unwind its audio stack before the app goes to background.

Declared In

KIOSRecognizer.h

– triggerPhraseDetected:

This method is called when trigger phrase has been recognized (in case decoding graph was built with trigger phrase support).

- (void)triggerPhraseDetected:(nonnull KIOSRecognizer *)recognizer

Parameters

recognizer

recognizer that recognized the trigger phrase

Declared In

KIOSRecognizer.h

– recognizerPartialResult:forRecognizer:

This method is called when recognizer has a new (different than before) partial recognition result. If decoding graph was built with trigger phrase support this method will not be called until trigger phrase occurs.

- (void)recognizerPartialResult:(nonnull KIOSResult *)result forRecognizer:(nonnull KIOSRecognizer *)recognizer

Parameters

result

partial result of the recognition

recognizer

recognizer that produced the result

Declared In

KIOSRecognizer.h

– recognizerFinalResponse:forRecognizer:

This method is called when recognizer has finished the recognition on its own because one of the VAD rules has triggered. At this time, recognizer is not listening any more.

- (void)recognizerFinalResponse:(nonnull KIOSResponse *)response forRecognizer:(nonnull KIOSRecognizer *)recognizer

Parameters

response

final response of the recognition

recognizer

recognizer that produced the result

Declared In

KIOSRecognizer.h

– recognizerReadyToListenAfterInterrupt:

This method is called when recognizer is ready to listen again, after being interrupted due to audio interrupt (incoming call, etc.) or because the app went to the background. See KIOSRecognizer for more details on handling interrupts. You will typically setup UI elements in this callback (e.g. enable “Start Listening” button), or explictly call startListening if your app is expected to listen as soon as the view has appeared.

- (void)recognizerReadyToListenAfterInterrupt:(nonnull KIOSRecognizer *)recognizer

Parameters

recognizer

the recognizer

Discussion

Warning: NOTE: this callback indicates readiness to listen from audio setup point of view. If you initialized a recognizer, but didn’t fully prepare it for listening (via prepareForListening: method), this callback will still trigger when audio interrupt ends.

Declared In

KIOSRecognizer.h