Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/118.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
美国iphone有英国人对avspeechsynthesis的声音吗?(要测试的示例代码)_Iphone_Ios_Objective C_Ipad_Avspeechsynthesizer - Fatal编程技术网

美国iphone有英国人对avspeechsynthesis的声音吗?(要测试的示例代码)

美国iphone有英国人对avspeechsynthesis的声音吗?(要测试的示例代码),iphone,ios,objective-c,ipad,avspeechsynthesizer,Iphone,Ios,Objective C,Ipad,Avspeechsynthesizer,我没有任何美国开发人员朋友来测试这一点,但我意识到我确实了解一个有帮助的社区。:) 所以我的问题是——我们的iPhone是有英国人对AVSpeechSynthesizer的声音,还是像模拟器一样播放单调的嗡嗡声 下面是测试这一点的代码: #import <AVFoundation/AVFoundation.h> AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init]; AVSpeechUtteran

我没有任何美国开发人员朋友来测试这一点,但我意识到我确实了解一个有帮助的社区。:)

所以我的问题是——我们的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];
#导入
AVSpeechSynthesizer*合成器=[[AVSpeechSynthesizer alloc]init];
avspeechoutance*speechoutance=[avspeechoutance speechoutance with string:@“这是一种非常特别的东西,语音系统可以读出。你可能会发现我说话时带有相当智能的英语口音。我希望我不只是听起来像机器人。”;
speechoutrance.voice=[avspeechsynthesisvoicewithlanguage:@“en-gb]”;
speechoutrance.rate=0.20;
[合成器发声:发声];
一方面,它可以支持所有语言。另一方面,我知道文本到语音的声音有多大,所以只包括母语也是有意义的,在美国可能不包括英国的声音


根据我自己的测试,在我的设备上,将语言更改为诸如
@“en-au”
(适用于澳大利亚)之类的语言听起来也不错。

在iPad mini上使用3
voiceWithLanguage
设置进行了尝试:

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

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

en us->无口音的女声(好的-带美国口音;-)


第五代iPod touch上的结果相同。

您可以通过[AVSpeechSynthesisVoice speechVoices]确定哪些语音可用。这将返回语言负载,包括(以及Mac上的等效语音): 恩奥卡伦 en GB-丹尼尔 伊莫伊拉酒店 恩我们-萨曼莎 恩扎-特萨

我最喜欢的是莫伊拉


我看不出为什么美国版的声音会更少。事实上,它可能至少还有一个,因为Siri在美国有男声和女声的选择——男声听起来像是Mac的Alex,但似乎没有任何方式通过编程访问它

将其放在代码中某个地方,运行一次即可转储所有可用语言。不幸的是,它没有给出性别细节

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

谢谢你的帮助。非常感谢。有什么方法可以改变速度吗?@Jacky是的,可以通过设置
avspeechoutrance
rate
属性来改变速度。英国人的声音听起来像卡里·格兰特D