语音翻译-nlpSpeechTranslate
返回内容介绍
public static String sample(TAipNlp client) throws Exception {
//参数内容
String filePath = "G:/16.pcm";//待翻译的本地音频文件路径
String session = new Date().getTime()/1000+"";//一次请求ID
int format = 6;//语音压缩格式编码
int seq = 0;//语音分片所在语音流的偏移量
int end = 1;//是否结束分片标识
String source = "zh";//源语言缩写
String target= "en";//目标语言缩写
String result = client.nlpSpeechTranslate(fotmat,seq,end,session,filePath,source,target);//语音翻译
return result;
}
public static String sample(TAipNlp client) throws Exception {
//参数内容
String filePath = "G:/16.pcm";//待翻译的本地音频文件路径
byte[] speech_chunk= FileUtil.readFileByBytes(filePath);
String session = new Date().getTime()/1000+"";//一次请求ID
int format = 6;//语音压缩格式编码
int seq = 0;//语音分片所在语音流的偏移量
int end = 1;//是否结束分片标识
String source = "zh";//源语言缩写
String target= "en";//目标语言缩写
String result = client.nlpSpeechTranslate(fotmat,seq,end,session,speech_chunk,source,target);//语音翻译
return result;
}