Freigeben über


babbletimeout Attribute

  Microsoft Speech Technologies Homepage

Specifies the maximum time, in milliseconds, that is allowed for an utterance or recording. Optional.

HTML <listen babbletimeout="timeoutVal">
JScript listen.babbletimeout = "timeoutVal"

Remarks

The babbletimeout attribute limits speech input time when no meaningful sound is detected.

For recognition in automatic and single mode, the babbletimeout attribute applies to the period between the initial speech detection and the final speech endpoint or Stop method call. For automatic mode recognition, this will occur for exceptionally long utterances. For example, when background noise is mistakenly interpreted as continuous speech. For single mode recognition, this may occur if the user keeps the audio stream open for an excessive amount of time, such as by holding down the stylus in a tap-and-talk scenario.

For recognition in multiple mode, the babbletimeout attribute applies to the period between speech detection and each phrase recognition, that is, the period is restarted after each return of results or other event.

For recording, the babbletimeout attribute specifies the length of time, in milliseconds, recording occurs once speech is detected.

If exceeded, the onnoreco event occurs with a status code -15.

If babbletimeout is not specified, the value defaults to 20000. The minimum value allowed is 5000. For clients (Speech Add-in for Microsoft Internet Explorer and Speech Add-in for Microsoft Pocket Internet Explorer) the maximum value is 60000. For telephony applications the maximum is 2147483647. A value of 0 disables the time-out.

Example

The following code demonstrates the use of the babbletimeout attribute.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:salt="http://www.saltforum.org/2002/SALT">
  <head>
    <title>listen Test</title>
    <object id="Speechtags" CLASSID="clsid:DCF68E5B-84A1-4047-98A4-0A72276D19CC" VIEWASTEXT></object>
  </head>
  
  <body>
    <!-- declare the object on the page-->
    <?import namespace="salt" implementation="#Speechtags" />
    <salt:listen id="listen1" mode="automatic" endsilence="500" babbletimeout="5000" onreco="Handleonreco()"
    onnoreco="Handleonnoreco()" onsilence="Handleonsilence()" onerror="Handleonerror()" 
    onbabbletimeout="Handleonerror()">
      <salt:grammar name="cities"> 
        <grammar version="1.0" tag-format="semantics-ms/1.0" lang="en-US" 
        xmlns="http://www.w3.org/2001/06/grammar" root="cities">
          <rule id="cities">
            <one-of>
              <item>Seattle</item> 
              <item>Boston</item> 
              <item>Houston</item> 
              <item>Dallas</item> 
            </one-of>
          </rule>
        </grammar>
      </salt:grammar>
      <salt:bind targetelement="boxReco" targetattribute="value" value="//cities"/>
    </salt:listen>
    
    <input type="button" name="BtnDe" value="Start" OnClick="Start()" id="Button"/>
    
    <br><br>
    This example uses an automatic mode listen.<br>
    Click Start to begin; after speaking, the application will automatically stop.<br>
    Valid city names for recognition: Seattle, Boston, Dallas, and Houston.

    <br><br>
    <table cellspacing=0 cols=2>
      <tr>
        <td>Recognition Status:</td> 
        <td><input type="text" size="40" name="boxStatus" value="(recognition status goes here)"
        id="boxStatus"/></td>
      </tr>

         <td>Recognition Text:</td> 
         <td><input type="text" size="40" name="boxReco" value="(recognition text goes here)"
         id="boxReco"/></td>
      </tr>
    </table>  

    <br><br>
    Semantic Markup Language (SML) Result:<br>
    <TEXTAREA cols="60" rows="3" ID=txtComments>(Semantic Markup Language (SML) results display here)
    </TEXTAREA>
    <script language="JScript">
    <!--
      function Start() {
        boxStatus.value = "";
        boxReco.value = "";
        txtComments.value = "";
        listen1.Start();
      }
      function Handleonreco(){
        boxStatus.value = listen1.status;
        boxReco.value = event.srcElement.text;
        txtComments.value = event.srcElement.recoresult.xml
      } 
      function Handleonnoreco(){
        boxStatus.value = "onnoreco fired " + listen1.status;
        boxReco.value = ""
      }
      function Handleonsilence(){
        boxStatus.value = "onsilence fired " + listen1.status;
        boxReco.value = ""
      }
      function Handleonerror(){
        boxStatus.value = "onerror fired " + listen1.status;
        boxReco.value = "";
      }
    -->  
    </script>
  </body>
</html>

See Also

listen Element | Recognition Mode: Automatic |  Recognition Mode: Single | Recognition Mode: Multiple | onnoreco Event