The very first thing you must do (after registering the Rexx Speech functions, if needed), is to choose a voice (ie, speech device). There may be several different voices to choose from on a given computer, each having its own dialect (ie, you can get speech engines that speak in different languages, and/or have different native accents -- you need to match the engine with your text, so for example, if you're trying to speak text written in french, you should use a french speech engine), sex, etc.
If you wish to present a list of all the available speech engines on the computer, and let the user choose one of them, then you can call SpeechVoiceDlg(). This presents a listbox with the names of all speech engines installed upon a given computer. As the user clicks upon a name in the list, further information about that speech engine is also displayed. When the user selects one and clicks on the OK button, then SpeechVoiceDlg() returns the ID of that engine, which you will later use to open/initialize that particular engine.
But if desired, you can simply use the default speech engine upon a given system. In that case, you do not need to call SpeechVoiceDlg() nor need to know any particular speech engine's ID.
Next, you must open/initialize the desired speech engine for use. This need be done only once, by calling SpeechOpen(). Either pass the ID you got from SpeechVoiceDlg(), or do not pass any ID in which case SpeechOpen() will automatically use the default speech engine (whatever it is) on a given computer. The speech engine will be initialized with default volume, speed (ie, the pace at which the voice speaks the text), and pitch of the voice. If successful, then SpeechOpen() will return a voice parameter that you must save, and later will pass to other REXX Speech functions that you'll call. When calling SpeechOpen(), you can optionally provide further information about any window you wish notified when a particular text phrase has started, and also stopped, speaking. This is useful if you need to synchronize something with some speech that may be sounding in the background while your script goes on to do something else. Otherwise, if you do not need to do something else while the engine is speaking, and/or do not need to be notified when some text starts/stops speaking, then you do not need to supply this optional information to SpeechOpen().
After successfully opening/initializing the speech engine, you may call numerous other functions to change the volume/speed/pitch, and speak text.
You may call SpeechVolume() to change the volume. You may call SpeechPitch() to change the pitch. And SpeechSpeed() can change the speed. All of these will be passed that voice parameter returned by SpeechOpen(). (Of course, you're not required to change volume, speed, and pitch. You can simply use the defaults set by SpeechOpen()).
When you wish to speak some text, you call SpeechSpeak(). This is passed that voice parameter returned by SpeechOpen(), and also the text that you wish spoken. This text may contain any amount of words, sentences, etc. SpeechSpeak() will fully speak the text (using the speech engine's synthesized voice through the computer's sound card), and then return.
Alternately, you can have SpeechSpeak() return before the text is spoken, and your script can go on to do other things while the speech goes on the background. This is referred to as "asynchronous" operation. You indicate you wish this by passing an extra 'A' argument to SpeechSpeak(). But in order to take advantage of this feature, you must be using a GUI add-on such as Rexx GUI. See the notes under SpeechSpeak.
When you're finally done using the speech engine, you must call SpeechClose() once, passing that voice parameter returned by SpeechOpen(). This will free up the speech engine.
Note: REXX Speech automatically keeps track of all of the engines your script opens, and when your script terminates, if you have left any open, then REXX Speech will automatically close them. But, it is a good policy to close any engine as soon as you're finished with it.