Skip to content

Instantly share code, notes, and snippets.

@tomohisa
Created November 26, 2013 16:25
Show Gist options
  • Save tomohisa/7661358 to your computer and use it in GitHub Desktop.
Save tomohisa/7661358 to your computer and use it in GitHub Desktop.
short sample for AVSpeechSynthesizer voice reading feature for iOS 7
// 読み上げオブジェクト
AVSpeechSynthesizer * synthesizer = [[AVSpeechSynthesizer alloc] init];
// 読み上げる内容
AVSpeechUtterance * utterance = [[AVSpeechUtterance alloc] initWithString:NSLocalizedString(@"Welcome to Tweet Overview ", nil)];
// 読み上げる言語の設定
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"ja-JP"];
utterance.pitchMultiplier = 1.0;
// 読み上げる
[synthesizer speakUtterance:utterance];
// 言語の一覧を出力
[[AVSpeechSynthesisVoice speechVoices] enumerateObjectsUsingBlock:^(AVSpeechSynthesisVoice * obj, NSUInteger idx, BOOL *stop) {
NSLog(@"%@",obj.language);
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment