Search code examples
ios7avfoundationvoice

What are the BCP-47 voice codes available for iOS 7 AVSpeechSynthesisVoice?


Today I'm very exited about the speech synthesis function is available in iOS7.

I want to select the male voice(default in OSX, called alex).

I don't know what's the BCP-47 code for him, and BTW how to get the full list of all voice code


Solution

  • Here's how to get the BCP-47 codes of the available voices:

    for (AVSpeechSynthesisVoice *voice in [AVSpeechSynthesisVoice speechVoices]) {
        NSLog(@"%@", voice.language);
    }
    

    Alex's locale is "English - United States" (en-US), as you can see in the Dictation & Speech control panel on OS X. (Click "Customize..." in the "System Voice" drop down.)