I have an iOS app that reads text using the OpenEars API. I am using the latest version (1.2.5). I can not figure out how to change the pitch while the words are being read ("on the fly"). I created a slider to control the pitch. A delegate is fired as the slider is changed. In the delegate function, the FliteController target_mean is changed. The intent was to have the pitch change as soon as the target_mean value was changed. My code is as follows:
-(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;
}
}
Any ideas?
OpenEars developer here. You can't change the pitch on the fly with FliteController since the pitch is set before speech is processed.