Condividi tramite


type Attribute

  Microsoft Speech Technologies Homepage

Specifies the type of audio file used to contain the recorded speech. Optional.

<record type=audioType />

Remarks

The following audio types are recognized as valid for the type attribute.

Type Description
audio/basic Headerless 8Khz 8-bit mono, 8Khz 8-bit mono (PCM) single-channel compressed audio based on the telephony standard of the locale where it is used. This can either be a-law or u-law.
audio/wav 8Khz, 8-bit mono (PCM) single-channel compressed audio based on the telephony standard of the locale where it is used. This can either be a-law or u-law. This is the default for telephony applications.
audio/x-wav 16Khz PCM, 22Khz PCM, 8Khz PCM. This is the default type for multimodal applications.

Multimodal applications use higher sample rates to gain higher recognition accuracy.

Example

The following code demonstrates the use of the type attribute.

<html xmlns:salt="http://www.saltforum.org/2002/SALT">
  <head>
    <object id="Speechtags" CLASSID="clsid:DCF68E5B-84A1-4047-98A4-0A72276D19CC" VIEWASTEXT></object> 
  </head>
  <body onload="RunAsk()">
    <?import namespace="salt" implementation="#SpeechTags" />
    <form id="f1" action="http://www.woodgrovebank.com/savewaveform.aspx" method="get">
      <input name="vmail" type="hidden" />
    </form>
    
    <table cellspacing="0" cols="2">
      <tr>
        <td>Recording duration:</td>
        <td><input id="iptRecDur" type="text"  size="50"></td>
      </tr>
      <tr>
        <td>Recording location:</td>
        <td><input id="iptRecLoc" type="text" size="50"></td>
      </tr>
      <tr>
        <td>Recording size:</td>
        <td><input id="iptRecSize" type="text" size="50"></td>
      </tr>
      <tr>
        <td>Recording type:</td>
        <td><input id="iptRecType" type="text" size="50" ></td>
      </tr>
</table>

    <salt:prompt id="p_record" oncomplete="l_recordvm.Start()">
      Please speak after the tone. You may press any key to end your recording.
    </salt:prompt>
    <salt:prompt id="p_save">
      Do you want to save this recording?
    </salt:prompt>

    <!-- Recording session - max 60 seconds recording -->
    <salt:listen beep="true" id="l_recordvm" initialtimeout="3000" endsilence="1500" babbletimeout="60000"
     onreco="saveAudio()" onnoreco="saveAudio()" onsilence="RunAsk()" >
      <salt:record type="audio//x-wav" />
    </salt:listen>

    <!-- listen for capturing whether user wants to save voice mail -->
    <salt:listen id="l_save" onreco="processSave()">
      <salt:grammar name="yesno"> 
        <grammar version="1.0" tag-format="semantics-ms/1.0" lang="en-US" 
        xmlns="http://www.w3.org/2001/06/grammar" root="root">
          <rule id="root">
            <ruleref uri="#yesno" />
          </rule>
          <rule id="yesno">
            <one-of>
              <item>Yes</item> 
              <item>No</item> 
            </one-of>
          </rule>
        </grammar>
      </salt:grammar>
    </salt:listen>      
      
    <script language="JScript">
    <!--
      function RunAsk() {
        p_record.Start();
      }
      // Ask user if they are satisfied with their recording
      function saveAudio () {
        showRecDetails();
        p_save.Start();
        l_save.Start();
      }
      // If user is satisfied post file name back to web server
      // otherwise start again
      function processSave () {
        smlResult = event.srcElement.recoresult;
        saidText = smlResult.selectSingleNode("/").text;
        if (saidText == "Yes") {
          alert("Recording has been saved at " + l_recordvm.recordlocation);
        } else {
          alert("Recording will not be saved.");
        RunAsk();
        }
      }

      function showRecDetails() {
        iptRecDur.value=l_recordvm.recordduration + " milliseconds";
        iptRecLoc.value=l_recordvm.recordlocation;
        iptRecSize.value=l_recordvm.recordsize + " bytes";  
        iptRecType.value=l_recordvm.recordtype;
      }
    -->  
    </script>
  </body>
</html>

See Also

record Element