And*_*rew 3 iphone objective-c ipad ios avspeechsynthesizer
我没有任何美国开发者朋友来测试这个,但意识到我确实知道一个有用的社区.:)
所以我的问题是 - 美国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];
Run Code Online (Sandbox Code Playgroud)
一方面它有意义,它将支持所有语言.另一方面,我知道文本到语音的声音有多大,所以只包括母语也是有意义的,而在美国可能不包括英国的声音.
根据我自己的测试,将语言改为诸如@"en-au"(对于澳大利亚)这样的东西在我的设备上听起来也不错.
voiceWithLanguage在iPad mini上使用3种设置尝试:
en-gb - >带有英语口音的男声
en-au - >带有澳大利亚口音的女声
en-us - >没有重音的女声(好的 - 带有美国口音;-)
第五代iPod touch的结果相同.
将它放在运行一次的代码中,以转储所有可用的语言.不幸的是,它没有提供性别细节.
NSArray* speechVoices = [AVSpeechSynthesisVoice speechVoices];
NSLog(@"Voices: (%d) %@", speechVoices.count, speechVoices);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5105 次 |
| 最近记录: |