Collapse the table of content
Expand the table of content

SpPhoneConverter IdToPhone method (SAPI 5.3)

Speech API 5.3
Microsoft Speech API 5.3

Object: SpPhoneConverter

IdToPhone Method

The IdToPhone method converts an array of phoneme IDs to a string of phoneme symbols.

If the IdToPhone method is called before setting the SpPhoneConverter's LanguageId property, an SPERR_UNINITIALIZED error will occur.

     IdArray As Variant
) As String


An array of phoneme IDs or a single phoneme ID.

Return Value

A String variable.


The following Visual Basic form code demonstrates the use of the IdToPhone. The application assigns values to an array and then displays the resulting phoneme string.

To run this code, create a form with no controls. Paste this code into the Declarations section of the form.

Option Explicit

Dim objPhoneConverter As New SpPhoneConverter

Private Sub Form_Load()
    On Error GoTo EH

    Dim T As String

    ' US English.
    objPhoneConverter.LanguageId = 1033

    ' Get the phoneme symbols of the phoneme id 1.
    objPhoneConverter.IdToPhone (1)

    Dim ids(2) As Integer
    ids(0) = 1
    ids(1) = 2
    ids(2) = 3

    ' Get a string of phoneme symbols for the
    ' specified phoneme ids, separated by space.
    T = """" & objPhoneConverter.IdToPhone(ids) & """"
    MsgBox T, vbInformation

    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 Sub
© 2015 Microsoft