DataRecognitionClient Class Reference
Inherits from | Conversation : NSObject |
---|---|
Declared in | DataRecognitionClient.mm SpeechRecognitionService.h |
Overview
The Azure Intelligent Services API client to perform speech recognition from acquired data (for example from a file or acquired audio source).
Data is broken up into buffers and each buffer is sent to the speech recognition service. No modification is done to the buffers; if silence detection is required, it must be performed in an external pre-processing pass over the data.
Returns only speech recognition results; intent detection is not performed.
Audio data must be PCM, mono, 16-bit sample, with sample rate of 16000 Hz.
– initWithSpeechRecoParams:withPrefs:withIntent:withProtocol:
Initializes a speech recognition client that uses the buffered data as the input source.
- (id)initWithSpeechRecoParams:(SpeechRecognitionMode)speechRecognitionMode withPrefs:(AdmRecoOnlyPreferences *)prefs withIntent:(bool)wantIntent withProtocol:(id<SpeechRecognitionProtocol>)delegate
Parameters
speechRecognitionMode |
The speech recognition mode. In ShortPhrase mode, the client receives one final multiple N-best choice result. In Long-form Dictation mode, the client receives multiple final results, based on where the service thinks sentence pauses are. |
---|---|
prefs |
A set of preferences used to configure the speech service. |
wantIntent |
Set this parameter to false |
delegate |
The speech recognition protocol callback |
Return Value
The speech recognition client
Discussion
Initializes a speech recognition client that uses the buffered data as the input source.
Callers are responsible for acquiring the audio data and writing that data to input streams. The data is split into buffers; each buffer is sent to the speech recognition service. No modification is done to the buffers; silence detection must be performed by an external algorithm before calling any methods to write data to the service. The recognition service returns only speech recognition results and does not perform intent detection. The audio must be PCM, mono, 16-bit sample, with sample rate of 16000 Hz.
Declared In
DataRecognitionClient.mm
– sendAudioFormat:
Sends an audio format description to the service.
- (void)sendAudioFormat:(SpeechAudioFormat *)format
Parameters
format |
Audio features that describe the encoding and sampling rate of the audio. |
---|
Discussion
Sends an audio format description to the service.
If you are not sending up a audio file in wave format, but instead you have just raw data, then before sending up any audio data you must first send up an [SpeechAudioFormat](../Classes/SpeechAudioFormat.html) descriptor to describe the layout and format of your raw audio data. The audio must be PCM, mono, 16-bit sample, with sample rate of 16000 Hz.
Declared In
DataRecognitionClient.mm
– sendAudio:withLength:
Sends audio data to the service at a controlled rate.
- (void)sendAudio:(NSData *)buffer withLength:(int)actualAudioBytesInBuffer
Parameters
buffer |
The data bytes of audio to send to the service. |
---|---|
actualAudioBytesInBuffer |
The actual number of audio bytes in the buffer. The buffer size is allowed to be larger than the actual audio data in the buffer, so
|
Discussion
Sends audio data to the service at a controlled rate.
Collects and sends buffered audio to the speech recognition service. The audio must be PCM, mono, 16-bit sample, with sample rate of 16000 Hz. For raw audio, i.e. audio data that is not in wave format (e.g. audio captured over Bluetooth), before sending up any audio data with this method, you must call the sendAudioFormatWorker method to send a [SpeechAudioFormat](../Classes/SpeechAudioFormat.html) descriptor that describes the layout and format of your raw audio data. This work is queued on a background worker thread.
If you try to send audio data to the service too fast, this method will throttle the upload speech to match the audio data rate specified in the [SpeechAudioFormat](../Classes/SpeechAudioFormat.html) for this audio stream.
Declared In
DataRecognitionClient.mm
– endAudio
Notifies the service that the client is finished sending buffered audio.
- (void)endAudio
Discussion
Notifies the service that the client is finished sending buffered audio.
This work is queued onto a background worker.
Declared In
DataRecognitionClient.mm
– waitForFinalResponse:
Waits the given number of seconds for a speech recognition response. Calling this method blocks the current thread until the response is received or the wait time is exceeded.
- (bool)waitForFinalResponse:(int)timeoutInSeconds
Parameters
timeoutInSeconds |
The time to wait for a response, in seconds. |
---|
Return Value
true if the final speech recognition result is sent from the speech recognition service or false if the timeout was reached.
Discussion
Waits the given number of seconds for a speech recognition response. Calling this method blocks the current thread until the response is received or the wait time is exceeded.
Declared In
DataRecognitionClient.mm
– sendAudioFormatWorker:
Sends an audio format description to the service.
- (void)sendAudioFormatWorker:(SpeechAudioFormat *)format
Parameters
format |
Audio features that describe the encoding and sampling rate of the audio. |
---|
Discussion
Sends an audio format description to the service.
If you are not sending up a audio file in wave format, but instead you have just raw data, then before sending up any audio data, you must first send up an [SpeechAudioFormat](../Classes/SpeechAudioFormat.html) descriptor to describe the layout and format of your raw audio data. The audio must be PCM, mono, 16-bit sample, with sample rate of 16000 Hz.
Declared In
DataRecognitionClient.mm
– sleepAndSendAudioWorker:withLength:
Sends audio data to the service at a controlled rate.
- (void)sleepAndSendAudioWorker:(Byte *)buffer withLength:(int)actualAudioBytesInBuffer
Parameters
buffer |
The data bytes of audio to send to the Server. |
---|---|
actualAudioBytesInBuffer |
The actual number of audio bytes in the buffer. The buffer size is allowed to be larger than the actual audio data in the buffer, so
|
Discussion
Sends audio data to the service at a controlled rate.
If you try to send audio data to the service too fast, this method will throttle the upload speech to match the audio data rate specified in the [SpeechAudioFormat](../Classes/SpeechAudioFormat.html) for this audio stream.
Declared In
DataRecognitionClient.mm
– endAudioWorker
Notify the server that client is done sending audio.
- (void)endAudioWorker
Discussion
Notify the server that client is done sending audio.
Declared In
DataRecognitionClient.mm