Speech - Speak text

Declaration

<AMSPEECH TEXT="text" VOICE="text (options)" FILE="text" SPEAK="YES/NO" VOLUME="number" SPEED="number" />

Description

Speaks the specified text using the Windows speech synthesis engine set to the selected voice.

NOTE: You must have the SAPI 4 speech engine installed to use this action.

Practical Usage

Used to speak text within tasks. Common uses would be to create a blind-accessible system to read text data from the screen, create audible reminders and notifications, and web/document reader applications.

Parameters

General

Property Type Required Default Markup Description
Text to speak Text Yes (Empty) TEXT="Hello" Specifies the text to have spoken. The Windows speech synthesis engine will resolve the text and synthesize it into a voice that speaks it at runtime. Use the available playback controls to test the action.
NOTE: If the text is for a language other than English, select the appropriate speech engine in the Voice parameter for that language to ensure words are pronounced correctly.

Advanced

Property Type Required Default Markup Description
Voice Text No Default
  • VOICE="Microsoft_David_Desktop"
  • VOICE="Microsoft_Zira_Desktop"
The speech engine to use. The available options are:
  • Default (default engine) - Use default speech engine at runtime.
  • Microsoft David Desktop - Use Microsoft David Desktop speech engine at runtime.
  • Microsoft Zira Desktop - Use Microsoft Zira Desktop speech engine at runtime.
NOTE: If the selected speech engine is not installed on the system, Automate will revert to the default speech engine at runtime.
Display voices in all languages --- --- --- --- Displays the voices available in all languages. Use this option if you are using a language other than English. This will populate the Voice parameter with all appropriate speech engines for the language used so that the words are pronounced correctly.
NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes.
Save spoken text to a wave file Text No (Disabled) FILE="C:\temp\text.wav" If selected, the text to speak is saved to a .WAV file during runtime. Click the folder icon to browse to the desired folder location to save the .WAV file or manually enter it in the text box. This parameter is disabled by default.
Do not speak the text out loud Yes/No No Yes SPEAK="YES" If selected, the text is not spoken out loud during runtime. If disabled (default), the text is spoken out loud during runtime.

NOTE: Pressing the play button will always speak the text out loud. This parameter is only valid when the task is triggered or otherwise ran manually from outside the Task Builder.

Voice Attributes

Property Type Required Default Markup Description
Volume Number No 100 VOLUME="90" The volume level of the speech engine. The default value is set to 100.
NOTE: This parameter modifies the voice engine's volume only. It does not affect the system volume.
Speed Number No 50 SPEED="58" The speed to use to speak the text. The default value is set to 50.

NOTE: Certain voice engines will restrict the speed that can be used to a certain range and some may not allow any customization of this parameter at all.

Description

Error Causes

On Error

Examples

NOTE:
  • The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
  • Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.

Example 1

This sample task speaks the text "Hello, I am Automate. I am at your service."

Copy
<AMSPEECH TEXT="Hello, I am Automate. I am at your service." VOLUME="100" SPEED="50" />

Example 2

This sample task demonstrates the following:

  1. Use of the Input Box action to ask the user a question, retrieve the answer and use it in another step.

  2. Use of the Speech action (text to speech).

Copy
<AMSHOWDIALOG>This sample task demonstrates the following:
1) Use of the Input Action to ask the user a question, retrieve the answer and use it in another step.
2) Use of the Speech action (text to speech).
Remember you can always stop a task in progress by pressing CTRL-ALT-END. Press okay to continue running the task or Cancel to stop now.</AMSHOWDIALOG>
<AMVARIABLE NAME="thetext" />
<AMSHOWDIALOG ACTIVITY="input" RESULTVARIABLE="thetext">What would you like Automate to say? (please note, on older operating systems SAPI must be installed for this to function)</AMSHOWDIALOG>
<AMSPEECH VOLUME="100" SPEED="50">Okay, I will say it just for you.%thetext%.Cool isn't it?  </AMSPEECH>