DT_AVSpeechSynthesizer Class Reference
Inherits from | AVSpeechSynthesizer |
---|---|
Conforms to | AVSpeechSynthesizerDelegate DTalkerTtsDelegate |
Declared in | DT_AVSpeechSynthesizer.h |
Overview
Framework : DT_AVSpeechSynthesizer.framework
DT_AVSpeechSynthesizer は、iOSの標準TTS(AVSpeechSynthesizer)を継承し、DTalkerTtsを使用できるようにしたクラスで、AV_SpeechSynthesizer の機能がそのまま使用できます。
標準のTTSを使用する場合
DT_AVSpeechSynthesizer *synth = [[DT_AVSpeechSynthesizer alloc] init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:text];
AVSpeechSynthesisVoice *jVoice = [AVSpeechSynthesisVoice voiceWithLanguage:@"ja-JP"];
utterance.voice = jVoice;
[synth speakUtterance:utterance];
DTalkerTtsを使用する場合
DT_AVSpeechSynthesizer *synth = [[DT_AVSpeechSynthesizer alloc] init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:text];
utterance.voice = nil;
[synth speakUtterance:utterance];
「けいこ」を指定してDTalkerTtsの機能を使う
DT_AVSpeechSynthesizer *synth = [[DT_AVSpeechSynthesizer alloc] initWithDict:VOICENAME_HANAKO];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:@"こんにちは"];
utterance.voice = nil;
[synth speakUtterance:utterance];
[synth.dtalker sing:@"T120,O4,A2 とお,A4 りゃん,G4 せ,A4 とお,A8 りゃ,G8 ん,E2 せ"];
プロパティ
dtalker
DTalkerTts オブジェクト
@property (nonatomic) DTalkerTts *dtalker
Discussion
DTalkerTtsのすべての機能が使用できます。
Declared In
DT_AVSpeechSynthesizer.h
delegate
delegate
@property (nonatomic, assign) id<AVSpeechSynthesizerDelegate> delegate
Declared In
DT_AVSpeechSynthesizer.h
voice
voice
@property (nonatomic) int voice
Discussion
0=Takashi, 1=Keiko, 2=Taro, 3=Hanako, -1=Apple’s TTS
Declared In
DT_AVSpeechSynthesizer.h
メソッド
– init
初期化
- (id)init
Return Value
初期化されたオブジェクト、デフォルト音声として「たかし」
Declared In
DT_AVSpeechSynthesizer.h
– initWithDict:
音声を指定して初期化
- (id)initWithDict:(int)dict
Parameters
dict |
0=Takashi, 1=Keiko, 2=Taro, 3=Hanako, -1=Apple’s TTS |
---|
Return Value
初期化されたオブジェクト
Declared In
DT_AVSpeechSynthesizer.h