break element
VoiceXML 2.0
Introduces a specified amount of silence into the audio played back to the user.

Syntax

<break
size = "string"
sizeexpr = "ECMAScript_Expression"
time = "string"
timeexpr = "ECMAScript_Expression"
/>

Attributes
size
One of the following values:
none Indicates no pause.
small Indicates a 200ms pause.
medium Indicates a 500ms pause.
large Indicates a 1000ms pause.
sizeexpr
An ECMAScript expression that evaluates to one of the valid values of the size attribute. This attribute is a Tellme extension.
time
The duration of the pause in seconds (s) or milliseconds (ms), such as "2s", "500ms", or "1.5s." If the units are not specified, the VoiceXML interpreter assumes milliseconds.
timeexpr
An ECMAScript expression that evaluates to a duration equivalent to the time attribute. This attribute is a Tellme extension.

Parents
audio, block, catch, emphasis, enumerate, error, filled, foreach, help, if, noinput, nomatch, p, prompt, prosody, s, voice

Children
None.

Remarks
The break element introduces a pause of n seconds (s) or milliseconds (ms). Use it within prompt element text so that audio sounds more natural.
The size, time, sizeexpr and timeexpr attributes are mutually exclusive.
Examples

In the following example, the caller hears, "Good morning! (1.5 second pause) Welcome to (.5 second pause) News of the Day. (.5 second pause) Tellme! ..."

<?xml version="1.0"?>
<vxml version="2.1"
 xmlns="http://www.w3.org/2001/vxml">
<form>   
   <block>
      <prompt>
      Good morning!
      <break time="1.5s"/>    
      Welcome to 
      <break time="500"/>    
      News of the Day
      <break size="medium"/>
      </prompt>
      <exit/>
   </block>
</form>
</vxml>

The following example plays a list of subjects generated from script. The foreach element iterates through the ECMAScript array of hashes to play back the name of the subject. In addition, the break element is used to pause between subjects. The pause value is included in the ECMAScript hash.

<?xml version="1.0"?>
<vxml version="2.1"
 xmlns="http://www.w3.org/2001/vxml">

   <var name="sAudioBase" expr="'audio/tmu/'"/>
   <var name="sSubjectsBase" expr="sAudioBase + 'subjects/'"/>

   <script><![CDATA[

   // array of subjects for tts
   var aSubjects = ["", "overview", "design", "audio", "development", "tuning"];

   // array of prompt triplets (wav, tts, pause)
   var aPrompts = [
      {"wav" : sAudioBase + "org.wav", "tts" : 
            "The Tellme University classes are grouped by subject." +
            "When you hear the subject you want, just say it to hear the classes offered.", 
            "pause" : "300ms"},
      {"wav" : sSubjectsBase + "sn1c.wav", "tts" : "overview", "pause" : "500ms"},
      {"wav" : sSubjectsBase + "sn2c.wav", "tts" : "design", "pause" : "500ms"},
      {"wav" : sSubjectsBase + "sn3c.wav", "tts" : "audio", "pause" : "500ms"},
      {"wav" : sSubjectsBase + "sn4c.wav", "tts" : "development", "pause" : "500ms"},
      {"wav" : sSubjectsBase + "sn5c.wav", "tts" : "tuning", "pause" : "500ms"}      
   ];

   ]]></script>

   <form id="list_subjects">

   <field name="subject_id">
      <prompt>
         <!-- iterate through each triplet -->
         <foreach item="oPrompt" array="aPrompts">
            <audio expr="oPrompt.wav">
              <value expr="oPrompt.tts"/>
            </audio>
            <break timeexpr="oPrompt.pause"/>
         </foreach>
         <!-- only play the first prompt (org) once -->
         <script>aPrompts.shift();</script>
      </prompt>

      <grammar src="subjects-voice.grxml" mode="voice" type="application/srgs+xml"/>

      <noinput>
         <goto next="#query_repeat_list"/>
      </noinput>

      <nomatch>
         I'm sorry. I didn't get that. 
         Please say one of the following subjects.
         <reprompt/>
      </nomatch>

      <filled>
         You picked
         <!-- the grammar return value is the subject id -->
         <!-- construct the path to the subject and index into the tts array -->
         <audio expr="sSubjectsBase + 'sn' + subject_id + 'c.wav'">
            <value expr="aSubjects[subject_id]"/>
         </audio>
         <exit />
      </filled>

      </field>
   </form>

   <form id="query_repeat_list">
      <field name="yesno" type="boolean">
         <prompt>Do you want to hear this list again?</prompt>
         <catch event="noinput nomatch">
            Sorry. I didn't get that. 
            Please say yes to hear the list again. 
            Say no to return to the main menu
         </catch>
         <filled>
            <if cond="yesno">
               <goto next="#list_subjects"/>
            <else/>
               <exit/>
            </if>
         </filled>
      </field>
   </form>

</vxml>


[24]7 Inc.| Terms of Service| Privacy Policy| General Disclaimers