ISpeechLexiconPronunciation PhoneIds Property (SAPI 5.3)
Microsoft Speech API 5.3
Interface: ISpeechLexiconPronunciation
PhoneIds Property
The PhoneIds property returns the pronunciation of a word as a Variant array of numeric phone ids.
Pronunciations represented in PhoneIds can be converted to phones with the IdToPhone method of theSpPhoneConverter object.
Syntax
Set: | (This property is read-only) |
Get: | Variant = ISpeechLexiconPronunciation.PhoneIds |
Parts
- ISpeechLexiconPronunciation
The owning object. - Variant
Set: (This property is read-only)
Get: A Variant variable returning the value of the property.
Example
The following code example creates a lexicon, adds a pronunciation to it, retrieves the pronunciation object, and formats the values of the PhoneIds as a string. The resulting string is " 46 12 33".
Option Explicit
Private Sub Form_Load()
On Error GoTo EH
' Declare identifiers:
Dim MyLex As SpeechLib.SpLexicon
Dim MyLexPronunciation As SpeechLib.ISpeechLexiconPronunciation
Dim MyLexPronunciations As SpeechLib.ISpeechLexiconPronunciations
Dim ID As Integer
Dim PhoneIDs As Variant 'A Variant array of numeric values
Dim TmpStr As String 'Display the PhoneId values
Set MyLex = New SpeechLib.SpLexicon
MyLex.AddPronunciation "one", 1033, SPSNoun, "w ah n"
' Get first item in pronunciations collection:
Set MyLexPronunciations = MyLex.GetPronunciations("one", 1033)
Set MyLexPronunciation = MyLexPronunciations.Item(0)
PhoneIDs = MyLexPronunciation.PhoneIDs
For ID = LBound(PhoneIDs) To UBound(PhoneIDs)
TmpStr = TmpStr & Str(PhoneIDs(ID))
Next ID
MsgBox TmpStr, vbInformation
End
EH:
If Err.Number Then ShowErrMsg
End Sub
Private Sub ShowErrMsg()
' Declare identifiers:
Const NL = vbNewLine
Dim T As String
T = "Desc: " & Err.Description & NL
T = T & "Err #: " & Err.Number
MsgBox T, vbExclamation, "Run-Time Error"
End
End Sub