Home > Articles > Web Services > XML

  • Print
  • + Share This

Simple Voice Greeting card

Let’s begin the introduction to VoiceXML with a simple example application: a voice greeting card that you might want to customize for a friend or relative. In upcoming articles we’ll expand our knowledge of VoiceXML with more complex applications. But for now, let’s start simply with a voice birthday greeting.

Listing 1 Simple VoiceXML greeting card

1 <vxml version = "2.0" >
2 <form>
3  <block>
4   Happy Birthday to you. Happy Birthday to you.
5   Happy Birthday from an electronic friend.
6   Happy Birthday to you. <break/> Have a fabulous birthday
7  </block>
8 </form> 
9 </vxml>

In line 1, you see the top-level vxml element that is required for all vxml documents. The vxml element contains a single form element. The form element is the vxml workhorse element that is found in practically every vxml document. In this example, the form contains a single block element containing the happy birthday text that the VoiceXML server will convert to speech.

When working with text-to-speech, it’s important to remember that the speech synthesizer cannot insert meaningful pauses unless prompted to do so. In VoiceXML, the appearance of a comma or period in the text will result in a slight pause. Finer control is possible with the insertion of a <break/>, as in line 6. To orchestrate a pause of a specific duration, provide a time attribute to specify a pause in milliseconds.

For example, results in a speech break of 200 milliseconds:

<break time="200"/>

The break element also supports qualitative options of small (500 msecs), medium (1 second), and large (2 seconds), as in the following:

<break strength="medium"/>

The insertion of breaks goes a long way toward making a synthesized voice sound very human.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.