更新记录
1.0.0(2026-03-20)
下载此版本
首次发布,支持查看系统tts引擎列表,支持文字合成音频文件
平台兼容性
uni-app(4.82)
| Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
| √ |
√ |
× |
× |
√ |
× |
√ |
× |
× |
| 微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
小红书小程序 |
快应用-华为 |
快应用-联盟 |
| × |
× |
× |
× |
× |
× |
× |
× |
× |
× |
× |
× |
uni-app x(4.84)
| Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
| - |
- |
- |
- |
- |
- |
aw-tts-saver
系统 TTS 语音合成与保存插件。
功能
- 获取设备可用 TTS 引擎列表
- 指定引擎合成语音
- 调节语速(0.5~2.0)和音调(0.5~2.0)
- 保存合成语音为 WAV 文件到应用缓存目录
平台支持
- Android ✅
- iOS ❌(暂不支持)
- HarmonyOS ❌(暂不支持)
使用示例
<script lang="uts">
import { getAvailableEngines, synthesizeToCache } from '@/uni_modules/aw-tts-saver'
const engines = await getAvailableEngines()
const res = await synthesizeToCache({
text: '你好',
engine: engines[0]?.name,
speechRate: 1.2,
pitch: 1.0
})
</script>
---
## ✅ 在页面中使用
```vue
<template>
<view>
<button @click="testTTS">测试TTS</button>
</view>
</template>
<script lang="uts">
import { getAvailableEngines, synthesizeToCache } from '@/uni_modules/aw-tts-saver'
export default {
methods: {
async testTTS() {
try {
const engines = await getAvailableEngines()
console.log('可用引擎:', engines)
const res = await synthesizeToCache({
text: '欢迎使用 aw-tts-saver 插件',
engine: engines[0]?.name,
speechRate: 1.2,
pitch: 1.0
})
//文件路径位于/storage/emulated/0/Android/data/包名/cache/voices/,可根据业务需求按时清理缓存文件
if (res.success) {
const audio = uni.createInnerAudioContext()
audio.src = res.filePath!
audio.play()
} else {
uni.showToast({ title: res.error, icon: 'none' })
}
} catch (e) {
uni.showToast({ title: e.message, icon: 'none' })
}
}
}
}
</script>