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 ...

Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.