---
slug: /amivoice-api/reference/client-library/hrp/com-amivoice-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 setSegmenterProperties(String segmenterProperties)

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

For details on the parameters, please see [segmenterProperties](/amivoice-api/manual/request-parameters#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](/amivoice-api/manual/request-parameters#maxdecodingtime).

maxDecodingTime: Maximum recognition processing time (milliseconds)

### void setMaxResponseTime(String maxResponseTime)

Specifies the maximum response time. For details, please see [maxResponseTime](/amivoice-api/manual/request-parameters#maxresponsetime).

maxResponseTime: Maximum response time (milliseconds)

### void setMaxDecodingRate(String maxDecodingRate)

Specifies the maximum RT. For details, please see [maxDecodingRate](/amivoice-api/manual/request-parameters#maxdecodingrate).

maxDecodingRate: Maximum RT

### void setTargetResponseTime(String targetResponseTime)

Specifies the target response time. For details, please see [targetResponseTime](/amivoice-api/manual/request-parameters#targetresponsetime).

targetResponseTime: Target response time (milliseconds)

### void setTargetDecodingRate(String targetDecodingRate)

Specifies the target RT. For details, please see [targetDecodingRate](/amivoice-api/manual/request-parameters#targetdecodingrate).

targetDecodingRate: Target RT

### void setRecognitionTimeout(String recognitionTimeout)

Specifies the recognition completion timeout. For details, please see [recognitionTimeout](/amivoice-api/manual/request-parameters#recognitiontimeout).

recognitionTimeout: Recognition completion timeout (milliseconds)

### void setExtension(String extension)

Specifies the usage aggregation tag. For details, please see [Usage Aggregation Tags](/amivoice-api/manual/billing-key).

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](/amivoice-api/manual/audio-format) in the development guide. This specification is required.

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 API key.

serviceAuthorization: API key

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