Skip to main content

s Command Packet / s Command Response Packet

The s command packet and s command response packet are paired. When you notify the server of the start of voice data transmission with the s command, the server returns an s command response packet.

If the s command response packet is a single "s" character, it indicates success. You can then begin supplying voice data with p command packets. When all voice data transmission is complete, notify the end of transmission with an e command packet. If the connection is still maintained after that, you can restart again from the s command packet.

s Command Packet

Starts voice data transmission. In addition to notifying the start of transmission, you need to send the format of the voice to be transmitted, the speech recognition engine (connection engine name) you want to use, authentication information (API key), and other parameters.

Format

Type TEXT

s <audio_format> <grammar_file_names>
s <audio_format> <grammar_file_names> <key>=<value> ...

The delimiter between s and each parameter block is a single space. Details of each parameter are explained below.

<audio_format>

Specifies the audio format to be sent. This parameter is required. For specifiable format names, please see About Audio Formats in the development guide.

<grammar_file_names>

Specifies the connection engine name. This parameter is required.

<key>

Specify request parameters in the <key>=<value> format. If <value> contains spaces, enclose the value in double quotes "".

The following parameters can be specified for <key>. authorization (API key) is required. For details of each parameter, see Request Parameters in the manual.

Parameter NameRequired
authorization(*1)
profileId
profileWords
keepFillerToken
segmenterProperties
extension
maxDecodingTime
maxResponseTime
maxDecodingRate
targetResponseTime
targetDecodingRate
recognitionTimeout
confidenceLevel
completeTimeout(*2)
wildcardModelPenalty(*2)
resultUpdatedInterval
noInputTimeout
  • (*1) In addition to specifying it as a request parameter, the authorization parameter can also be specified in the HTTP request header when connecting via WebSocket. For how to specify it in the header, see How to send authentication information in the HTTP request header in the manual.
  • (*2) Available only with the -a-rule-input-private engine.

Examples

An example of registering words (profileWords) that are effective only during the session. The value contains spaces, so it is enclosed in double quotes.

s MSB16K -a-general profileWords="AMI あみ|AmiVoice あみぼいす" authorization={API_KEY}

An example of specifying a user dictionary profile.

s MSB16K -a-general profileId=:test authorization={API_KEY}

For details on how to use the user dictionary, see User Dictionary in the manual.

s Command Response Packet

This is sent from the server to the client in response to the s command.

Format

Type TEXT

Response packet for successful start request

If the start request is successful, a single s character is returned.

s

Response packet for failed start request

If the start request fails, an error message is returned after s with a single space in between.

s <error_message>

Error Messages

Client Errors

These are errors due to incorrect request parameters or authentication information in the s command. Please correct and resend the request.

Error MessageContent
s received unsupported audio formatThere was an error in the specified audio format.
s can't verify service authorizationAuthentication failed. This is due to one of the following reasons:
- API key is not set
- The set API key is incorrect
- Access was made from an IP address outside the one specified in the Restrictions assigned to the API key
s can't validate service authorizationAuthentication failed. This is due to one of the following reasons:
- The configured API key is incorrect (including cases where the account is disabled)
- The specified connection engine name is incorrect (e.g., typos like writing a-general instead of -a-general, or specifying an engine exclusive to AmiVoice API Private without having a contract for it)
s service authorization has expired: <expirationTime> <expiresIn>The expiration time defined by the API Key has expired.
s can't connect to recognizer serverAuthentication failed. The API Key is invalid.
s can't connect to recognizer server (can't find available servers)Connection failed because the combination of the Sampling Rate in the audio format and the specified connection engine name is invalid, and a suitable engine could not be found.
For example, this may occur when an 8k audio format is specified for an engine that does not support an 8k sampling rate. For details on the sampling rates supported by each speech recognition engine, please see the List of Speech Recognition Engines.
s can't start feeding audio data to recognizer serverThe process to start sending audio data failed due to an error in the specified segmenter parameters.

Server Errors

These are errors that may rarely occur due to infrastructure system failures. Please wait for a while and resend the request.

Error MessageContent
s can't connect to recognizer server (can't connect to server)"Could not connect to the speech recognition server.
s can't connect to recognizer server (can't find available servers because all requested servers are busy)Could not connect because all appropriate speech recognition servers for the specified connection engine name or audio format were busy.
s can't connect to recognizer server (can't find available servers because maximum allowed clients has reached)Could not connect to the speech recognition server because the maximum number of connectable clients has been reached.
s can't connect to recognizer server (can't send data)Connection failed due to communication error between servers in the infrastructure system.
s can't connect to recognizer server (can't receive data)Connection failed due to communication error between servers in the infrastructure system.
s can't connect to recognizer server (disconnected by force)Connection failed due to communication error between servers in the infrastructure system.

Errors Due to Limitations

These occur when limitations are violated. Please retry from the s command request.

Error MessageContent
s session timeout occurredA session timeout occurred. This occurs when the maximum session time in the limitations is exceeded. The server has initiated the disconnection process.