在iOS 7.0 AVSpeechSynthesizer中有美国男声吗? [英] Does in iOS 7.0 AVSpeechSynthesizer have US male voice?

查看:428
本文介绍了在iOS 7.0 AVSpeechSynthesizer中有美国男声吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案:它没有美国男声

我使用 AVSpeechSynthesizer framework for iOS7.0

AVSpeechUtterance *utt = [AVSpeechUtterance speechUtteranceWithString:@"Hello"]; 
if (isMale) //flag for male or female voice selected
{
    // need US male voice as en-US is providing only US female voice
    utt.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-GB"]; //UK male voice 
}
else
{
    utt.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"]; //US female voice
}

我需要使用美国男性声音而不是男性英国声音

推荐答案

iOS仍未提供美国男声。
您可以找到所有可用语音的BCP-47代码

iOS still doesn't provide US male voice. You can find all BCP-47 code of available voices

for (AVSpeechSynthesisVoice *voice in [AVSpeechSynthesisVoice speechVoices]) {
NSLog(@"%@", voice.language);
}

这篇关于在iOS 7.0 AVSpeechSynthesizer中有美国男声吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆