最終更新:2008-01-04 (金) 12:52:51 (4646d)  

NSSpeechSynthesizer
Top / NSSpeechSynthesizer

NSSpeechSynthesizer

NSSpeechSynthesizer* speech;
speech = [[NSSpeechSynthesizer alloc] initWithVoice:@"com.apple.speech.synthesis.voice.Fred" ];

//テキストを話す
-(BOOL) startSpeakingString:(NSString *)string
[speech startSpeakingString: @"Hello"]; 

//テキストを話して、指定したファイルURLに保存
-(BOOL) startSpeakingString:(NSString *)string toURL:(NSURL *)url
[speech startSpeakingString: @"Hello" toURL:[NSURL URLWithString:@"file://localhost/Users/username/Desktop/aaa.aiff" ]]; 

//ボイスをセット
-(BOOL) setVoice:(NSString *)voice
[speech setVoice: @"com.apple.speech.synthesis.voice.Fred" ];