【问题标题】:Do US iPhones have the British voice for AVSpeechSynthesizer? (sample code to test)美国 iPhone 是否有 AVSpeechSynthesizer 的英国语音? (示例代码进行测试)
【发布时间】:2015-04-06 11:29:32
【问题描述】:

我没有任何美国开发者朋友可以与之测试,但我意识到我确实知道整个社区都有帮助。 :)

所以我的问题是 - 美国的 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"(针对澳大利亚)听起来也不错。

【问题讨论】:

    标签: iphone ios objective-c ipad avspeechsynthesizer


    【解决方案1】:

    在 iPad mini 上尝试了 3 个voiceWithLanguage 设置:

    en-gb -> 带有英国口音的男声

    en-au -> 带有澳大利亚口音的女声

    en-us -> 没有口音的女性声音(OK - 带有美国口音 ;-)

    在第 5 代 iPod touch 上的结果相同。

    【讨论】:

    • 感谢您的帮助。欣赏它。
    • 有什么办法可以改变速度吗?
    • @Jacky 是的,速度可以通过设置AVSpeechUtterance rate 属性来改变。
    【解决方案2】:

    把它放在你的代码中的某个地方运行一次以转储所有可用的语言。不幸的是,它没有提供性别详细信息。

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

    【讨论】:

      【解决方案3】:

      您可以使用 [AVSpeechSynthesisVoice speechVoices] 确定哪些语音可用。这将返回大量语言,包括(以及 Mac 上的等效语音): en-AU - 凯伦 zh-CN - 丹尼尔 en-IE - 莫伊拉 zh-CN - 萨曼莎 en-ZA - 泰莎

      我最喜欢的是莫伊拉

      我看不出有任何理由说明美国版的声音会减少。事实上,它可能至少还有一个,因为在美国,Siri 可以选择男性和女性的声音——男性的声音听起来像是来自 Mac 的 Alex,但似乎没有任何方法可以以编程方式访问它。

      【讨论】:

      • 英国的声音听起来像加里格兰特。 : D
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-01
      • 1970-01-01
      • 2019-03-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多