title: TTS(Text-to-speech)服务docker搭建 转化文本内容为语音
tags: [TTS,docker,语音,AI,docker-compose]
新版原文: https://query.carlzeng.top:3/appsearch?q=TTS
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
date: 2024-01-07 15:12:46
categories: Docker
转化文本内容为语音,TTS,生成中文语音,朗读全文,多语言支持
有什么用
转化文本内容为语音,转化网站内容为语音,朗读,生成中文语音
怎么用
<div>
<button onclick="synthesizeSpeech()">朗读全文</button>
</div>
<audio controls id="audioPlayer">Your browser does not support the audio element.</audio>
<script>
function synthesizeSpeech() {
var inputText = document.getElementsByClassName('post-block')[0].innerText;
var voice = "ZH";
var url = 'https://tts.carlzeng.top:3/speech?text=' + encodeURIComponent(inputText) + '&voice=' + voice;
var audioPlayer = document.getElementById('audioPlayer');
audioPlayer.src = url;
audioPlayer.load();
audioPlayer.play();
}
</script>
- 把以上这个html内容加到html页面中(或者模版中)
- 编辑/修改一下inputText的内容来源为需要朗读的文本内容。
实现过程
TTS docker, eSpeak TTS server for WebSpeech
方案有许多,但都不够亲民,或者不支持中文普通话
https://github.com/synesthesiam/opentts
docker run -it -p 5500:5500 synesthesiam/opentts:zh --no-espeak
弊端:不支持中文,无法包含英语
预览全流程 Setup a Text to Speech Engine(ON YOUR COMPUTER)
新的方案:
Text-to-speach server
https://github.com/parente/espeakbox
http://192.168.6.203:8089/speech?text=排查Nginx Proxy Manager,反向代理,让网站变成HTTPS&voice=ZH
Text-to-speach server
https://github.com/parente/espeakbox
Docker的具体位置
https://hub.docker.com/r/parente/espeakbox
标签:语音,TTS,Text,audioPlayer,speech,https,docker From: https://www.cnblogs.com/backuper/p/17966923