我没有任何美国开发者朋友来测试这个,但意识到我确实知道一个有用的社区。 :)
所以我的问题是 - 美国iPhone是否具有AVSpeechSynthesizer的英国声音,还是像模拟器一样播放单调的无人机?
以下是测试它的代码:
#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];
一方面,它可以支持所有语言。另一方面,我知道文本到语音的声音有多大,所以只包括母语也是有意义的,在美国可能不包括英国的声音。
从我自己的测试中,将语言更改为@"en-au"
(对于澳大利亚)这样的内容在我的设备上听起来也不错。
答案 0 :(得分:8)
在iPad mini上使用3 voiceWithLanguage
个设置尝试:
en-gb - &gt;带有英语口音的男声
en-au - &gt;带有澳大利亚口音的女声
en-us - &gt;没有重音的女声(好的 - 带有美国口音; - )
第5代iPod touch的结果相同。
答案 1 :(得分:6)
将此位置放在运行一次的代码中以转储所有可用语言。不幸的是,它没有提供性别细节。
NSArray* speechVoices = [AVSpeechSynthesisVoice speechVoices];
NSLog(@"Voices: (%d) %@", speechVoices.count, speechVoices);
答案 2 :(得分:1)
您可以使用[AVSpeechSynthesisVoice speechVoices]确定哪些音色可用。这将返回大量语言,包括(以及Mac上的等效语音): en-AU - 凯伦 en-GB - 丹尼尔 en-IE - Moira en-US - 萨曼莎 en-ZA - Tessa
我最喜欢的是Moira
我看不出为什么美国版本会有更少的声音。事实上它可能至少还有一个,因为在美国Siri可以选择男性和女性的声音 - 男性的声音听起来像是来自Mac的Alex,但似乎没有任何方式以编程方式访问它。