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: ISpeechRecognizer

GetFormat Method


The GetFormat method returns the current input audio format.

The sound format may be different at different times or at different points during processing. For example, the audio format at the time the input reaches the sound device (the audio card for instance) may differ from the audio format by the time it reaches the speech recognition (SR) engine. GetFormat specifies which location should be polled and returns the audio format for that location.


SpeechRecognizer.GetFormat(
     Type As SpeechFormatType
) As SpAudioFormat

Parameters

Type
Request for the audio format at entering the sound device or SR engine.

Return Value

The GetFormat method returns an SpAudioFormat variable.


Example

This code sample demonstrates the GetFormat method. After a successful recognition, two GetFormat calls poll SAPI for the audio formats of the sound device and the SR engine and display results in a label.

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 the recognizer.

    Public WithEvents RC As SpSharedRecoContext
    Public myGrammar As ISpeechRecoGrammar
    
    Private Sub Form_Load()
        Set RC = New SpSharedRecoContext
        Set myGrammar = RC.CreateGrammar
        
        myGrammar.DictationSetState SGDSActive
        
    End Sub
    
    Private Sub RC_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult)
        Dim audioFormat As SpAudioFormat
        
        Label1.Caption = Result.PhraseInfo.GetText
        
        Set audioFormat = RC.Recognizer.GetFormat(SFTInput)
        audioFormatType = audioFormat.Type
        Label2.Caption = "Audio input type: " & audioFormat.Type & vbCrLf
        
        Set audioFormat = RC.Recognizer.GetFormat(SFTSREngine)
        audioFormatType = audioFormat.Type
        Label2.Caption = Label2.Caption & "SR engine input type: " & audioFormat.Type
    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