开放免费的文本转语音接口
发布时间:2022-06-21, 15:32:51 分类:默认分类 | 编辑 off 网址 | 辅助
正文 676字数 354,738阅读
百度的开放转换接口
"http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&spd=4&text=你好啊,听起来好憨啊"
lan 语言类型
lan=en 英文
lan = zh 中文
ie 文字编码方式
spd 语速
1-9的数字,数字越大,语速越快。
text 要转换的文本
Run code
Cut to clipboard
搜狗的开放转换接口
"https://fanyi.sogou.com/reventondc/synthesis?text=%E4%BD%A0%E5%A5%BD%E5%95%8A&speed=1&lang=zh-CHS&from=translateweb&speaker=6"
text 要转换的文本
speed 语速 1~?(我测试到15都还可以) 越大,语速越慢
lan 语言类型
lan=en 英文
lan = zh-CHS 中文
from 没搞明白 (我猜应该是获取你是从哪里请求的,哪种方式请求的)
speaker 语音类型 1-6的数字
Run code
Cut to clipboard
有道
// 这个好听...
"http://tts.youdao.com/fanyivoice?word=你好,我是你好&le=zh&keyfrom=speaker-target"
Run code
Cut to clipboard
(支付宝)给作者钱财以资鼓励 (微信)→
有过 2 条评论 »
Vue实现音频文件播放功能 <el-button type="text" @click="handlePlay(scope.row)">播放</el-button> <el-dialog title="录音播放" :visible.sync="dialogVisible" width="20%" :before-close="stop"> <template> <center> <audio :src="src" autoplay="autoplay" controls="controls" ref="audio" >Your browser does not support the audio element.</audio> </center> </template> </el-dialog> <script> data() { return { src: "", dialogVisible: false, } methods: { //播放组件 handlePlay(row) { this.src = row.filePath; this.play(); }); }, //播放 play() { this.dialogVisible = true; this.$refs.audio.play(); }, //音频暂停 stop() { this.dialogVisible = false; this.$refs.audio.pause(); this.$refs.audio.currentTime = 0; } } </script>
//获取audio语音时长 function getVoiceTime() { $('ul.conversation li .outer-right audio.addVoiceTime').each(function () { var audio = $(this)[0], duration; audio.load(); audio.oncanplay = function(){ duration = Math.ceil(audio.duration); if (duration == 'Infinity') { getVoiceTime(); } else { console.log(duration + `''`); } } }); }