Question

I don't have any US developer friends to test this with, but realised I do know a whole community of helpful ones. :)

So my question is - do US iPhones have the British voice for AVSpeechSynthesizer, or does it play a monotone-sounding drone like the simulator does?

Here's the code to test this out:

#import <AVFoundation/AVFoundation.h>

AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init];
AVSpeechUtterance *speechUtterance = [AVSpeechUtterance speechUtteranceWithString:@"This is something really special that a speech system could read out. You might find that I'm talking with quite an intelligent english accent. I hope I don't just sound robotic."];
speechUtterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-gb"];
speechUtterance.rate = 0.20;

[synthesizer speakUtterance:speechUtterance];

On one hand it makes sense that it would ship with support for all languages. On the other hand, I know how big text-to-speech voices can be, so it'd also make sense to only include the native language, and in the US that may not include the UK voice.

From my own tests, changing the language to something such as @"en-au" (for Australia) sounds good too on my device.

Was it helpful?

Solution

Tried it with 3 voiceWithLanguage settings on an iPad mini:

en-gb -> male voice with an English accent

en-au -> female voice with Australian accent

en-us -> female voice with no accent (OK - with an American accent ;-)

Same results on a 5th generation iPod touch.

OTHER TIPS

Put this somewhere in your code that runs once to dump out all the available languages. Unfortunately it doesn't give the gender details.

NSArray* speechVoices = [AVSpeechSynthesisVoice speechVoices];
NSLog(@"Voices: (%d) %@", speechVoices.count, speechVoices);

You can determine which voices are available with [AVSpeechSynthesisVoice speechVoices]. This returns loads of languages including (and the equivalent voice on the Mac): en-AU - Karen en-GB - Daniel en-IE - Moira en-US - Samantha en-ZA - Tessa

My favourite is Moira

I can't see any reason why the US version would have any less voices. Indeed it presumably has at least one more as Siri in the US has a choice of male and female voices - the male voice sounds like it be Alex from the Mac, but there doesn't seem to be any way to access it programmatically.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top