"audio" Element
Description
The audio element supports the insertion of recorded audio files in conjunction with synthesized speech. The audio element may be empty. If it is not empty, the contents should be marked-up text to be spoken if the specified audio document is not available.
If the referenced audio file is accessible, it plays. Otherwise, the alternate text (if specified) is rendered.
Syntax
<audio src="src">
child elements
</audio>Attributes
| Attribute | Description |
| src | Points to the location of the audio file. Mandatory field. |
Parent
<audio>, <emphasis>, <p>, <prosody>, <s>, <speak>, <voice>
Children
<audio>, <break>, <desc>, <emphasis>, <mark>, <p>, <phoneme>, <prosody>, <say-as>, <sub>, <s>, <voice>
Limitations/Restrictions
The value of the src attribute may refer to an HTTP/HTTPS URL (e.g. "https://media.example.com/audio/prompt.wav") or a local filepath (e.g. "/opt/audio/prompt.wav").
The audio file format must be 16-bit 16 KHz PCM format only. The platform internally converts the file as needed to the target format.
If the referenced audio file cannot be accessed, the alternate child content is rendered. If the referenced audio can be accessed, it plays and the alternate text is not used.
The value of src is affected by the <speak> element's xml:base attribute.
For example, if the <speak> element's xml:base attribute is "https://media.example.com/audio" and the <audio> element's src is "test.pcm", the resolved audio file path is "https://media.example.com/audio/test.pcm".
To prevent the src value from being affected by the <speak> element's xml:base, use an absolute URL — e.g. "https://media.example.com/path/to/audio.wav".
If the <speak> element's xml:base attribute value is "https://media.example.com/audio" and the <audio> element's src is "@https://media.example.com/audio2/test.pcm", the referenced audio file resolves to "https://media.example.com/audio2/test.pcm".
Example
<?xml version="1.0"?>
<speak version="1.0"
xmlns="http://www.w3.org/2001/10/synthesis"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/10/synthesis
http://www.w3.org/TR/speech-synthesis/synthesis.xsd"
xml:lang="en-US"
xml:base="https://media.example.com/audio/">
<!-- Empty element -->
Please say your name after the tone. <audio src="beep.wav"/>
<!-- Container element with alternative text -->
<audio src="prompt.pcm">What city do you want to fly from?</audio>
<audio src="welcome.wav">
<emphasis>Welcome</emphasis> to the Voice Portal.
</audio>
</speak>