Skip to main content

com.amivoice.wrp.Wrp Class

Wrp.construct()

Factory method that returns an instance of the Wrp class.

setListener(WrpListener listener)

Sets a listener object to receive events from the Wrp class.

listener: Listener object

void setServerURL(String serverURL)

Specifies the speech recognition server URL (wss://acp-api.amivoice.com/v1/).

serverURL: Speech recognition server URL

void setConnectTimeout(int connectTimeout)

Specifies the timeout value (in milliseconds) to be used when connecting to the speech recognition server.

connectTimeout: Timeout value (in milliseconds)

void setReceiveTimeout(int receiveTimeout)

Specifies the timeout value (in milliseconds) to be used when receiving responses from the speech recognition server.

receiveTimeout: Timeout value (in milliseconds)

void setGrammarFileNames(String grammarFileNames)

Specifies the connection engine name. Only one connection engine name can be specified.

grammarFileNames: Connection engine name

void setProfileId(String profileId)

Specifies the profile ID that identifies the user using registered words. The profileId should be a string composed of alphanumeric characters, hyphens ("-"), and underscores ("_"). However, strings beginning with "__" (two underscores) are reserved for the speech recognition engine, so please do not specify strings that start with "__".

profileId: Profile ID

void setProfileWords(String profileWords)

The speech recognition server will perform recognition processing using the information related to the profileWords specified here.

void setResultUpdatedInterval(String resultUpdatedInterval)

Specifies the interval at which recognition-in-progress events are issued.

resultUpdatedInterval: Interval for issuing events (in milliseconds)

void setCodec(String codec)

Specifies the format of the audio data to be sent. For the values to specify, please see About Audio Formats in the usage guide.

codec: Format name

void setResultType(String resultType)

Recognition result reception type. Specifies whether to receive interim recognition results or not.

JSON ・・・Does not receive interim recognition results. JSON+・・・ Receives interim recognition results.

resultType: "JSON" or "JSON+"

void setServiceAuthorization(String serviceAuthorization)

Specifies the APPKEY.

serviceAuthorization: APPKEY

boolean connect()

Connects to the speech recognition server.

boolean disconnect()

Disconnects from the speech recognition server.

boolean isConnected()

Returns whether currently connected to the speech recognition server.

boolean feedDataResume()

Starts sending audio data to the speech recognition server.

boolean feedData(byte[] data, int dataOffset, int dataBytes)

Sends audio data to the speech recognition server. The feedData() method can be called multiple times between calling the feedDataResume() method and the feedDataPause() method.

data: Byte array of audio data to be supplied. dataOffset: Starting offset of the audio data to be supplied. dataBytes: Number of bytes of audio data to be supplied.

boolean feedDataPause()

Completes sending audio data to the speech recognition server. When this method is called, the process is blocked until all unrecognized results for the entire audio data are received (getWaitingResults=0).

int getWaitingResults()

Returns the number of recognition results waiting to be received from the speech recognition server.

String getLastMessage()

Retrieves the message string sent to TRACE().

void sleep(int timeout)

Sleeps for the specified time.

timeout: Wait time (in milliseconds)

void setProxyServerName(String proxyServerName)

Sets the proxy server if a proxy server is being used.

proxyServerName: Proxy settings ( <username>:<password>@<proxyhost>:<port> )