我使用的服务是:在线语音合成
调用的接口是:示例里面没有三个模型路径参数
参数设置情况:和示例里面一样
开发平台和机型:Andorid
public BaiduTest(String voice){this.voice = voice;
}
@Override
public void run() {
test();
}
public void test(){
speechSynthesizer = SpeechSynthesizer.getInstance();
speechSynthesizer.setContext(AppInstance.getAppInstance());
e = speechSynthesizer.setApiKey("BRjI********xTFK","c6***********1c1d1");
Log.d("TAG",e+"");
e = speechSynthesizer.setAppId("9*****3");
Log.d("TAG",e+"");
// speechSynthesizer.setParam(SpeechSynthesizer.PARAM_TTS_TEXT_MODEL_FILE,"file:/android_assets/data/bd_etts_ch_text.dat");
// Log.d("TAG","模型文件路径"+"/data/bd_etts_ch_text.dat");
// speechSynthesizer.setParam(SpeechSynthesizer.PARAM_TTS_SPEECH_MODEL_FILE,"file:/android_assets/data/bd_etts_ch_text.dat");
AuthInfo authInfo = speechSynthesizer.auth(TtsMode.MIX);
speechSynthesizer.initTts(TtsMode.MIX);
if (authInfo.isSuccess()){
Log.d("TAG","语音播报");
e = speechSynthesizer.speak(voice);
Log.d("TAG",e+"");
}else {
} BaiduTest baiduTest = new BaiduTest(call.getLocation());
baiduTest.start();
代码示例如上所示,我每次调用会执行两次speak方法,而且关闭这个Activity重新跳转进来,执行上面的start方法,speak方法就会执行3次,重复打开和关闭Activity步骤,每次执行start方法speak方法就会多执行一次的,也就是我执行一次start方法,speak可以执行n次
收藏
点赞
0
个赞
请登录后评论
TOP
切换版块
请测试我们最新的官方demo,如再有问题请回复