To implement MRCP text-to-speech, you create a new state table
using the Blueworx Voice Response State
Table editor. Alternatively, you can create a state table using an
ASCII editor and then import it to the Blueworx Voice Response State Table
editor.
Figure 1 shows a completed state
table for a simple MRCP text-to-speech application in a Blueworx Voice Response State Table
editor window List View.
Note: Refer to the Blueworx Voice Response for AIX Blueworx Voice Response for AIX:
Application Development using State Tables manual for general
information on creating state tables.
Figure 1. Example state table for an MRCP text-to-speech
application
To create a new state table application for MRCP text-to-speech
using the Blueworx Voice Response State
Table editor:
- Create
the state table:
- From the Blueworx Voice Response Welcome
window, select Applications → State
Tables to display the State Tables window.
- Click File → New.
An empty State Table window is displayed:
- Click View → List View to
display the state table as a list, as shown in the figures in this
chapter.
- Define any entry points, input parameters, and
local variables that you intend to use in your state table. For MRCP
text-to-speech you need to specify:
- A local string variable for defining TTS parameters.
- A local string variable for holding the reason that the playing
of the synthesized speech was ended.
- A local string variable for the log identifier associated with
all log information created for the session.
- A local string variable to hold the text string to be synthesized
or a URL reference.
- A local numeric variable to hold the Session ID.
- A local numeric variable to hold the return code.
- Establish a connection between the caller and Blueworx Voice Response for an
incoming call:
- Select the AnswerCall icon in the PhoneLine folder
of the Action Palette.
- Drag it to the work area.
- Configure the AnswerCall action. For
more information on how to do this, refer to the “State table actions”
chapter in the Blueworx Voice Response for AIX:
Application Development using State Tables manual.
- Create the required parameter lists and text strings for TTS configuration.
- Select the AssignData icon
in the Variable folder of the Action
Palette and drag it to the work area.
- Click the Assign operator and select
the PutTag parameter.
- Click Const for Operand
1.
- Type in the Operand 1 field an MRCP
text-to-speech configuration parameter, for example the parameter speech-language.
- Click Const for Operand
2.
- Type in the Operand 2 field a valid
value for the parameter in the Operand 1 field,
for example, en-US.
- Click Result to display the Variables
window.
- Click Local to display a list of previously
defined local variables.
- Click the name of the tagged string variable to
use for specifying speech synthesis parameters for the session, and
click Select to save the information and
close the window. (The current parameter = value pair is appended
to the tagged string variable.)
- In the Action Assign Data window, type a meaningful description
in the Description field to help you identify
the Assign Data action.
- Click OK save the information
and close the window.
- Repeat steps 4.a through 4.k for each of the other parameter =
value pairs defining TTS parameters that you want to include in the
tagged string for the TTS parameters. See Table 1 for details of
possible speech synthesis parameters. You may need to adjust the values
of these parameters to suit your synthesizer server.
- Connect with the MST custom server by using Host -> OpenHostServerLink
- To enable your application to establish a link with the MST custom
server, select the OpenHostServerLink icon
in the Host folder of the Action
Palette and drag it to the position (in the List View)
of the AnswerCall action in the state table.
(The OpenHostServerLink action is added below it.) Configure the OpenHostServerLink action.
- Open a TTS session by using the MST_TTS_Assign state table.
- Double-click on the new InvokeStateTable action
in the state table to display the Action InvokeStateTable window.
- Type MST_TTS_Assign in the State
Label field.
- Type a meaningful description for the action in the Description field.
- Select the Invoke Direct radio button.
- Click on the State Table push button
to display the State Table Selection window.
- Select MST_TTS_Assign from the list
of available state tables displayed, and click on the OK push
button to confirm your selection and close the window.
- Click on the Parameters push button
to display the Invoke State Table Parameters window.
- Select the Const radio button for PARM1 and
type in the field the name of the TTS engine to be used.
Note: The
name must match the type of an engine configured on an available TTS
engine server for the TTS language and specified in the $CUR_DIR/ca/MST_dir/mst.xml configuration
file.
- Click on the PARM2 push button to display
the Variables window.
- Select the Local Variables radio button.
- Select the local variable for the TTS return code from the list
of available local variables displayed, and click on the Select push
button to confirm your selection and close the window. This variable
is used to hold the numeric return code issued when the MST_TTS_Assign
state table is invoked.
- Click on the PARM3 push button to display
the Variables window.
- Select the Local Variables radio button.
- Select the local variable for the TTS session from the list of
available local variables displayed, and click on the Select push
button to confirm your selection and close the window. This variable
is used to hold the numeric identifier of the MRCP speech synthesis
session being started. It is assigned at runtime by the system.
- Click on the PARM4 push button to display
the Variables window.
- Select the Local Variables radio button.
- Select the local variable for the TTS log identifier from the
list of available local variables displayed, and click on the Select push
button to confirm your selection and close the window. This variable
is used to hold the string identifier that is associated with all
log information that will be created for the MRCP speech synthesis
session being started. It is assigned at runtime by the system.
- In the Action InvokeStateTable window, leave the field for Result
0 blank, but for each of the other possible Result
State Transfer fields, type in the field the name of
the label to use for the state table action that will handle such
an error.
- Click on the OK push button to save
your changes and close the window.
- You now need to deal with the return code issued
when the MST_TTS_Assign state table is invoked. This involves switching
to a state table action that ends the current MRCP speech synthesis
session in the event of an error, or otherwise proceeding with the
next action in the state table. To do this:
- Select the Case icon in the Variables folder
of Action Palette and drag it to the position
(in the List View) of the previous action in the state table.
- Double-click on the Case action in the
state table to display the Action Case window.
- Type a meaningful description for the action in the Description field.
- Click on the Input Variable push button
to display the Variables window.
- Select the Local Variables radio button.
- Select the local variable for the TTS return code from the list
of available local variables displayed, and click on the Select push
button to confirm your selection and close the window. This logs the
numeric return code issued when an MST_TTS_Assign state table is invoked.
- For each possible return code (as documented in MST_TTS_Assign), type in the When field
the numeric return code, and in the Goto field,
the corresponding label of the action to which processing is redirected.
Leave the Default field blank to ensure
that if no errors are returned, processing continues with the next
action in the state table.
- Close the Action Case window by selecting the Default field
and pressing the Enter (Return) key.
Note: You can define the state
table actions that handle the error processing later, but you must
use the Goto labels you have specified.
- Optionally, to override for this session the speech synthesis
configuration parameters defined in the $CUR_DIR/ca/MST_dir/mst.xml configuration
file, select the InvokeStateTable action,
invoke the supplied state table MST_TTS_Config:
- Type MST_TTS_Config in the State
Label field.
- Type a meaningful description for the action in the Description field.
- Select the Invoke Direct radio button.
- Click on the State Table push button
to display the State Table Selection window.
- Select MST_TTS_Config from the list
of available state tables displayed , and click on the OK push
button to confirm your selection and close the window.
- From the Action InvokeStateTable window, click on the Parameters push
button to display the Invoke State Table Parameters window.
- Click on the PARM1 push button to display
the Variables window.
- Select the Local Variables radio button.
- Select the local variable for the TTS session ID from the list
of available local variables displayed, and click Select to
confirm your selection and close the window. This variable is used
to hold the numeric identifier of the MRCP speech synthesis session
being configured. It is assigned at runtime by the system.
- Click on the PARM2 push button to display
the Variables window.
- Select the Local Variables radio button.
- Select the local variable for the TTS parameter string from the
list of available local variables displayed, and click Select to
confirm your selection and close the window. This variable was defined
earlier in step 2 and is a
tagged string including valid MRCP TTS configuration header fields
to specify TTS session parameters.
- Click on the PARM3 push button to display
the Variables window.
- Select the Local Variables radio button.
- Select the local variable for the TTS return code from the list
of available local variables displayed, and click on the Select push
button to confirm your selection and close the window. This variable
is used to hold the numeric return code issued when the MST_TTS_Config
state table is invoked.
- You now need to deal with the return code issued when the MST_TTS_Config
state table is invoked. This involves switching to a state table action
that ends the current MRCP speech synthesis session in the
event of an error, or otherwise proceeding with the next action in
the state table. See step 7 for
details of how to do this. The possible return codes are documented
in MST_TTS_Config.
- Synthesize speech by using the MST_TTS_Speak state table to ‘speak’
a text string or a text file. Using the InvokeStateTable action,
invoke the supplied state table MST_TTS_Speak:
- From the Action InvokeStateTable window, click on the Parameters push
button to display the Invoke State Table Parameters window.
- Click on the PARM1 push button to display
the Variables window.
- Select the Local Variables radio button.
- Select the local variable for the TTS session ID from the list
of available local variables displayed, and click Select to
confirm your selection and close the window. This variable is used
to hold the numeric identifier of the MRCP speech synthesis session
being configured. It is assigned at runtime by the system.
- Select the Const radio button for PARM2,
and type ascii-string to specify the format of the
text to be synthesized. The string is automatically enclosed in MRCP
‘speak’ tags before being sent to the MRCP TTS server by the application.
- Click on the PARM3 push button to display
the Variables window.
- Select the Local Variables radio button.
- Select the string that holds the prompt text to be synthesized.
- Click on the PARM4 push button to display
the Variables window.
- Select the Local Variables radio button.
- Select the local string variable for defining TTS parameters from
the list of available local variables displayed, and click Select to
confirm your selection and close the window. This variable was defined
earlier in step 2 and is a
tagged string including valid MRCP TTS configuration header fields
to specify TTS session parameters. If you wanted to override for this
particular ‘speak’ action the parameters specified in the MST_TTS_Config
state table you could do so by specifying a different tagged string.
- Select the Const radio
button for PARM5, and type NONE to
specify that the playing of synthesized text cannot be interrupted.
If you are using text-to-speech instead of a recorded prompt you could
use barge-in to interrupt it by specifying the available option:
- ALL — to allow interruption by pressing any
DTMF key
- Click on the PARM6 push button to display
the Variables window.
- Select the Local Variables radio button.
- Select the local variable for the TTS return code from the list
of available local variables displayed, and click on the Select push
button to confirm your selection and close the window. This variable
is used to hold the numeric return code issued when the MST_TTS_Speak
state table is invoked.
- Click on the PARM7 push button to display
the Variables window.
- Select the Local Variables radio button.
- Select the local variable for the TTS stop reason from the list
of available local variables displayed, and click on the Select push
button to confirm your selection and close the window. This variable
is used to hold information returned from the server on why playing
of synthesized speech was stopped.
- You now need to deal with the return code issued when the MST_TTS_Speak
state table is invoked. This involves switching to a state table action
that ends the current MRCP speech synthesis session in the
event of an error, or otherwise proceeding with the next action in
the state table. See step 7 for
details of how to do this. The possible return codes are documented
in MST_TTS_Speak.
- Free the TTS session by using the MST_TTS_Free state
table.
- Double-click on the InvokeStateTable action
in the state table to display the Action InvokeStateTable window.
- Type MST_TTS_Free in the State Label field.
- Type a meaningful description for the action in the Description field.
- Select the Invoke Direct radio button.
- Click on the State Table push button
to display the State Table Selection window.
- Select MST_TTS_Free from the list of
available state tables displayed, and click on the OK push
button to confirm your selection and close the window.
- Click on the Parameters push button
to display the Invoke State Table Parameters window.
- Specify local variables for each of the parameters, as follows:
- Parameter
- Value
- PARM1
- The local variable for the TTS session ID
- PARM2
- The local variable for the TTS return code
- In the Action InvokeStateTable window, for each of the Result
State Transfer fields, type in the field the name of
the label to use for the state table action that will handle such
an error.
- Click on the OK push button to save
your changes and close the window.
- Log any error condition that may occur when the state table application
is run. For each event that you want to log, select the LogEvent icon
in the Miscellaneous folder of the Action
Palette and drag it to the position (in the List View)
of the InvokeStateTable action in the state
table.
- Double-click on the LogEvent action
in the state table to display the Action LogEvent window.
- Type a meaningful description in the Description field.
- Select the Const radio button for Private
Event, and type a meaningful string to identify the
type of error. Leave the System Event as
an undefined variable.
- In each of the Result State Transfer fields,
type the label of the state table action that will handle exit processing.
- Click on the OK push button to save
your changes and close the window.
- Disconnect with the MST custom server by selecting the CloseHostServerLink icon
in the Host folder of the Action
Palette and draging it to the position (in the List
View) of the previous action in the state table. This closes an open
link with the MST Custom Server.
- Double-click on the CloseHostServerLink action
in the state table to display the Action CloseHostServerLink window.
- Type a label name for the action in the State Label field.
- Type a meaningful description for the action in the Description field.
- Click on the Server Type push button
to display the Server Type Selection window.
- Select Custom Server from the list displayed,
and click on the OK push button to confirm
your selection and close the window.
- Click on the Server Name push button
to display the Servers Selection window.
- Select MST from the list displayed,
and click on the OK push button to confirm
your selection and close the window.
- Click on the OK push button to save
your changes and close the window.
- To enable your application to exit from the state table, select
the ExitStateTable icon in the StateTable folder
of the Action Palette and drag it to the
position (in the List View) of the previous action in the state table.
- Double-click on the ExitStateTable action
in the state table to display the Action ExitStateTable window.
- Type a label name for the action in the State Label field.
- Select a value of 0 to return to the
calling InvokeStateTable action.
- Click on the OK push button to save
your changes and close the window.
- Close the connection between the caller and Blueworx Voice Response.
- Terminate the application. Optionally, to terminate your application
completely, freeing any allocated resources, hanging up any open telephone
lines, and dropping all host sessions, select the CloseEverything icon
in the Miscellaneous folder of the Action
Palette and drag it to the position (in the List View)
of the previous action in the state table.