Part I: Developing Inbound Applications: Text-to-Speech/Audio Prompt | Gateway Tutorial

There are two types of prompts in VoiceXML:

1. Prompt using text-to-speech
2. Prompt using pre-recorded audio message

The message between <block> and </block> in our timeofday example is the first type. The gateway reads in the text and automatically converts it to speech and plays it over the phone.

It is usually nice to have a pre-recorded audio message if the message does not change. The rest of this section shows how to do this.

Please note that the voice generated by the default Microsoft TTS engine is robotic and very hard to understand. You should use Voicent Natural Text-to-Speech engine for commercial use.


1. Record and Save an Audio File

Use any recording tool, such as the Sound Recorder, to record your message. Make sure to save it using the correct audio format suitable for telephone. Voicent Gateway only supports "PCM 8 KHz, 16 bit, mono" wave format.

Create a sub-directory under <tddir>/webapps/audio, and save your recording as welcome.wav.

For commercial products, it is strongly recommended that you use professional recording studio to create your audio prompts. The sound quality recorded by a regular computer microphone is usually poor, as you can tell from the wave files included in the sample code.


2. Change your VXML File
                    <?xml version="1.0"?>
                    <vxml version="1.0">
                        <form id="td">
                            <block>
                                <audio src="audio/welcome.wav"/>
                            </block>
                        </form>
                    </vxml>
                

3. Call In To Check Your New Time of Day Service

Now instead of hearing the text-to-speech voice, you should hear your own recording.

Download the sample code: timeofday_step2.zip.