Fallback to text to speech if your audio fails
Here’s a quick tip that’s an answer to a common question: What happens if my audio file cannot be played?
If you provide the URL to an audio file in Tropo’s
sayfunction Tropo will fetch it and play it. But what if you have a mistake in your URL? Or your server is down? You can use the W3C standard SSML to provide a text to speech (TTS) fallback and prevent your callers from getting dead air.Say you have an application that starts out like this:
<?php say('http://example.com/welcome.wav'); ?>Tropo will play welcome.wav if it can reach the file.
Now I’ll use a little SSML to provide a TTS string to play if your file isn’t available:
<?php say('<speak><audio src="http://example.com/welcome.wav">This text will be spoken if the audio file can not be played.</audio></speak>'); ?>Just another example of how Tropo makes the easy stuff easy while still making it possible to do most anything.
©2011 The Tropo Blog. All Rights Reserved.
.Related posts:
Originally from All Voxeo Blogs Feed

Leave a Reply