Skip to main content

com.amivoice.wrp.Wrp Class

Wrp.construct()

Factory method that returns an instance of the Wrp class.

void 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 to be used when connecting to the speech recognition server.

connectTimeout: Timeout value (milliseconds)

void setReceiveTimeout(int receiveTimeout)

Specifies the timeout value to be used when receiving responses from the speech recognition server.

receiveTimeout: Timeout value (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. For profileId, specify a string consisting of alphanumeric characters, "-" (hyphen), and "_" (underscore). However, strings starting with "__" (two underscores) are reserved by the speech recognition engine, so please do not specify strings starting with "__" (two underscores).

profileId: Profile ID

void setProfileWords(String profileWords)

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

void setSegmenterProperties(String segmenterProperties)

Specifies parameters related to the ease of detecting speech segments and speaker diarization.

For details on the parameters, please see segmenterProperties.

void setKeepFillerToken(String keepFillerToken)

Specifies whether to automatically delete filler words or not.

keepFillerToken: 1 or 0 (Set to 0 to automatically delete filler words, 1 to keep them, default is 0)

void setResultUpdatedInterval(String resultUpdatedInterval)

Specifies the interval for issuing recognition-in-progress events.

resultUpdatedInterval: Event issuing interval (milliseconds)

void setMaxDecodingTime(String maxDecodingTime)

Specifies the maximum recognition processing time. For details, please see maxDecodingTime.

maxDecodingTime: Maximum recognition processing time (milliseconds)

void setMaxResponseTime(String maxResponseTime)

Specifies the maximum response time. For details, please see maxResponseTime.

maxResponseTime: Maximum response time (milliseconds)

void setMaxDecodingRate(String maxDecodingRate)

Specifies the maximum RT. For details, please see maxDecodingRate.

maxDecodingRate: Maximum RT

void setTargetResponseTime(String targetResponseTime)

Specifies the target response time. For details, please see targetResponseTime.

targetResponseTime: Target response time (milliseconds)

void setTargetDecodingRate(String targetDecodingRate)

Specifies the target RT. For details, please see targetDecodingRate.

targetDecodingRate: Target RT

void setNoInputTimeout(String noInputTimeout)

Specifies the speech start timeout for waiting for speech to begin. For details, please see noInputTimeout.

noInputTimeout: Timeout for waiting for speech to start (milliseconds)

void setRecognitionTimeout(String recognitionTimeout)

Specifies the recognition completion timeout. For details, please see recognitionTimeout.

recognitionTimeout: Recognition completion timeout (milliseconds)

void setExtension(String extension)

Specifies the usage aggregation tag. For details, please see Usage Aggregation Tags.

extension: Usage aggregation tag

void setCodec(String codec)

Specifies the format of the audio data to be sent. For the values to specify, please see Audio Formats in the development 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 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 (milliseconds)

void setProxyServerName(String proxyServerName)

Sets the proxy server if using a proxy server.

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