OpenEars API を使用してテキストを読み取る iOS アプリがあります。最新バージョン (1.2.5) を使用しています。単語が読まれている間 (「オンザフライ」) にピッチを変更する方法がわかりません。ピッチを制御するスライダーを作成しました。スライダーが変更されると、デリゲートが起動されます。デリゲート関数では、FliteController target_mean が変更されます。目的は、target_mean 値が変更されるとすぐにピッチを変更することでした。私のコードは次のとおりです。
-(void)sayTheMessage:(NSString *)message {
// if there is nothing there, don't try to say anything
if (message == nil)
return;
[self.oeeo setDelegate:self];
// we are going to say what is in the label...
@try {
// set the pitch, etc...
self.flite.target_mean = pitchValue; // Change the pitch
self.flite.target_stddev = varienceValue; // Change the variance
self.flite.duration_stretch = speedValue; // Change the speed
// finally say it!
[self.flite say:message withVoice:self.slt];
}
@catch (NSException *exception) {
if ([delegate respondsToSelector:@selector(messageError)])
[delegate messageError];
}
@finally {
}
}
-(void)changePitch:(float)pitch {
if ((pitch >= 0) && (pitch <= 2)) {
// save the new pitch internally
pitchValue = pitch;
// change the pitch of the current speaking....
self.flite.target_mean = pitchValue;
}
}
何か案は?