iOS7自帶語音合成的功能: code
// **** 語音合成 - (void)speakText { // NSArray *arrVoices = @[@"th-TH", @"pt-BR", @"sk-SK", @"fr-CA", @"ro-RO", @"no-NO", // @"fi-FI", @"pl-PL", @"de-DE", @"nl-NL", @"id-ID", @"tr-TR", // @"it-IT", @"pt-PT", @"fr-FR", @"ru-RU", @"es-MX", @"zh-HK", // @"sv-SE", @"hu-HU", @"zh-TW", @"es-ES", @"zh-CN", @"nl-BE", // @"en-GB", @"ar-SA", @"ko-KR", @"cs-CZ", @"en-ZA", @"en-AU", // @"da-DK", @"en-US", @"en-IE", @"hi-IN", @"el-GR", @"ja-JP"]; NSArray *arrVoices = @[@"zh-TW", @"zh-CN"]; AVSpeechSynthesizer *speech = [[AVSpeechSynthesizer alloc] init]; for (NSInteger i = 0; i < arrVoices.count; i ++) { AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:@"您好,您消費金額是:¥10.01"]; AVSpeechSynthesisVoice *voice = [AVSpeechSynthesisVoice voiceWithLanguage:arrVoices[i]]; utterance.voice = voice; [speech speakUtterance:utterance]; } }
更高級的功能能夠使用訊飛語音 或者 百度語音。 it