AVFoundationフレームワークが必要
#import <AVFoundation/AVFoundation.h> AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:@"The quick brown fox"]; // 言語、省略時はiOS設定に従う utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"]; utterance.rate = 0.2; utterance.volume = 0.8; AVSpeechSynthesizer *synth = [[AVSpeechSynthesizer alloc] init]; [synth speakUtterance:utterance];
コメント