O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting Voice Data

The first thing you are going to do is get the data that the data source will provide to the table view. This is the list of voices that the system has available for the speech synthesizer.

To find out what voices are available, you call the following NSSpeechSynthesizer class method:

 ​ ​c​l​a​s​s​ ​f​u​n​c​ ​a​v​a​i​l​a​b​l​e​V​o​i​c​e​s​(​)​ ​-​>​ ​[​A​n​y​O​b​j​e​c​t​]​?​

This method returns an array that contains voice identifiers. Voice identifiers are strings written in reverse domain notation. Here is an example of a voice identifier: com.apple.speech.synthesis.voice.Fred.

Also, notice that availableVoices() is a class method. This means you cannot call availableVoices() on an instance of NSSpeechSynthesizer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required