CHMlib Logo Leading Translation Management System for Translation Agencies, Top Translation Management Software for Freelance Translators, Time Tracking Software, Word Count, Character Count and Line Count Software, Computer Assisted Translation Tool for Easy Word Count, Clipboard Character Count Software, User-Friendly Translation Memory Software, Terminology Management Software, Terminology Management Server, Microsoft Glossary Software, Dictionary of Acronyms, Social Network for Translators and Translation Agencies, Acronyms and Abbreviations Search Engine, Russian Translation Lab, Ukrainian Translation Lab.
You are reading help file online using chmlib.com
CrisisHelper - First Aid in Tough Times of World Economic Crisis


Intelligent Interface Technologies Home Page Microsoft Speech SDK

Speech Automation 5.1

Interface: ISpeechRecoContext Events

AudioLevel Event


The AudioLevel event occurs when the SAPI audio object detects a change in audio level.

The AudioLevel event is the only speech recognition event in SAPI automation that is not set by default. If this event is needed, it must be explicitly set with EventInterests.


SpeechRecoContext.AudioLevel(
     StreamNumber As Long,
     StreamPosition As Variant,
     AudioLevel As Long
)

Parameters

StreamNumber
Specifies the stream number.
StreamPosition
Specifies the position within the stream.
AudioLevel
Specifies the AudioLevel.

Example

The following Visual Basic form code demonstrates the use of the AudioLevel event. The application displays the audio level of the speaker's voice as well as the text of a successful recognition. The value of the speaker's voice is shown as both a numeric value as well as a histogram.

To run this code, create a form with the following controls:

  • Two labels called Label1 and Label2
  • Paste this code into the Declarations section of the form.

    The Form_Load procedure creates and activates a dictation grammar. Because the AudioLevel event is not set by default, it must be explicitly set with EventInterests. In this case, EventInterests is reset for only two events, with a Recognition as the second one.

    Public WithEvents RC As SpSharedRecoContext
    Public myGrammar As ISpeechRecoGrammar
    
    Private Sub Form_Load()
        Set RC = New SpSharedRecoContext
        
        Set myGrammar = RC.CreateGrammar
        myGrammar.DictationSetState SGDSActive
        
        RC.EventInterests = SRERecognition + SREAudioLevel
    End Sub
    
    Private Sub RC_AudioLevel(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal AudioLevel As Long)
        Label2.Caption = Val(AudioLevel)
        
        Label2.Caption = Label2.Caption & vbCrLf
        
        For i = 1 To AudioLevel
            Label2.Caption = Label2.Caption & "*"
        Next
    End Sub
    
    Private Sub RC_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult)
        Label1.Caption = Result.PhraseInfo.GetText
    End Sub
    


    You are reading help file online using chmlib.com

    If you want your help file to be removed or added please send e-mail to chmlibcom@gmail.com
    Partner sites: Logo Design, Simple Anti-Crisis Accounting Software, Voice Search for Web