Text to Speech in OS X Application

2019-09-05 07:44发布

问题:

I am creating a native OS X application, and I was surprised at how difficult it is to find documentation on text-to-speech with native APIs. What would be the easiest way of having my application speak (using Alex's voice for example)?

Thanks!

回答1:

What you call “text-to-speech” is also commonly abbreviated as TTS and alternatively called “speech synthesis”.

The Cocoa class NSSpeechSynthesizer is the API to use. The canonical sample code is CocoaSpeechSynthesisExample.

There also is a guide to “Speech Programming Topics” and a “Speech Synthesis Programming Guide” available.

Finally, there are lower level APIs available if you need access to stuff that is abstracted away for you by NSSpeechSynthesizer.



回答2:

Look at this please NSSpeechRecognizer example

its a text to speech built in library for OS X .. NSSpeechRecognizer