Search code examples
cocoaspeech-synthesis

Why can't I use downloaded voices for speech Synthesis in Lion?


This drove me nuts, so I thought I'd document the answer here.

To choose a voice, you give -[NSSpeechSynthesizer initWithVoice] the identifier in reverse-DNS format, e.g. com.apple.speech.synthesis.voice.Agnes But if a user downloads one, such as Paolo, you can't get to it the same way.


Solution

  • The answer turns out to be that Apple names it "voice.premium", so you get to Paolo with com.apple.speech.synthesis.voice.paolo.premium. So even though I got the list of [NSSpeechSynthesizer availableVoices], I only printed out the last word, and I didn't notice premium added to the list. To get the real printable name of a voiceIdentifier in availabVoices,(instead of looking at the last word), use:

    [[NSSpeechSynthesizer attributesForVoice:voiceIdentifier] 
        valueForKey: NSVoiceName]