SpPhoneConverter IdToPhone method (Microsoft Speech Platform)

Microsoft Speech Platform SDK 11

Microsoft Speech Platform

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.


SpPhoneConverter.IdToPhone(
     IdArray As Variant
) As String

Parameters

IdArray
An array of phoneme IDs or a single phoneme ID.

Return Value

A String variable.


Example

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

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