- ···
- 产品服务
- ···
- 解决方案
- ···
- 文档中心
- ···
# 一、简介
将短文本( ≤ 500 字符)转换成自然流畅的语音,可流式播放,支持多种音色,并提供调节音量、语速、音高、亮度等功能。适用于智能客服、语音交互、导航播报等场景。
# 1.1 接口调用流程图
# 二、集成指南
2.1 将SDK中libs下面的arr包拷贝到工程的libs目录下
2.2 同时也需要在build.gradle进行aar配置 配置如下:
implementation files("libs/Unisound_PaaS_Sdk.aar")
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
1
2
3
2
3
注意:
在短文本合成中,需要在Application添加公共代码 在Application 类的onCreate中调用:
SpeechUtility.createUtility(this);
SpeechUtility.getUtility().setParameter(RecognizerConstant.ASR_APP_KEY,"申请的ASR的KEY"); SpeechUtility.getUtility().setParameter(RecognizerConstant.ASR_APP_SECRET,"申请的ASR的SECRET"); SpeechUtility.getUtility().setParameter(SynthesizerConstant.TTS_APP_KEY,"申请的TTS的KEY"); SpeechUtility.getUtility().setParameter(SynthesizerConstant.TTS_APP_SECRET,"申请的TTS的SECRET");
1
2
2
# 三、使用说明
# 3.1 创建合成对象
//创建对象
SpeechSynthesizer speechSynthesizer = new SpeechSynthesizer();
1
2
2
# 3.2 配置合成参数
//设置合成参数
speechSynthesizer.setParameter(SynthesizerConstant.TTS_VOLUME_KEY, "80"); speechSynthesizer.setParameter(SynthesizerConstant.TTS_SPEED_KEY, "80");
//设置发音人参数,必须设置
speechSynthesizer.setParameter(SynthesizerConstant.TTS_VCN_KEY, "kiyo");
1
2
3
4
2
3
4
# 3.3 开始合成文本
//开始播放text 内容
speechSynthesizer.startSpeaking(text, new SynthesizerListener());
1
2
2
# 四、接口文档
下载SDK获取接口文档 (opens new window)
SDK下载路径:AI开放平台 - 控制台 - 我的应用 - 应用详情 - 短文本语音合成最下方
# 五、SDK混淆说明
SDK内部做了混淆设置,业务层在做混淆的时候,不需要对其进行混淆。
-keep class cn.yunzhisheng.audioPlatform.** {*;}
-keep class a.a.a.** {*;}
-keep class com.unisound.cloud.** {*;}
1
2
3
2
3