Created
November 26, 2013 16:25
-
-
Save tomohisa/7661358 to your computer and use it in GitHub Desktop.
short sample for AVSpeechSynthesizer voice reading feature for iOS 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 読み上げオブジェクト | |
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