Input and Output Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Input- and Output commands >

Input and Output Commands

SAY. - Say something

Previous Top Next


MiniRobotLanguage (MRL)

 

SAY. Command

Say something

 

 

Intention

 

This command will make the robot speak. And More. Let's start with an easy example.

 

: $$TXT=With a couple of simple program statements, you can add

: $$TXT=$$TXT speech to your programs.

GUN.$$USR

ALB.$$USR|$$USR

: $$TXA=Hello $$USR, $$TXT

'

SAY.Look Mum, he is talking!{BREATH}

'

' The |w makes the robot wait until he has finished talking.

' Without the |w he would talk in the background.

'

SAY. $$TXA|w

ENR.

 

Per default all Speech runs in the background, while your script continues to do its job.

We have therefore specified the "|w"-Flag in this example.Because otherwise the script would end and you would not hear anything. The talking stops, when the script ends.

 

Alternatively you can have the robot talk while your script is running. In this case the talking happens in the background. Here is an example that show different uses.

 

SAY. This is a countdown!

PAU.1

FOR.$$CNT|10|3|-1

 SAY.$$CNT|w

NEX.

SAY.2

SAY.1

SAY.Now things can happen.|w

ENR.

 

The SAY. - command has multiple options. These are:

 

    Speak faster or slower using the {SPEED x} Tag. x is a number between -10 and 10, while 0 is default, normal Speed.

    Wait until Speech has finished, using the {WAIT} Tag without a number

    Wait until speech has finished or a timeout is reached using the {WAIT x}-Tag. Where x is a number that specifies the timeout in seconds or fractions of a second (like 0.5).

    Stop actual Speech using the {STOP}-Tag

    Repeat parts of the Saying using the {DO} and the {REPEAT x}-Tag. Where x is the number how often you want it to be repeated. DO/REPEAT can be nested to unlimited depth and can contain other tags inside the text that is to be repeated.

    Let the voice make a small rest, using the {BREATH} Tag

    Let the voice make a rest for a specified time in seconds, using the {BREATH x}-Tag. Where x is a number that specifies the time to rest in seconds or fractions of a second (like 0.5).

    Set the Mode, if the voice should "dictate" comma and punctuation or not. Using the {EXPAND x}-Tag. Where x is 0 to not expand punctuation, and 1 means that anything will be dictated.

    The {VOICES}-Tag will show you all installed voices that can be selected for Speaking.

    The {VOICE x}-Tag will select the Voice that the robot will talk with.

    The {PRIO x} Tag will set the Priority of the things to say. If there are multiple sentences in the Que, Sentences with a higher Priority will be said first and"overtake" other sentences in the Que. x is a number between 0 (default) and 2 (highest Priority).

    The {FILE}-Tag will switch into "Reciting Mode". It will have the Speech to recite a file for you.

    The {LINK}- Tag will have the Robot to read a WEB- or Intranet Site for you. Better don't use this one, as it reads the source-code of the site. This does really only make sense with special designed user-sites (intranet).

    Prefer using the {RECITE}-Tag. It will really read that article on a WEB-Site that is actually located.

 

Here are some examples:

 

Example 1: Say something and wait.

 

'*****************************************************

' EXAMPLE 1: SAY.

'*****************************************************

' Choose speaker voice

SAY.{voice Sam}

'

' Make robot not to speak Punctuation

SAY.{EXPAND 0}

'

' Set Speed to 1, that is a bit faster then normal

{SPEED 1}

'

' Say something .. and wait until all speech has been finished.

SAY. Did you get me?{wait}

'

' Take an additional Breath ....

SAY.{BREATH}

'

SAY.OK!{BREATH}OK?{WAIT}

ENR.

 

 

Example 2: Show installed voices.

 

This example will show you which voices are currently installed on your Computer. You find these voices inside the variable $$TXT.

 

'*****************************************************

' EXAMPLE 2: SAY.

'*****************************************************

' Which Voices are installed?

' Print a List with all installed voices

SAY. {voices}|$$TXT

DBP.$$TXT

ENR.

 

 

Example 3: Check if a specified voice is installed.

 

To check whether a voice is installed or nut, just use the IVC.-command for this variable.

 

'*****************************************************

' EXAMPLE 3: SAY.

'*****************************************************

' Check whether a defined Voice is available or not

'

SAY. {voices}|$$TXT

IVC.$$TXT=Sam

 SAY. Sam is available|w

ELS.

 SAY. Sam is not available|w

EIF.

ENR.

 

 

Example 4: Recite a file.

 

'*****************************************************

' EXAMPLE 4: SAY.

'*****************************************************

'  You need a file name "text.txt" containing

' an english text on your desktop

'

: $$TXT=?desktop\test.txt

'

' Choose speaker voice

SAY.{voice Sam}

'

' Make robot not to speak Punctuation

SAY.{EXPAND 0}

'

' Set Speed to 1, thats a bit faster then normal

{SPEED 1}

'

' Read the content of that file

SAY.{FILE 1}$$TXT|w

'

' Say something .. and wait until all speech has been finished.

SAY. Did you get me?{wait}

ENR.

 

 

Example 5: Repeat parts of your text.

 

This example shows the use of the DO/REPEAT tags. This way you can inline make the Speaker repeat things thousand times without the need to write them thousand times.

Is your computer a blue-screen sinner? Have it repeat that prayer hundred times ... using DO/REPEAT. Don't forget to let it take a {BREATH} after that!

 

'*****************************************************

' SAY.-Sample 5: DO / REPEAT / BREATH Tags

'*****************************************************

: $$TXT=Per default {DO}all Speech runs in the background,{BREATH}{REPEAT 2} while your script continues to do its job.

: $$TXT=$$TXT {BREATH} Using the Tags "DO" and "REPEAT" enables you to inline repeat things multiple times!{wait}

'

SAY.{SPEED 2}$$TXT|w

ENR.

 

 

Example 6: Make it important.

 

The following example shows you how you can stop a on going speech using the STOP-Tag.

Also it shows how a PRIO 2-Speech will be spoken before a PRIO zero speech has ended.

 

'-----------------------------------------------------------

' SAY.-Sample 6: PRIO / STOP

'-----------------------------------------------------------

: $$TXT=Per default {DO}all Speech runs in the background,{REPEAT 5} while your script continues to do its job.

: $$TXT=$$TXT Using the Tags "DO" and "REPEAT" enables you to inline repeat things multiple times!

'

SAY.{SPEED 2}$$TXT

PAU.2

SAY.{PRIO 2}We stop it now!{wait} {STOP}

ENR.

 

 

Example 7: Recite a text from A WEB-site or dialog.

 

The following example shows you how you can make the robot to read a part of a WEB-site.

You just need to set the Actual Point (see MAP. - Move Active Point).

The Robot will try to read the text at that place.

 

'-----------------------------------------------------------

' SAY.-Sample 7: RECITE

'-----------------------------------------------------------

' Will not really work because the news pages change often!

' This is just an example

'

' Locate the new-web-site in the Internet Explorer

' Don't try with Google Chrome or Opera, this will not work!

'

STW.ct|IEFrame|FOCUS Online - Nachrichten - Windows Internet Explorer

SCW.nct|1|Frame Tab|{&NOTEXT:}

SCW.nct|1|TabWindowClass|FOCUS Online - Nachrichten - Windows Interne

SCW.nct|1|Shell DocObject View|{&NOTEXT:}

SCW.nct|1|Internet Explorer_Server|{&NOTEXT:}

'

' Locate the article on the WEB-Site

'

SAO.rn|42|Christian Wulff

'

' Now have the robot read it for you.

SAY.{RECITE}|w

ENR.

 

 

Important Hint:

The {File} and {LINK} Tag switch the Speech into the selected Mode. After completion, they will automatically be switched off.

 

Important:

 

When the Robot program ends, speech will also be stopped. Therefore use the {wait} tag to make the robot wait for the end of his speech.

 

In case you do not hear anything, check your sound hardware and system sound settings. SAY. will only work, if your computer has working sound-hardware and the system settings for sound output must be made that you will be able to hear something.

 

If you want to select between different voices and languages, see the remarks-section below.

 

 

 

Syntax

 

 

SAY.[P1][|P2]

 

 

Parameter Explanation

 

P1 - (optional) Any text or variables you want the robot to say. If omitted the TOS is taken.

 

P2 - (optional) can be:

 

- "w", if specified the robot will wait until things have been said. If omitted, talking will be in the background.

 

- "r", if specified the robot will talk in RAW mode and ignore any commands in { ...}. Active Flags, Options like the speed and the selected voice will remain active.

 

 

 

Example

 

'*****************************************************

' EXAMPLE: SAY.

'*****************************************************

 

'  You need a file name "text.txt" containing

' an english text on your desktop

'

: $$TXT=?desktop\test.txt

' Choose speaker voice

SAY.{voice Sam}

' Read the textfile

SAY.{EXPAND 0}{SPEED 1}{FILE 1}$$TXT|w

SAY. Did you get me?{wait}

ENR.

 

 

 

Remarks

 

Internally SAY. uses the Windows TTS (Text-To Speech Engine). Per default it may support only one voice, thats the gold old "Microsoft Sam". Under Windows 7, it may be another voice. Now, how can you find out which "voices" are available on your system?

 

Use this script:

 

' Which Voices are installed?

SAY. {voices}|$$TXT

DBP.$$TXT

ENR.

 

What you see is maybe just one speaker/voice, for example (WinXP):

 

01  Microsoft Sam

 

and he has a pure english voice that may really sound a bit like an robot.

 

You can however make your computers speak german and french as well and get other voices. Amongst other offers, you can install the MS-Reader:

 

1. MS-Reader Downloadlink

 

and then install the

2. Microsoft Text-to-Speech Package

 

There are multiple available for different languages. You can install all of these to get multiple additional speakers.

 

Now if you run the same script again, it may look somehow like this:

 

01  Microsoft Sam

02  LH Pierre

03  LH Stefan

04  LH Veronique

05  LH Anna

 

Now you can choose another voice using the voice of Stefan:

 

' Select Voice

SAY.{voice 03}

SAY."Hallo Matthias!{wait}"

ENR.

 

using the number 03 or you can choose by name:

 

' Select Voice

SAY.{voice Stefan}

SAY."Hallo Matthias!{wait}"

ENR.

 

Note that when choosing by name, that the second name is used, the first name must not be specified. "{voice LH Stefan} will not work. You have to drop the "LH" and just write {VOICE Stefan}.

 

 

 

 

Limitations:

 

-

 

 

See also:

 

    DBP - Debug Print

    DBM. - DeBugMode

    DIP. - Delayed Instruction Processing

    USM - Use silent Mode

    DMP. - Dump internat Informations