...
|
...
|
@@ -123,7 +123,7 @@ static T_JZsdkReturnCode TTS_Synthesis(const char* src_text, const char* params) |
|
|
* 获取音源
|
|
|
*
|
|
|
* ********/
|
|
|
static T_JZsdkReturnCode TTS_GetSoundSource(int tone,unsigned char *name_tts, unsigned char *name_path)
|
|
|
static T_JZsdkReturnCode TTS_GetSoundSource(int tone,unsigned char *name_tts, unsigned char *name_path, unsigned char *rule_path)
|
|
|
{
|
|
|
|
|
|
/*
|
...
|
...
|
@@ -182,6 +182,25 @@ static T_JZsdkReturnCode TTS_GetSoundSource(int tone,unsigned char *name_tts, un |
|
|
snprintf(name_path,64, "fo|/root/tts/xiaoyan.jet");
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
//写入发音规则
|
|
|
memset(rule_path,0,128);
|
|
|
snprintf(rule_path,128,"/root/tts/common.jet");
|
|
|
|
|
|
//不是英文就直接返回
|
|
|
if ( tone != 0x11 && tone != 0x12)
|
|
|
{
|
|
|
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
|
|
}
|
|
|
|
|
|
//由于有讯飞更新,让英文有了新的发音规则,所以要检测本地是否有新的发音规则
|
|
|
if(JZsdk_check_file_exists("/root/tts/common_en.jet") == JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
|
|
{
|
|
|
memset(rule_path,0,128);
|
|
|
snprintf(rule_path,128,"/root/tts/common_en.jet");
|
|
|
}
|
|
|
|
|
|
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
|
|
}
|
|
|
|
|
|
static T_JZsdkReturnCode TTS_FILE_GenerateAndPlay(struct t_Megaphone_tts_param *Megaphone_tts_param)
|
...
|
...
|
@@ -196,15 +215,18 @@ static T_JZsdkReturnCode TTS_FILE_GenerateAndPlay(struct t_Megaphone_tts_param * |
|
|
int ret = MSP_SUCCESS;
|
|
|
char name_tts[16];
|
|
|
char name_path[64];
|
|
|
|
|
|
char session_begin_params[512];
|
|
|
char tts_add_params[512];
|
|
|
char rule[128];
|
|
|
|
|
|
//获取音源
|
|
|
TTS_GetSoundSource(tone, name_tts, name_path);
|
|
|
//获取音源,以及规则
|
|
|
TTS_GetSoundSource(tone, name_tts, name_path, rule);
|
|
|
|
|
|
//配置合成参数
|
|
|
snprintf(session_begin_params,512,
|
|
|
"engine_type = local,voice_name=%s, text_encoding = UTF8, tts_res_path = %s;fo|/root/tts/common.jet, sample_rate = 16000, speed = %d, volume = %d, pitch = 50, rdn = 2"
|
|
|
,name_tts,name_path,speed,volume);
|
|
|
"engine_type = local,voice_name=%s, text_encoding = UTF8, tts_res_path = %s;fo|%s, sample_rate = 16000, speed = %d, volume = %d, pitch = 50, rdn = 2"
|
|
|
,name_tts , name_path, rule, speed, volume);
|
|
|
|
|
|
printf("session_begin_params=%s\n",session_begin_params);
|
|
|
printf("argv=%s\n",argv);
|
...
|
...
|
|