# Managing USAI parameters

The Universal Speech Access API provides three types of parameter values:

- System defaults

- Per-session

- Per-command

## System default parameter values

System default parameter values are set at speech server start up time. These parameter values are usually defined in speech server configuration files and are vendor-specific. To modify these values, use vendor-specific configuration methods.

## Per-session parameter values

Session default parameters maintain specific parameter values as long as a current synthesizer or recognizer session remains open. The initial settings for these values are the system defaults. To modify these values on the client side, use USAI synthesizer and recognizer parameter functions such as saiAsrSetSpeedVsAccuracy and saiTtsSetVoice. Refer to Recognizer parameter functions and Synthesizer parameter functions.

The application can call multiple synthesizer and recognizer parameter functions to modify parameters on the client side. However, these parameter modifications are not updated on the speech server until the application uses saiSetParamRecognizer or saiSetParamSynthesizer. By invoking saiSetParamRecognizer and saiSetParamSynthesizer, the application updates the specified parameter modifications on the speech server, and the modified parameters remain valid for the duration of the speech server session. All subsequent commands associated with the current synthesizer or recognizer session use the modified parameter values.

If the application invokes synthesizer and recognizer parameter functions but does not invoke saiSetParamRecognizer or saiSetParamSynthesizer, the modified parameters only affect the next synthesizer or recognizer command that the application invokes.

## Per-command parameter values

Per-command parameter settings maintain specified values until the application sends a synthesizer or recognizer request to the server. To modify synthesizer or recognizer parameter values on the client side, use USAI synthesizer and recognizer parameter functions such as saiAsrSetSpeedVsAccuracy and saiTtsSetVoice. Refer to Recognizer parameter functions and Synthesizer parameter functions.

However, when the application calls a USAI recognizer or synthesizer function other than saiSetParamRecognizer or saiSetParamSynthesizer (for example, saiSpeakSynthesizer), USAI only applies the modified parameter values for that command. After the command executes, all modified parameters revert to the session defaults.

## Example of managing recognizer parameters

The following table shows how SAI service parameter values are applied when an application uses Universal Speech Access API recognizer functions:

Task | Client-side action | Client-side parameter value | Server-side action | Server-side parameter value
Server start up. | No action. | System default | Server initialization. Read configuration file and update server-side database. | System default
Client start up. | Requests server-side default parameter values and updates the client-side database. | System default | No action. | System default
Start a speech session and request a recognizer resource. | Creates a recognizer object and the system default value is applied to the current session. | System default | Allocates a recognizer resource to the current session. The system default values are applied. | System default
Request a recognition action. | Application calls saiStartRecognizer. Client sends a recognize request to the server with no new parameter values. | System default | Performs the recognition action and returns the result. | System default
Retrieve server parameter value for speed versus accuracy. | Application calls saiAsrGetSpeedVsAccuracy. Client returns value from system default parameter values. | System default | No action. | System default
Set client-side parameter value for speed versus accuracy. | Application calls saiAsrSetSpeedVsAccuracy. Client updates its local database parameter value. | Per-command | No action. | System default
Update server-side parameter values with client-side settings. | Application calls saiSetParamRecognizer. Client sends a SET_PARAM request to the server and specifies the new parameter value. | Per-session | Updates the parameter for the current session only. | Per-session
Retrieve server-side parameter values. | Application calls saiGetParamRecognizer. Client sends a GET_PARAM request to the server and retrieves the parameter value. | Per-session | Updates client-side values. | Per-session
Recognition complete. | Reverts to the previous parameter value before the call to saiStartRecognizer. | System default | Reverts to the previous parameter value before the saiStartRecognizer command. | System default
Retrieve server parameter value for speed versus accuracy. | Application calls saiAsrGetSpeedVsAccuracy. Client returns value from system default parameter values. | System default | No action. | System default
Set client-side parameter value for speed versus accuracy. | Application calls saiAsrSetSpeedVsAccuracy. Client updates its local database parameter value. | Per-command | No action. | System default
Update server-side parameter values with client-side settings | Application calls saiSetParamRecognizer. Client sends a SET_PARAM request to the server and specifies the new parameter value. | Per-session | Updates the parameter for the current session only. | Per-session
Request a recognition action. | Application calls saiStartRecognizer. Client sends a recognize request to the server. | Per-session | Performs the recognition action according to the current per-session parameters and returns the result. | Per-session
Request a recognition action. | Application calls saiStartRecognizer. Client sends a recognize request to the server. | Per-session | Performs the recognition action according to the current per-session parameters and returns the result. | Per-session
Close the session. | Application calls saiReleaseRecognizer. Client sends a release request to the server and closes the recognizer object. | System default | Frees the recognizer resource. | System default