Skip to main content

com.amivoice.hrp.Hrp Class

Hrp.construct()

Factory method that returns an instance of the Hrp class.

void setListener(HrpListener listener)

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

listener: Listener object

void setServerURL(String serverURL)

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

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. Always prefix it with a colon. 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 setResultUpdatedInterval(String resultUpdatedInterval)

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

resultUpdatedInterval: Event issuing interval (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. This specification is mandatory.

codec: Format name

void setResultType(String resultType)

Recognition result reception type. The value to specify for the HTTP interface is "JSON".

resultType: "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 any number of times between calling the feedDataResume() method and calling the feedDataPause() method.

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

boolean feedDataPause()

Completes sending audio data to the speech recognition server. When this method is called, the process is blocked until all unreceived recognition results are received.

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> )