🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 4.2.2、语音合成API文档 </br> ## 4.2.2.1、 PlayByObainVoiceResultModule * 概要 文字合成播放。 * 构造器 ###### a. | **函数原型** | PlayByObainVoiceResultModule( std::string text, enum TTSPeople ttsPeople, int timeoutMilliseconds, std::string tipFile, int playTipMilli) | |---------------------|-------------------------------------------------------------------------------------------------------------------------------------------| | **参数** | **说明** | | text | 待合成的文字 | | ttsPeople | 发音人选择 | | timeoutMilliseconds | 每次允许的合成的最长超时时间 | | tipFile | 获取在线合成音频慢,播放友好的提示声的文件路径。 | | playTipMilli | 找到有效音频后超过多少毫秒还没识别到有效音频,开始播放识别的中的提示声 | ###### b. | **函数原型** | PlayByObainVoiceResultModule(std::string text,enum TTSPeople ttsPeople) | |-----------|--------------------------------------------------------------------------------------------------------------------|---|---| | **参数** | **说明** | | | | text | 待合成的文字 | | | | ttsPeople | 发音人选择 | | | | 备注 | 其余参数提供默认值 timeoutMilliseconds = 6\*1000 tipFile = "./resource/tipSound/ParserSound.wav" playTipMilli =800 | | | * play开始播放音频 | **函数原型** | ResultEntry play() | |--------------------------------------|----------------------------------------------------------------------------------------| | **参数** | **说明** | | **返回** | | | ResultEntry | 播放结果 请参考 4.1.2.2节 | | **备注** | 需要系统音频和语音处理先初始化完毕,请参考4.1.2.4节ConfigInitFactory的api | * stop终止播放 | **函数原型** | void stop() | |--------------|-------------| </br> ## 4.2.2.2、 TTSPeople合成语音发音人 | **枚举常量** | **简介** | |------------------------|------------------------------| | TTSPeopleLittleGirl | 小女孩 | | TTSPeopleWoman | 女人 | | 可自定义添加更多发音人 | 参考讯飞在线合成的语音发音人 |