2013-05-08 79 views
0

我有一個使用OpenEars API讀取文本的iOS應用程序。我正在使用最新版本(1.2.5)。我無法弄清楚在閱讀文字時如何改變音高(「即時」)。我創建了一個滑塊來控制音高。當滑塊更改時,委託會被觸發。在委託函數中,FliteController target_mean被更改。目的是在target_mean值更改後立即改變音高。我的代碼如下:動態更改OpenEars間距(動態)

-(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; 
    } 

} 

任何想法?

回答

2

OpenEars開發者在這裏。由於在處理語音之前設置了音高,因此您無法使用FliteController快速更改音高。