| VoiceXML 2.1 Development Guide | Home | Frameset Home |
| expr | Data Type: CDATA | Default: Optional |
| The expr attribute is used when we want to use a generated value rather than an explicit URI for our audio file’s destination. The value for this variable must equate to a valid audio URI, else the content will not be executed. | ||
| fetchhint | Data Type: (prefetch|safe) | Default: prefetch |
Fetchhint is used to specify when the resource should be fetched during application execution. The possible values and their descriptions are:
Note that the Voxeo platform will always prefetch content, regardless of what this attribute value is set to. As such, specifying a value is somewhat redundant. | ||
| fetchtimeout | Data Type: CDATA | Default: 5s |
| The ‘fetchtimeout’ attribute is used to indicate how long, (in seconds or milliseconds), the interpreter should attempt to fetch the file in question before reverting to any backup TTS, (if present), or before the application execution skips over the contents of the <audio> tag, (if no backup TTS is present). Also note the strict formatting of this value; if specified, the time value must have the ‘s’ denomination appended to it, else an error.badfetch is thrown. | ||
| maxage | Data Type: CDATA | Default: Optional |
| The maxage and maxstale attributes replace the VXML 1.0 caching attribute for compliance to the w3c vxml 2.0 specification. The value for this attribute specifies the maximum acceptable age, in seconds, of the resource in question. However, it is strongly advised not to rely on this attribute for cache-control; caching is always best controlled by the hosting server's response headers. If no headers are specified, then no cache control will be present, regardless of the value set for the maxage and maxstale attributes. | ||
| maxstale | Data Type: CDATA | Default: Optional |
| The maxage and maxstale attributes replace the VXML 1.0 caching attribute for compliance to the w3c vxml 2.0 specification. The value for this attribute specifies the maximum acceptable staleness, in seconds, of the resource in question. However, it is strongly advised not to rely on this attribute for cache-control; caching is always best controlled by the hosting server's response headers. If no headers are specified, then no cache control will be present, regardless of the value set for the maxage and maxstale attributes. | ||
| src | Data Type: URI | Default: Optional |
| The ‘src’ attribute specifies a URI pointing to a valid audio file for your application to play. Ex: <audio src=”MyServer/MyDir/MyFile.wav”/>; | ||
| <?xml version="1.0" encoding="UTF-8"?> <vxml version = "2.1"> <meta name="author" content="Matthew Henry"/> <meta name="copyright" content="2005 voxeo corporation"/> <meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/> <form id="F_1"> <block> <prompt> here we use the audio fetchhint attribute with the value of prefetch. </prompt> <audio src="MySoundFile.wav" fetchhint="prefetch"/> <prompt> here we use the audio fetchhint attribute with the value of safe. </prompt> <audio src="MySoundFile.wav" fetchhint="safe"/> </block> </form> </vxml> |
| <?xml version="1.0" encoding="UTF-8"?> <vxml version = "2.1"> <meta name="author" content="Matthew Henry"/> <meta name="copyright" content="2005 voxeo corporation"/> <meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/> <form id="F_1"> <block> <prompt> here we use the audio fetch time out attribute with the value of 10 seconds. </prompt> <audio src="MySoundFile.wav" fetchtimeout="10s"/> </block> </form> </vxml> |
| <?xml version="1.0" encoding="UTF-8"?> <vxml version = "2.1"> <meta name="author" content="Matthew Henry"/> <meta name="copyright" content="2005 voxeo corporation"/> <meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/> <form id="F_1"> <block> <prompt> here we demonstrate the max age and max stale attributes. </prompt> <audio src="MySoundFile.wav" maxage="500" maxstale="1000"/> </block> </form> </vxml> |
| <?xml version="1.0" encoding="UTF-8"?> <vxml version = "2.1"> <meta name="author" content="Matthew Henry"/> <meta name="copyright" content="2005 voxeo corporation"/> <meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/> <form id="F_1"> <var name="AudioVar" expr="'MyAudioFile.wav'"/> <block> <prompt> here we use the audio expression attribute rather than a URI for our audio file. </prompt> <audio expr="AudioVar"/> </block> </form> </vxml> |
| ANNOTATIONS: EXISTING POSTS |
Asier
|
|
| Hello there,
If there are several .wav files, and i call at the same file in several parts in the document, how many times fetch the resource with the fetchhint="prefetch"? Thanks in advance, Asier |
|
steve.sax
|
|
|
Hello Asier, Note that resources are prefetched by default, so this does not need to be explicitly set in your <audio> tag. Also note that this attribute setting doesn't really have anything at all to do with how many times a file will be fetched at all. As such, if you reference a file 3 times, then it will be fetched 3 times from your server. It is our advice that any audio files be cached on the server in order to reduce any chances of a fetch delay at all; please review the below link for details on setting cache headers: http://www.voicexmlguide.com/caching.htm Steve Sax |
|
safarishane
|
|
| Hey, you have both the src and expr attributes listed as optional, but in practice isn't one or the other required? Skipping both will cause a badfetch, according to the spec:
"Exactly one of "src" or "expr" must be specified; otherwise, an error.badfetch event is thrown." |
|
mikethompson
|
|
| Hey Shane,
I think that the documentation could be a little more clear here, but let me explain why they both say optional... *If* you embed text to speech from within your audio tag (ex: <audio>Simma Down Nah</audio>) it essentially works as a <prompt> element in that sense. This will prevent a badfetch from being thrown. Regards, Mike Thompson Voxeo Extreme Support |
|
yana
|
|
| Hello,
Do I have option to catch <error> event if <audio> element trying to play file that not found? Thanks Yana |
|
Michael.Book
|
|
| Yana,
As per the VoiceXML specification: "If the audio file cannot be played and the content of the audio element is empty, no audio is played and no error event is thrown." Best, ~ Michael |
|
yana
|
|
| Michael.
Thanks for you facilitation. I have one more question. I need to call anothe vxml after end of play. I tried to use <submit> element after prompt like this: <form id="F1"> <field name="playPrompt"> <prompt><audio src="2.wav"/></prompt> <filled> <submit next="second.vxml" method="post"/> </filled> </field> </form> But it doesn't work, the function POST is not be called. What I need to do to call it after End-Of_Play? Thaks, Yana |
|
jbassett
|
|
| Hello,
http://docs.voxeo.com/voicexml/2.0/submit.htm has good information on submit usage. If you simply want to transition to a new document at the end, you can use the <goto> element. The submit section I linked will also show you some variable passing examples as well. Thanks Jesse Bassett Voxeo Support |
|
yana
|
|
| Hello,
I am sorry, I asked question not cleare. I need to get some indication that play is ended. I tried: <block> <prompt><audio src="2.wav"/></prompt> <submit next="123456.vxml" method="post" namelist = "param"/> </block> In ethereal I see that the next document is reading simultaneously with play, not after. Is the next document is calling after play is ended? Moreover, I see that this vxml call to GET of 123456.vxml, not POST as I expected. Thans, Yana |
|
mikethompson
|
|
| Yana,
Regardless of what you're seeing in your ethereal trace, the audio should complete before transitioning to the next document. Also, the real-time debugger in the evolution environment is the best way to troubleshoot application issues like this. By placing a call into your application with this debugger open, it will be very easy to follow the call. If you ever experience problems with the call flow, you can submit the exact call example/debug output to us via the "support" tab at the top of the debugger page. Anyway, in your case: <block> <prompt><audio src="2.wav"/></prompt> <submit next="123456.vxml" method="post" namelist = "param"/> </block> The VoiceXML browser will complete the audio file before transitioning control to 123456.vxml. Best, Mike Thompson Voxeo Corporation |
|
sildev6
|
|
| Hello,
I have a wav file which has a Spanish accented character in its name and when I specify this wav file name in the "src" attribute, it fails to find it. For example, the wav file is "jose.wav", where "o" is the accented character. Does the <audio> tag handle such characters? Do I need to do anything special to handle such characters? Thanks! |
|
voxeojeff
|
|
| Hello,
The <audio> tag does indeed support accented characters, as long as the audio files are properly formatted. The trick is to use URL encoding when referencing the file. For example, if you had a file named "jóse.wav" and wanted to reference it correctly, you would use <audio src="j%C3%B3se.wav"/> with "%C3%B3" being the URL encoding that our hosted platform needs to produce an "ó" character. An easy way to figure out what encoding you'll need is to check the URL (copy link location) of the actual audio file that is located in your "Account > Files, Logs, Reports" folder in your Evolution account. Cheers, Jeff Menkel Voxeo Corporation |
|
sildev6
|
|
|
Thanks Jeff! But how can I do this encoding programmatically? Do I need to define any encoding attributes in the <audio> tag? Our application supports all the spanish accented characters, so I have to be able to dynamically encode the wav file name when I construct the audio tag. Thanks! |
|
MattHenry
|
|
|
Hi there folks, To be clear, we can't really specify any encoding attributes via the audio tag, as the spec simply doesn't define any, and as such, we don't support them. My first suggestion would be to make use of some "regexpr" action in your dynamic code, where you can generate the encoded values of any foreign characters that you might need to output within the <audio> element. Hope this helps, ~Matthew henry |
|
sildev6
|
|
| Hello,
When you say, "..you would use <audio src="j%C3%B3se.wav"/> with "%C3%B3" being the URL encoding that our hosted platform needs to produce an "ó" character" - is this UTF-8 encoding? If so, I would need to use the UTF-8 representation of the file name in the <audio> tag, is that right? Thanks! |
|
MattHenry
|
|
|
Hi again, This is correct. In my experience, any and all foregin characters that need to be encoded should be using the UTF-8 document encoding. ~Matt Henry |
|
lambchops7
|
|
| I thought I read this somewhere, but I can't find it anymore. How do you limit the input so that an audio file reads out uninterrupted in its entirety before a user is ALLOWED to enter input. I guess I could make a few booleans and when boolean is true then you can enter input, but is there a built in property, etc?
thanks. |
|
mikethompson
|
|
| Hi there,
What you're after is the bargein property. The 'bargein' property controls whether or not the TTS or audio prompts may be interrupted by a caller's voice input. This property defaults to 'true', unless specified. It looks like this: <property name="bargein" value="true|false"/> Hope this helps, Mike Thompson Voxeo Corporation |
|
bronson
|
|
| Is there a way to skip the beginning of an audio file? Something like <audio src="MySoundFile.wav" start-at="17s">? | |
voxeojeff
|
|
| Hi bronson,
Unfortunately, there aren't any attributes which allow you to start at a certain point in an audio file. If you wish to start at say, the 17 second mark, you should crop the audio file with an editing program (such as GoldWave) so that it begins at the desired point. Regards, Jeff |
|
sharath.chandra
|
|
| Hi, i want to play an audio file repeatedly.
my audio file is in .wav format and plays for about 5 seconds but i want to play it for 2-3 minutes repeatedly. how can i do that ? |
|
mikethompson
|
|
| Hello Sharath,
You can use the the <foreach> element to build an array of audio file names (all the same in your case), then looping as many times as you want. Here's a snippet for your convenience: <script> var arrayList = ["1.wav", "1.wav", "1.wav", "1.wav", "1.wav" ]; </script> <prompt> Let's loop some audio files shall we? <break/> </prompt> <foreach item="audioloop" array="arrayList"> <prompt> <audio expr="audioLoop"/> <break/></prompt> </foreach> Best, Mike Thompson Voxeo Corporation |
|
bronson
|
|
| Thanks Jeff. I'll see if I can automate the .wav slicing.
Another question: is it possible to pause and resume playback of a wav file? My app needs to read a lot of numbers off to the user; it would be nice if the user could say "pause" when he's falls behind and "play" or "resume" when he's caught up again. |
|
voxeojeff
|
|
| Hello bronson,
The ability to pause and resume playback of an audio file is not something that is currently possible in the VoiceXML specification. This can however be done with some clever server side logic that will rely on tracking the .wav bit files and manipulating it to move through the recording. While we don't have any examples of this being done, some of our customers have been able to accomplish this. Please let me know if this helps clarify things for you, as well if you have any additional questions. Regards, Jeff |
|
crishvi
|
|
| hello,
Suppose my audio file's length is 15s and i wanted to play this file only for the time required to fetch data for the caller's query.How can i do this since the time taken to retrieve data may differ each time???please respond asap.thanks |
|
voxeojeff
|
|
| Hello,
In this case, if you're submitting to a database and waiting on content retrieval, you can use the 'fetchaudio' attribute within the <submit> tag to play some filler music while the fetch is being made. Is this what you were essentially looking to do? http://docs.voxeo.com/voicexml/2.0/submit.htm Hope this helps, Jeff |
|
soguz
|
|
| Hi,
I am trying to play a wave file in different directory than where my vxml files are. For example: c:\vxml\ is where my vxml files and the wave file is in c:\test\1.wav. When I try to use <audio src="c:\test\1.wav" />, it is not playing the wave file. Do I always have to use virtual directory for src to play audio files? How can I make audio tag play wave files on my local directory or network directory? Thank you in advance. |
|
VoxeoDante
|
|
| Hello soguz,
If you would like to play an audio file on a local Prophecy installation, you should put the file in the c:\program files\voxeo\www directory. This is the web server directory for the Prophecy server. You can also specify a URL for audio files if you wish to fetch them from a remote location. <audio src="http://www.mysrver.com/audio/test.wav"/> Or you could replace the hostname with an IP if you like. <audio src="http://127.0.0.1/audio/test.wav"/> If your audio was located in the www directory and your VXML was in www/vxml you could go back one directory in the src. <audio src="../test.wav"/> I hope this helps. Regards, Dante Vitulano Extreme Support |
|
deepak
|
|
| Hi,
I have three different .wav to be played.Suppose i say skip after first .wav file it should go to second .wav file.But there is a problem .Its not going to second .wav file.Kindly suggest me how to go about this? I have added this .Wav files in While loop. Kindly tell me does <catch > element support scriptlets. |
|
VoxeoDustin
|
|
| Hey Deepak,
Would you mind opening an account ticket with your code so we can take a look and try to reproduce the issue you're seeing? To open an account ticket, click the ACCOUNT tab at the top select Support Tickets and click Open New Account Ticket. Cheers, Dustin |
| login |