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

Priority Property


The Priority property gets and sets the priority level of the voice.

The priority level defines the order in which the text-to-speech (TTS) engine processes a voice object's speech requests relative to requests from other voice objects. Higher priority levels are assigned to error-handling voices and the lowest priority level is assigned to normal voices. Because of their priority level, voice requests from error-handling voices are spoken ahead of normal priority voice requests; as a result, error-handling voices can appear to interrupt normal voices.

The voice priority levels are contained in the SpeechVoicePriority enumeration. An SpVoice object is created with normal priority. To create an alert or over voice, create a voice and set its Priority property appropriately.


Syntax

Set: SpVoice.Priority = SpeechVoicePriority
Get: SpeechVoicePriority = SpVoice.Priority

Parts

SpVoice
The owning object.
SpeechVoicePriority
Set: A SpeechVoicePriority constant that sets the priority level.
Get: A SpeechVoicePriority constant that returns the current priority level.

Remarks

A voice with a Priority setting of SVPAlert is referred to as an alert voice. Alert voices are designed to be the primary vehicle for TTS error-handling. Other SpVoice elements, such as the AlertBoundary property, support error-handling functionality in alert voices that is not available to other voices.


Example

The following Visual Basic code demonstrates the use of the Priority property. 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 Form_Load procedure creates three voice objects, and assigns different Voice and Priority settings to each. Each voice is named after its Priority setting.

    In the Command1_Click procedure, the normal voice begins speaking asynchronously. The alert voice waits a few seconds, and then begins speaking. The normal voice is interrupted by the alert voice, and resumes speaking when the alert voice has finished.

    In the Command2_Click procedure, the normal voice and the over voice begin speaking asynchronously. The alert voice waits a few seconds, and then begins speaking. The normal voice is interrupted by the alert voice, and resumes speaking when the alert voice has finished. The over voice speaks over, or mixes with, the other two voices.

    Please see the AlertBoundary property for another code example using the Priority property.


    Option Explicit
    
    Dim Normal As SpeechLib.SpVoice
    Dim Alert As SpeechLib.SpVoice
    Dim Over As SpeechLib.SpVoice
    
    Private Sub Command1_Click()
    
        'Enqueue streams from normal voice
        Normal.Speak "a normal voice. a normal priority voice.", SVSFlagsAsync
        Normal.Speak "a normal voice. a normal priority voice.", SVSFlagsAsync
    
        Call Wait(3)    'Alert voice interrupts normal
        Alert.Speak "excuse me, alert voice!", SVSFlagsAsync
        
    End Sub
    
    Private Sub Command2_Click()
    
        'Enqueue streams from Normal voice and Over voice
        Normal.Speak "a normal voice. a normal priority voice.", SVSFlagsAsync
        Normal.Speak "a normal voice. a normal priority voice.", SVSFlagsAsync
        
        Over.Speak "over voice speaking over the other voices.", SVSFlagsAsync
        Over.Speak "over voice speaking over the other voices.", SVSFlagsAsync
        Over.Speak "over voice speaking over the other voices.", SVSFlagsAsync
        
        Call Wait(3)    'Alert voice interrupts normal
        Alert.Speak "excuse me, alert voice!", SVSFlagsAsync
        
    End Sub
    
    Private Sub Form_Load()
    
        Set Normal = New SpVoice
        Set Alert = New SpVoice
        Set Over = New SpVoice
        
        Alert.Priority = SVPAlert   'From SVPNormal to SVPAlert
        Over.Priority = SVPOver     'From SVPNormal to SVPOver
        
        'Presumes two male voices and one female voice
        Set Normal.Voice = Normal.GetVoices("gender = male").Item(0)    '1st male voice
        Set Alert.Voice = Alert.GetVoices("gender = male").Item(1)      '2nd male voice
        Set Over.Voice = Normal.GetVoices("gender = female").Item(0)    '1st female voice
    
    End Sub
    
    Private Sub Wait(ByVal Seconds As Integer)
        Dim sglWait As Single
        sglWait = Timer() + Seconds
        Do
            DoEvents
        Loop Until Timer > sglWait
    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