This example shows how to have audio play as a background whilst text to speech is active. This has the benefit of psychologically ‘smoothing out’ the quirks of text to speech, thereby increasing the perceived quality.
This is example code to add anywhere in the page you would like the button to appear.
Let’s Compare
1 |
<audio loop="false" width="0" height="0" id="sound" src="http://responsivevoice.org/wp-content/uploads/2015/06/Peppy-The-Firing-Squad_YMXB-160.mp3" type="audio/mp3" ></audio> |
1 2 3 4 5 |
<button class="butt js--triggerAnimation" onclick="responsiveVoice.speak('This example shows how to have audio play as a background whilst text to speech is active. This has the benefit of psychologically smoothing out the quirks of text to speech, thereby increasing the perceived quality. '); document.getElementById('sound').play();" type="button" value="Play">Play With Background Music</button> |
Keywords: background music, text to speech tricks
Audio Source: http://sampleswap.org/mp3/song.php?id=105