To allow the user to browse through a list of available speech engines on the computer and choose one, you can call SpeechVoiceDlg(). This presents a listbox with the names of all speech engines installed upon a given computer. 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. Here then is an example that presents the "Pick a speaking voice" dialog, and saves the returned speech engine ID:
/* Get user's choice of speech engine, and save its ID. */
id = SpeechVoiceDlg()
IF id == "" THEN DO
   SAY "Error getting speech device ID, or user cancelled"
   RETURN
END
If the user selects a particular engine (ie, he didn't cancel, nor was there an error), then SpeechVoiceDlg() returns the id that you will pass to SpeechOpen() as so:
/* Get user's choice of speech engine, and save its ID. */
id = SpeechVoiceDlg()
IF id == "" THEN DO
   SAY "Error getting speech device ID, or user cancelled"
   RETURN
END

/* Open that speech engine, and save its voice parameter. */
voice = SpeechOpen(id)
IF voice == "" THEN DO
   SAY "Error opening/initializing the speech voice!"
   RETURN
END

/* Here you may now call other REXX Speech functions. */

If successful, SpeechOpen() will open/initialize that voice and return the voice parameter to it. You may then call other REXX Speech functions, passing that voice parameter.

When done using the speech engine, you should close it with a call to SpeechClose() as so:

/* Close the speech engine. */
SpeechClose(voice)

Opening the default speech device

If you simply wish to open and use the default speech device on a system (instead of making the user choose one), then simply omit the first argument passed to SpeechOpen(). In that case, SpeechOpen() will open/initialize the default speech engine and return its voice parameter as so:

/* Open the default speech engine, and save its voice parameter. */
voice = SpeechOpen()
IF voice == "" THEN DO
   SAY "Error opening/initializing the default speech voice!"
   RETURN
END

/* Here you may now call other REXX Speech functions. */