Interface: ISpeechVoiceStatus
PhonemeId Property
The PhonemeId property retrieves the ID of the current phoneme being spoken by the voice.
Syntax
Set: | (This property is read-only) |
Get: | Integer = ISpeechVoiceStatus.PhonemeId |
Parts
- ISpeechVoiceStatus
- The owning object.
- Integer
-
Set: (This property is read-only)
Get: An Integer variable returning the Phoneme ID.
Example
The following Visual Basic form code demonstrates the use of the PhonemeId property of an ISpeechVoiceStatus object. To run this code, create a form with the following controls:
- A command button called Command1
- Two text boxes called Text1 and Text2
Paste this code into the Declarations section of the form.
The Form_Load procedure creates a voice object and places a sentence in the text box. The Command1_Click procedure speaks the contents of the text box asynchronously, and loops until the voice has finished speaking. Inside the loop, the code checks PhonemeId property periodically and displays it in Text2.
Option Explicit
Private V As SpeechLib.SpVoice
Private Sub Command1_Click()
Dim ii As Integer
On Error GoTo EH
Text2.Text = ""
V.Speak Text1.Text, SVSFlagsAsync
Do
For ii = 0 To 20000
DoEvents
Next ii
Text2.Text = Text2.Text & V.Status.PhonemeId & " "
Loop While V.Status.RunningState = SRSEIsSpeaking
EH:
If Err.Number Then ShowErrMsg
End Sub
Private Sub Form_Load()
On Error GoTo EH
Set V = New SpVoice
Text1.Text = "way, we, why, woe, woo."
Text2.Text = ""
EH:
If Err.Number Then ShowErrMsg
End Sub
Private Sub ShowErrMsg()
' Declare identifiers:
Dim T As String
T = "Desc: " & Err.Description & vbNewLine
T = T & "Err #: " & Err.Number
MsgBox T, vbExclamation, "Run-Time Error"
End
End Sub