<nuance:recordasync-start>

Starts asynchronous recording of audio samples.

Asynchronous recording runs as executable content, which allows a VXML application to start a background recording while simultaneously executing other inputs, such as ASR or DTMF key input, using the <field> element. Asynchronous recording runs until the <nuance:recordasync-stop> element stops it or an attribute, such as maxtime or finalsilence, causes it to terminate. In comparison, the <record> element records synchronously and runs as a form item. Form items require that the recording must complete or input conditions must be satisfied before the VXML application can execute other inputs, which blocks these other inputs from executing simultaneously.

How to use:

  1. Start the recording.
  2. Stop the recording. The output is a URL file or transfer encoded object that is not playable.
  3. Submit the output to a web server and use server-side code (for example,JSP) to save the recording in a playable format.

Attributes

This section describes the attributes you can set for this element.

Name

Data type

Default

captureonspeech

(true | false)

false

finalsilence

CDATA

optional

maxtime

CDATA

optional

timeout CDATA optional
transferencoding CDATA optional

type

CDATA

audio/basic

Note: The dest and desexpr attributes, which are Nuance extensions that specify a destination URL for recordings, are not supported. Use the <submit> or <data> elements to send asynchronous recordings to a server.

captureonspeech

The captureonspeech attribute specifies whether to the recording immediately or wait for the end-pointing functionality to detect speech.

Valid values are:

  • false: Start recording immediately (default)
  • true: Wait until speech is detected

finalsilence

The finalsilence attribute specifies the duration, in milliseconds, of silence that indicates end of speech.

maxtime

The maxtime attribute specifies the maximum duration of a recording. You can specify either seconds ("10s") or milliseconds ("10ms"). If you only specify a numeric value ("10"), it defaults to milliseconds.

timeout

The timeout attribute specifies the time duration before ending the recording when no speech input is detected. The value can be in seconds or milliseconds. You can also specify the timeout as a property. For example:

<property name="timeout" value="12s" />

If you do not specify a timeout, the VXML application defaults to the Speech Server timeout of 5 seconds. See "Controlling speech processing" in the Speech Suite documentation.

transferencoding

The transferencoding attribute specifies how to encode data during transfer over MRCP. It instructs the MRCP server to encode the data based on the included Content-Transfer-Encoding header and return the content in the MRCP message body—no recording file is created. If not specified, a recording file is created.

Valid values are:

  • 8bit (typical for binary data)
  • base64

type

The type attribute sets the MIME type of the recorded file. You specify the value with the recordutterancetype property.

Valid values are:

  • audio/basic
  • audio/x-alaw-basic
  • audio/L16
  • audio/x-wav
  • audio/x-nist

Children

None

Parents

Sample code

This sample code shows an application implementation. It specifies the following:

  • Start the asynchronous recording, using transfer encoding.
  • Enter a form field input that consumes ~4 seconds of the recording.
  • Exit the form input.
  • Stop the recording and, if the size is greater than 0 bytes, send the transfer-encoded data to a web server.
<vxml>
    <form id="f1">
        <block>
            <nuance:recordasync-start timeout="60s" maxtime="60s" transferencoding="8bit"/>
            <goto next="#f2"/>
        </block>
    </form>
   
    <form id="f2">  
        <field name="yesno">
            <grammar src="builtin:grammar/boolean"/> 	
            <prompt bargein="false" timeout="1s">
            Play a short prompt, no more than 4 seconds, to generate a small recording.
            </prompt>
            <catch event="noinput nomatch filled">
                <goto next="#f3"/>
            </catch>
        </field>
    </form>
    
    <form id="f3">
        <block>
            <nuance:recordasync-stop name="tap"/>           
            <if cond="tap$.size &gt; 0">
                <data name="tapanalysis" namelist="tap" src="analyze_tap.pl"
                    method="post" enctype="multipart/form-data"/>
            <else/>
                <prompt>Cannot post recording, since there is no recorded data.</prompt>
            </if>
         </block>
     </form>
</vxml>