YSKRecognizerDelegate protocol

#import <YSKRecognizerDelegate.h>

The interface defines the callback methods of the delegate called by the recognizer (YSKRecognizer).

These methods are called as part of the recognition lifecycle of a YSKRecognizer object. The delegate will be notified when recording started, a new audio fragment was recorded, the recognition process finished (sucessfully or with an error), and about other events.

Instance methods

- recognizer:didCompleteWithResults:

Called when the recognition process completes successfully.

- recognizer:didFailWithError:

Called when the recognition process failed with an error.

- recognizer:didRecordSoundData:

Called when a chunk of audio data has been recorded.

- recognizer:didUpdatePower:

Called for updating the power of the speech signal.

- recognizerDidDetectSpeech:

Called when speech is detected in the audio.

- recognizerDidFinishRecording:

Called when the recognizer finished recording sound.

- recognizerDidStartRecording:

Called when the recognizer began recording sound.

Method descriptions

- recognizer:didCompleteWithResults:

- (void) recognizer:(YSKRecognizer *) recognizer
didCompleteWithResults:(YSKRecognition *) results

Called when the recognition process completes successfully.

This is the mechanism used by the recognizer to provide recognition results. The method is called only if speech was recognized successfully. Otherwise, recognizer:didFailWithError: is called.
Parameters:
results

recognition result

- recognizer:didFailWithError:

- (void) recognizer:(YSKRecognizer *) recognizer
didFailWithError:(NSError *) error

Called when the recognition process failed with an error.

Errors can occur for a number of reasons: an error opening the audio device, an error communicating with the server, an invalid parameter value passed during initialization (for example, the language code or authentication data), the user canceling the request, and so on. The reason for the error is passed by the function parameter. The method is called only if recognition failed with an error. Otherwise, recognizer:didCompleteWithResults: is called.
Parameters:
error

Error during speech recognition.

- recognizer:didRecordSoundData:

- (void) recognizer:(YSKRecognizer *) recognizer
didRecordSoundData:(NSData *) data

Called when a chunk of audio data has been recorded.

Parameters:
data

Raw audio data recorded from the audio device.

Note.

The sample width and rate are unspecified and may change.

- recognizer:didUpdatePower:

- (void) recognizer:(YSKRecognizer *) recognizer
didUpdatePower:(float) power

Called for updating the power of the speech signal.

The function is called on every new chunk of audio data and should be used to update the voice power indicator in the user interface.
Parameters:
power

A fractional number between 0 and 1 indicating the power of the signal (0 means no signal, and 1 is the maximum signal).

Note.

The function is called even if the power has not changed.

- recognizerDidDetectSpeech:

- (void) recognizerDidDetectSpeech:(YSKRecognizer *) recognizer

Called when speech is detected in the audio.

Note.

This method is only called if the Voice Activity Detector (VAD) is enabled.

- recognizerDidFinishRecording:

- (void) recognizerDidFinishRecording:(YSKRecognizer *) recognizer

Called when the recognizer finished recording sound.

- recognizerDidStartRecording:

- (void) recognizerDidStartRecording:(YSKRecognizer *) recognizer

Called when the recognizer began recording sound.