Share via


audiometer Element

  Microsoft Speech Technologies Homepage

Configures the appearance and location of the audio volume display meter that appears while a Web page is listening or recording.

<audiometer attributes />

The audiometer element has the following attributes:

Attributes Description
id Specifies the unique name of the audiometer element. Optional.
targetelement Specifies the name of the page element adjacent to which the audiometer element appears. Optional.
targetlocation Specifies where the audiometer element appears relative to the specified targetelement. Optional.
x Specifies, in pixels, the horizontal position from the left side of the Web page where the audiometer element appears. Optional.
y Specifies, in pixels, the vertical position from the top of the page where the audiometer element appears. Optional.
width Specifies, in pixels, the width of the audiometer element. Optional.
height Specifies, in pixels, the height of the audiometer element. Optional.
barwidth Specifies, in pixels, the width of the vertical bars in the audiometer element bar graph. Optional.
barspace Specifies, in pixels, the space between vertical bars in the audiometer element bar graph. Optional.
multicolor Specifies whether the audiometer element appears in multicolor. Optional.
statusbar Specifies whether the audiometer element displays in the Microsoft Internet Explorer status bar. Optional.

Remarks

The audiometer element is a Microsoft-specific extension to Speech Application Language Tags (SALT). Consequently, it has its own namespace that must be included in order to enable functionality of the audiometer element. The namespace declaration is:

<html xmlns:multimodal="https://schemas.microsoft.com/speech/2002/12/salt/multimodal"/>

In addition, the following statement must also be included in the body to ensure property operation.

<?import namespace="multimodal" implementation="#SpeechTags" />

The audiometer element is a child of the listen element. It provides a visual indication that listening or recording is taking place. The default position of the audiometer element in the Speech Add-in for Microsoft Internet Explorer is adjacent to the cursor when listening. However, it can be set to other locations using its various positioning attributes. For Speech Add-in for Microsoft Pocket Internet Explorer, the default position is the status bar.

Example

The following code demonstrates the use of the audiometer element. This example code works properly only on the desktop.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:multimodal="https://schemas.microsoft.com/speech/2002/12/salt/multimodal"
xmlns:salt="http://www.saltforum.org/2002/SALT"  >
  <head>
    <title>Audiometer Example</title>
  </head>
  <body onload="Prompt1.Start()">
    <!-- declare the object on the page-->
    <object id="SpeechTags" CLASSID="clsid:DCF68E5B-84A1-4047-98A4-0A72276D19CC" VIEWASTEXT></object>    
    <?import namespace="salt" implementation="#SpeechTags" />
    <?import namespace="multimodal" implementation="#SpeechTags" />
    
    <salt:prompt id="Prompt1">
      Please speak the name of a major US city after clicking the Start button.
    </salt:prompt>
   
    <salt:listen id="listen1" mode="automatic"  onreco="Handleonreco()" onnoreco="Handleonnoreco()" 
    onsilence="Handleonsilence()" onerror="Handleonerror()" onbabbletimeout="Handleonerror()">
      <multimodal:audiometer id="audiometerTag" x="700" y="10" height="20" width="50"/>
      <salt:grammar name="cities"> 
        <grammar version="1.0" tag-format="semantics-ms/1.0" root="cities" 
        lang="en-US" xmlns="http://www.w3.org/2001/06/grammar">
          <rule id="cities">
            <one-of>
              <item>Atlanta</item>
              <item>Baltimore</item>
              <item>Boston</item>
              <item>Chicago</item>
              <item>Dallas</item>
              <item>Denver</item>
              <item>Detroit</item>
              <item>Houston</item>
              <item>Las Vegas</item>
              <item>Los Angeles</item>
              <item>Miami</item>
              <item>Minneapolis</item>
              <item>New York City</item>
              <item>Philadelphia</item>
              <item>Pittsburgh</item>
              <item>Reno</item>
              <item>Salt Lake City</item>
              <item>San Francisco</item>
              <item>Seattle</item>
              <item>Washington, DC</item>
            </one-of>
          </rule>
        </grammar>
      </salt:grammar>
      <salt:bind targetelement="boxReco" targetattribute="value" value="//cities"/>
    </salt:listen>
    
    <table cellspacing="0" cellpadding="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>
      <tr>
        <td>Recognition Text:</td> 
        <td><input type="text" size="40" name="boxReco" value="(recognition text goes here)"
        id="boxReco"/></td>
      </tr>
    </table>      

    <br>
    Semantic Markup Language (SML) Result:<br>
    <TEXTAREA cols="60" rows="5" ID=txtComments>(Semantic Markup Language (SML) results are displayed here)
    </TEXTAREA>
    <p>
     <input type="button" name="BtnStart" value="Start" onmousedown="Start()"  id="BtnStart"/>    
       
    <script language="JScript">
    <!--
      function Start() {
        boxStatus.value = "(Listening...)";
        boxReco.value = "(Waiting response)";
        txtComments.value = "(Waiting response)";
        listen1.Start();
      }

      function Stop() {
        listen1.Stop();
        boxStatus.value = listen1.status;
        boxReco.value = event.srcElement.text;
      }

      function Handleonreco() {
        listen1.Stop();
        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 = ""
        txtComments.value = "";
      }

      function Handleonsilence() {
        boxStatus.value = "onsilence fired " + listen1.status;
        boxReco.value = ""
        txtComments.value = "";
      }

      function Handleonerror() {
        boxStatus.value = "onerror fired " + listen1.status;
        boxReco.value = "";
        txtComments.value = "";
      }
    -->  
    </script>
  </body>
</html>

See Also

listen Element