Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 4 - Speech Manager / Speech Manager Reference
Speech Manager Routines / Converting Text To Phonemes


Legacy Documentclose button

Important: Inside Macintosh: Sound is deprecated as of Mac OS X v10.5. For new audio development in Mac OS X, use Core Audio. See the Audio page in the ADC Reference Library.

TextToPhonemes

You can use the TextToPhonemes function to convert textual data into phonemic data.

FUNCTION TextToPhonemes (chan: SpeechChannel; textBuf: Ptr;
                           textBytes: LongInt; phonemeBuf: Handle;
                           VAR phonemeBytes: LongInt): OSErr;
chan
A speech channel whose associated synthesizer and voice are to be used for the conversion process.
textBuf
A pointer to a buffer of text to be converted.
textBytes
The number of bytes of text to be converted.
phonemeBuf
A handle to a buffer to be used to store the phonemic data. The TextToPhonemes function may resize the relocatable block referenced by this handle.
phonemeBytes
On exit, the number of bytes of phonemic data written to the handle.
DESCRIPTION
The TextToPhonemes function converts the textBytes bytes of textual data pointed to by the textBuf parameter to phonemic data, which it writes into the relocatable block specified by the phonemeBuf parameter. If necessary, TextToPhonemes resizes this relocatable block. The TextToPhonemes function sets the phonemeBytes parameter to the number of bytes of phonetic data actually written.

WARNING
If the textual data is contained in a relocatable block, a handle to that block must be locked before the TextToPhonemes function is called.
The data returned by TextToPhonemes corresponds precisely to the phonemes that would be spoken had the input text been sent to SpeakText instead. All current mode settings for the speech channel specified by chan are applied to the converted speech. No callbacks are generated while the TextToPhonemes routine is generating its output.

SPECIAL CONSIDERATIONS
Because the TextToPhonemes function might move memory, you should not call it at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the TextToPhonemes function are
Trap macroSelector
_SoundDispatch$0A5C000C

RESULT CODES
noErr0No error
paramErr-50Parameter value is invalid
nilHandleErr-109Handle argument is NIL
siUnknownInfoType-231Feature not implemented on synthesizer
invalidComponentID-3000Speech channel is uninitialized or bad

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996