Asynchronous Mode

To apply asynchronous mode use the StreamingRecognizeRequest method. This mode is best suited for real-time speech recognition.

The GRPC API allows the use of continuous mode in speech recognition in both service methods (asynchronous and synchronous).

To use continuous mode, you must have a valid license and the config.continuous_mode=true parameter must be set.

For more information on continuous mode see Continuous Mode.

The use of continuous mode is shown in the request example below.

../_images/continuousmode_grpc1.png

The result of each speech segment is returned as soon as it is processed.

../_images/continuousmode_grpc2.png

Audio streaming can be ended by setting the ‘LastPacket=true’ parameter. The result of the last speech segment is returned with the parameter ‘last_segment=true’

../_images/continuousmode_grpc3.png

The summary of the GRPC API continuous flow mode is as follows:

  1. The client application opens a GRPC channel with the ASR server;

  2. After the channel is opened, the client must send a configuration request (CONFIG_REQUEST) to start a recognition session, which is allocated exclusively to that connection. The .proto file for this request must contain a specified config field. The number of sessions that can be created is based on the amount of licenses available on the server;

  3. The client must then start capturing the audio and send the audio stream in short blocks (e.g. 200 ms), using the SEND_AUDIO request. This request must contain an audio byte array type media field. When using the StreamingRecognize service, the request must also contain the last_packet field. This field indicates the completion of sending audios. The server will continuously analyze the received audio samples and identify the speech segment;

  4. When the server detects the start of speech, it sends a response with a START OF SPEECH event. During speech segment processing, the server may send partial recognition results via the PARTIAL RECOGNITION RESULT response, that is, final_result = false;

  5. When the server detects the end of speech, the response with an END OF SPEECH event will be sent. Server will generate the final result of recognition for that segment by resending a RECOGNITION RESULT response; if in this response the last_segment field is equal to TRUE, the client must end the call.

  6. If the client wishes to perform new recognition, a configuration request must be sent again;

  7. Communication with server is closed when client closes the channel.