集成在线语音合成,离线语音合成控制台报错
一从如是 发布于2016-05 浏览:1622 回复:1
0
收藏

2016-05-26 17:28:33.374 E|BDSTTSEngine.mm:856 get license failed: -101

2016-05-26 17:28:33.375 E|BDSTTSEngine.mm:742 failed to get license from server

2016-05-26 17:28:33.376 E|BDSSpeechSynthesizer_Combined.mm:386 start tts engine failed




===以下贴代码====

- (void)configBaiduSpeech {

    [BDSSpeechSynthesizer setLogLevel:BDS_PUBLIC_LOG_DEBUG];

    [[BDSSpeechSynthesizer sharedInstance] setSynthesizerDelegate:self];

    [self configOnlineTTS];

    [self configOfflineTTS];

}


- (void)configOnlineTTS {

     [[BDSSpeechSynthesizer sharedInstance] setApiKey:Baidu_APPKEY withSecretKey:Baidu_SecretKEY];

}


- (void)configOfflineTTS {

    [[BDSSpeechSynthesizer sharedInstance] setSynthParam:[NSNumber numberWithFloat:10.0]

                                                  forKey:BDS_SYNTHESIZER_PARAM_ONLINE_REQUEST_TIMEOUT];

    

    // 离线相关设置

    NSError* ret=[[BDSSpeechSynthesizer sharedInstance] loadOfflineEngine:

                  [[NSBundle mainBundle] pathForResource:@"Chinese_Text" ofType:@"dat"]

                                                           speechDataPath:

                  [[NSBundle mainBundle] pathForResource:@"Chinese_Speech_Female" ofType:@"dat"]

                                                          licenseFilePath:

                  [[NSBundle mainBundle] pathForResource:@"offline_engine_tmp_license" ofType:@"dat"]

                                                              withAppCode:Baidu_APPID];

    if (ret != nil) {

        [[BDSSpeechSynthesizer sharedInstance] setSynthParam:[NSNumber numberWithInt:BDS_SYNTHESIZER_SPEAKER_FEMALE]

                                                      forKey:BDS_SYNTHESIZER_PARAM_SPEAKER];

        

        [[BDSSpeechSynthesizer sharedInstance] setSynthParam:[NSNumber numberWithInt:5]

                                                      forKey:BDS_SYNTHESIZER_PARAM_VOLUME];

        

        [[BDSSpeechSynthesizer sharedInstance] setSynthParam: [NSNumber numberWithInt:5]

                                                      forKey:BDS_SYNTHESIZER_PARAM_SPEED ];

        

        [[BDSSpeechSynthesizer sharedInstance] setSynthParam: [NSNumber numberWithInt:5]

                                                      forKey:BDS_SYNTHESIZER_PARAM_AUDIO_ENCODING];

        

        

        [[BDSSpeechSynthesizer sharedInstance] setSynthParam:[NSNumber numberWithInt: BDS_SYNTHESIZER_AUDIO_ENCODE_MP3_16K]

                                                      forKey:BDS_SYNTHESIZER_PARAM_AUDIO_ENCODING ];

    }

    [UIApplication sharedApplication].idleTimerDisabled = YES;

}


收藏
点赞
0
个赞
共1条回复 最后由用户已被禁言回复于2022-04
#2fang4096回复于2016-05

离线授权问题,如使用正式授权,请移除历史授权文件。

0
TOP
切换版块