# Using saidemo

saidemo is a sample application that enables you to create recognizer (ASR) and synthesizer (TTS) resources located on remote speech servers. Once created, saidemo provides a set of options to control the resources.

#### Purpose

Demonstrates the speech interface provided by the SAI service. The application initializes the Natural Access environment, opens the appropriate services (ADI, MSPP, SAI), and enables you to choose between two sets of options:

Test | Description
Unit test | Executes individual SAI service functions.
Integration test | Executes a series of function calls that perform a complete set of test processes.

The unit test and the integration test enable you to:

- Create, control, and destroy recognizer and synthesizer resources.

- View and modify synthesizer and recognizer engine parameters.

#### Usage

saidemo arguments

#### Featured functions

saiAsrAddVendorSpecific, saiAsrGetVendorSpecific, saiAsrSetVendorSpecific, saiCreateRecognizer, saiCreateSynthesizer, saiGetParamRecognizer, saiGetParamSynthesizer, saiReleaseRecognizer, saiReleaseSynthesizer, saiSpeakSynthesizer, saiStartRecognizer, saiStopRecognizer, saiStopSynthesizer, saiTtsAddVendorSpecific, saiTtsGetVendorSpecific, saiTtsSetVendorSpecific

#### Prerequisites

Before running saidemo, modify the following files as necessary:

Configuration file | Sample file | Description
NaturalAccess configuration file | cta.cfg | Specifies that Natural Access initialize the SAI service and the SAI service manager when the system boots. In addition, other services used in the application must be initialized in this file (for example, the ADI and MSPP services). Location: Windows: c:\NMS\CTAccess\CFG\cta.cfg UNIX: /opt/nms/ctaccess/cfg/cta.cfg
SAI configuration file | saiconfig.xml | Specifies parameters that define which speech servers to access on the network. Location: Windows: c:\NMS\CTAccess\CFG\saiconfig.xml UNIX: /opt/nms/ctaccess/cfg/saiconfig.xml
CG board keyword file | cg6kfusion-t.cfg | Specifies board-level parameters that determine how board resources are allocated. Location: Windows: c:\NMS\CG\Cfg\cg6kxxx.cfg UNIX: /opt/nms/cg/cfg/cg6kxxx.cfg
OAM system configuration file | oamsys.cfg | Specifies bus and slot numbers for each board to match the chassis configuration. Location: Windows: c:\NMS\OAM\cfg\oamsys.cfg UNIX: /opt/nms/oam/cfg/oamsys.cfg

#### Procedure

To run saidemo:

Step | Action
1 | Modify or create the appropriate configuration files according to the system configuration.
2 | Open a command line window and navigate to the nms\spaccess\samples\saidemo directory.
3 | Enter the following command: saidemo -sserver -iSRV_IP -bCG_IP_1 -tTTS_RTP_PRT -aASR_RTP_PRT where:
Argument | Description
-s server | Speech server name defined in the saiconfig.xml file.
-i SRV_IP | IP address of a speech server.
-b CG_IP_1 | IP address of the CG board.
-t TTS_RTP_PRT | RTP port to use for synthesizer process.
-a ASR_RTP_PRT | RTP port to use for recognizer process.
-h | View a list of program options.
For example: saidemo –sMRCP1 –i10.10.20.54 –b10.10.35.112 –t2000 –a2002

#### Details

The following table shows saidemo initialization steps:

Step | Description
1 | Initialize Natural Access environment.
2 | Create a Natural Access event queue and return its handle.
3 | Create a context for the current queue and return its handle.
4 | Initialize the SAI, ADI, and MSPP services and open them in the current context.

When you run saidemo, it displays the following menu options:

Option | Description
0. Exit this application | Closes all resources, closes all services, destroys context and queue, and exits the program.
1. Unit Tests | Sub-menu that provides options for executing individual SAI service functions.
2. Integration Tests | Sub-menu that provides options for performing complete sets of test processes.

#### Unit tests

Unit test provides the following options:

Option | Description
0. Exit this menu | Exits the unit test menu and returns to the main menu. This option frees all resources that have not been released.
1. Print context | Prints the state of the message queue, the Natural Access context, and any recognizer or synthesizer handle. Indicates if Natural Access services have been opened.
2. Create tts | Creates a synthesizer resource in the current Natural Access context according to the parameters specified at the command line.
3. Get tts parameters | Lists all synthesizer (TTS) parameters.
4. Set tts parameters | Opens a submenu that displays options for individually setting synthesizer parameters. Before exiting the submenu, specify whether to transfer the new synthesizer parameters to the speech server (for continued use during the current synthesizer session) or apply the modified parameters only to the next command. For information about applying modified parameters, refer to Managing USAI parameters.
5. Start tts (SPEAK) | Sends a synthesizer process request to the speech server after displaying the following speech options: Synthesize speech from a sentence from the keyboard input. Synthesize speech from text at a specific URL. Synthesize speech from a pre-defined grammar list. Synthesize speech from an embedded server grammar. When the command completes, saidemo displays the status of the synthesizer process.
6. Stop tts | Sends a request to the speech server to stop the current synthesizer process.
7. Release tts | Releases the synthesizer resource and resets the synthesizer handle.
8. Create asr | Creates a recognizer in the current Natural Access context according to the parameters specified at the command line.
9. Start asr | Sends a recognize command to the speech server after displaying the following grammar type options: Perform speech recognition from speech data located at a specific URL. Perform speech recognition from speech data located at a list of URLs. Perform speech recognition from speech data from a pre-defined grammar list. Perform speech recognition from speech data from a grammar list name. Perform speech recognition from speech data from an embedded server grammar. Perform speech recognition from multiple-part define grammar. Perform speech recognition from multiple-part recognition. When the command completes, saidemo displays the status of the speech recognition process.
10. Get asr parameters | List all recognition (ASR) parameters.
11. Set asr parameters | Opens a submenu that displays options for individually setting recognizer parameters. Before exiting the submenu, specify whether to transfer the new recognizer parameters to the speech server (for continued use during the current recognizer session) or to apply the modified parameters only to the next command. For information about applying modified parameters, refer to Managing USAI parameters.
12. Stop asr | Sends a request to the speech server to stop the current speech recognition process.
13. Release asr | Releases the synthesizer resource and resets the recognizer handle.

#### Integration tests

Integration test provides the following options:

Option | Description
0. Exit this menu | Exits the integration test menu and returns to the main menu. This option frees all resources that have not been released.
1. Create a TTS and its RTP endpoint | Creates a synthesizer and its media connection (Fusion RTP endpoint).
2. Destroy tts and its RTP endpoint | Destroys the previously created synthesizer and its media connection.
3. Create asr and its RTP endpoint | Creates a recognizer and its media connection (the Fusion RTP endpoint).
4. Destroy asr and its RTP endpoint | Destroys the previously created recognizer and its media connection.
5. Cross connection using t1_loop_back configuration type | Cross-connects a synthesizer with a recognizer engine using the t1_loop_back configuration.
6. Destroy t1_loop_back connection | Destroys all resources and resets any handles created by option 5.
7. Cross connection using one_board_c_over configuration type | Cross-connects a synthesizer with a recognizer engine using the one_board_c_over configuration.
8. Destroy one_board_c_over connection | Destroys all resources and resets any handles created by option 7.
9. Speak and recognize | Once the cross-connection is created (option 5 or 7) a RECOGNIZE command is sent to the recognizer (ASR). When the RECOGNIZE acknowledge event is received, a SPEAK command is sent to the synthesizer (TTS) to start synthesizing speech. The application waits for a recognition complete event and displays the results.