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

Object: SpAudioFormat

Type Property


The Type property gets and sets the speech audio format as a SpeechAudioFormatType.

Most applications using standard audio formats should use Type to set and retrieve formats.


Syntax

Set: SpAudioFormat.Type = SpeechAudioFormatType
Get: SpeechAudioFormatType = SpAudioFormat.Type

Parts

SpAudioFormat
The owning object.
SpeechAudioFormatType
Set: A SpeechAudioFormatType object that sets the property.
Get: A SpeechAudioFormatType object that gets the property.

Example

The following Visual Basic form code demonstrates the use of the Type and Guid properties. To run this code, create a form with the following controls:

  • Two command buttons called Command1 and Command2
  • Paste this code into the Declarations section of the form.

    The Command1 procedure creates a token category object and sets it to the category of audio inputs, selects a token for the first MMSys resource, and instantiates an SpMMAudioIn object with the token's CreateInstance method. The code then creates an SpAudioFormat object from the SpMMAudioIn object, and changes the Type property of the SpAudioFormat object. Finally, the code sets the Format property of the SpMMAudioIn object with the SpAudioFormat object.

    The Command2 procedure performs the same series of operations with audio outputs instead of audio inputs.


    Option Explicit
    
    Dim C As SpeechLib.SpObjectTokenCategory
    Dim T As SpeechLib.SpObjectToken
    
    Dim I As SpeechLib.SpMMAudioIn
    Dim O As SpeechLib.SpMMAudioOut
    
    Dim F As SpeechLib.SpAudioFormat
    
    Private Sub Command1_Click()
    
        Debug.Print
        Debug.Print "MMSys AudioIn"
        Debug.Print
    
        'Set category object to audio input resources
        Set C = New SpObjectTokenCategory
        C.SetId SpeechCategoryAudioIn
        
        'Set token object to first MMSys input resource
        Set T = C.EnumerateTokens("Technology=MMSys").Item(0)
        Debug.Print "First device: " & T.GetDescription
        
        'Create an SpMMAudioIn object from the token,
        'and show some of its properties
        Set I = T.CreateInstance()
        Debug.Print "DeviceId: " & I.DeviceId
        Debug.Print "original Audio Format:" & I.Format.Type
        
        'Create an Audio Format object from resource
        'If Audio Format's Type is standard, then change it
        Set F = I.Format
        If F.Type = SAFT22kHz16BitMono Then
            F.Type = SAFT11kHz16BitMono
        End If
        
        'Set Audioinput's format with changed format object
        Set I.Format = F
        Debug.Print " changed Audio Format:" & I.Format.Type
        Debug.Print "Guid:" & F.Guid
        
    End Sub
    
    Private Sub Command2_Click()
    
        Debug.Print
        Debug.Print "MMSys AudioOut"
        Debug.Print
        Set C = New SpObjectTokenCategory
        C.SetId SpeechCategoryAudioOut
        Set T = C.EnumerateTokens("Technology=MMSys").Item(0)
        Debug.Print "First device: " & T.GetDescription
        Set O = T.CreateInstance()
        Debug.Print "DeviceId: " & O.DeviceId
        Debug.Print "original Audio Format:" & O.Format.Type
        Set F = O.Format
        If F.Type = SAFT22kHz16BitMono Then
            F.Type = SAFT11kHz16BitMono
        End If
        Set O.Format = F
        Debug.Print " changed Audio Format:" & O.Format.Type
        Debug.Print "Guid:" & F.Guid
        
    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