动态更改OpenEars音高(动态)

时间:2013-05-08 14:12:45

标签: ios openears

我有一个使用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;
    }

}

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

OpenEars开发人员在这里。由于在处理语音之前设置了音高,因此无法使用FliteController动态改变音高。