1 Star 0 Fork 11

xiongsupply / MT-TTS

forked from LT / MT-TTS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

MT-TTS

安卓原生离线语音合成引擎工具插件 包含两个工具:MT-TTS-Speech(调用系统已安装TTS)、MT-TTS-Baidu(调用百度离线SDK,需要自行购买授权)

MT-TTS-Speech

调用安卓系统已安装的TTS进行语音合成播放

相关免费的安卓语音引擎TTS

使用方式

const TTSSpeech = uni.requireNativePlugin("MT-TTS-Speech");

API

  • 初始化 init(callback, engineName?)
  • 获取已系统安装的TTS getInstallTTS(([{label, name}])=>{})
  • 设置引擎 setEngine(engineName)
  • 设置语调 setPitch(num) 0-100, 默认 50
  • 设置语速 setSpeed(num) 0-100, 默认 50
  • 获取状态 isSpeeking()
  • 设置语言 setLanguage(name) 默认中文
  • 播放 speek({text: 'test'})
  • 停止 stop()
  • 销毁 destroy()
  • 打开语音设置 openSetting()
  • 开始播放回调注册 onStart(callback)
  • 完成播放回调注册 onDone(callback)
  • 播放出错回调注册 onError(callback)

示例

TTSSpeech.getInstallTTS(list => {
  list.forEach(v => console.log(`引擎名 ${v.label} 包名:${v.name}`));
})

TTSSpeech.init((status) => {
  if(status === 0){
    console.log('引擎初始化成功')
    TTSSpeech.speek({ text: '语音播放成功'})
  }
}, 'com.iflytek.speechcloud')

MT-TTS-Baidu

调用百度离线SDK,需要购买百度授权

百度语音离线合成SDK文档

使用方式

const TTSBaidu = uni.requireNativePlugin("MT-TTS-Baidu");

API

  • 初始化 init(options, callback)
  • 设置语调 setPitch(num) 范围 0-9,默认5
  • 设置语速 setSpeed(num) 范围 0-9,默认5
  • 设置语速 setVolumn(num) 范围 0-9,默认15
  • 获取状态 isSpeeking()
  • 播放 speek(text, utteranceId)
  • 播放 changeSpeeker(text) text: F(度小美)、M(度小宇)、Y(度丫丫)、X(度逍遥), 成功返回0
  • 停止合成 stop()
  • 暂停播放 paused()
  • 恢复播放 resume()
  • 销毁 destroy()
  • 开始播放回调注册 onStart(callback)
  • 完成播放回调注册 onDone(callback)
  • 播放出错回调注册 onError(callback)

示例

TTSBaidu.init({
  appId: '',
  appKey: '',
  secretKey: '',
  sn: '', // 序列号
}, (status) => {
  if(status === 0){
    console.log('初始化成功')
    TTSBaidu.speek('语音播放成功!');
  }
})
MIT License Copyright (c) 2020 LT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

UniApp安卓原生 TTS引擎插件 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/xiongsupply_admin/mt-tts.git
git@gitee.com:xiongsupply_admin/mt-tts.git
xiongsupply_admin
mt-tts
MT-TTS
master

搜索帮助