在iOS 7.0 AVSpeechSynthesizer中有美国男声吗?

时间:2014-01-06 06:54:07

标签: ios objective-c iphone ios7 avspeechsynthesizer

解决方案:它没有US male voice


我已将AVSpeechSynthesizer framework用于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
}

我需要使用US male voice代替male UK voice

1 个答案:

答案 0 :(得分:2)

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

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