Last reviewed: 3/23/2024 10:49:06 AM
<backgroundaudio>
The backgroundaudio element adds background audio to SSML documents or mixes an audio file with text to speech. The audio file may loop in the background, fade in at the beginning of text to speech, and fade out at the end of text to speech.
If the background audio provided is shorter than the text to speech or the fade out, it loops. If it is longer than the text to speech, it stops when the fade out has finished.
Only one background audio file is allowed per SSML document.
<?xml version="1.0"?>
<speak version="1.0"
xmlns="http://www.w3.org/2001/10/synthesis"
xmlns:mstts="https://www.w3.org/2001/mstts"
xml:lang="en-US">
<mstts:backgroundaudio src="https://contoso.com/sample.wav" volume="0.7" fadein="3000" fadeout="4000" />
<voice name="en-US-JennyNeural">
The text provided in this document will be spoken over the background audio.
</voice>
</speak>
Attributes
src
The URI location of the background audio file.
volume
Optional. The volume of the background audio file. Accepted values: 0 to 100 inclusive. The default value is 1.
fadein
Optional. The duration of the background audio fade-in as milliseconds. The default value is 0, which is the equivalent to no fade in. Accepted values: 0 to 10000 inclusive.
fadeout
Optional. The duration of the background audio fade-out in milliseconds. The default value is 0, which is the equivalent to no fade out. Accepted values: 0 to 10000 inclusive.
Children
none