Skip to content
Menu
编程侠
  • 首页
  • 资讯
    • 手机
  • 博客
    • 博客vue
    • 博客PHP
  • Q我
编程侠
2022-10-202022-10-20

网页实现文字转语音朗读功能

SpeechSynthesisUtterance是HTML5中新增的API,用于将指定文字合成为对应的语音。

<button onclick="play()">朗读</button>
<script>
	var utterThis = new SpeechSynthesisUtterance();
	utterThis.text = "hello word";
	utterThis.volume = 1; // 声音的音量 范围是0到1
	utterThis.rate = 0.7; //语速,数值,默认值是1,范围是0.1到10
	mutterThisg.pitch = 0; // 音高,数值,范围从0(最小)到2(最大)。默认值为1
	function play() {
		speechSynthesis.speak(utterThis);
	}
</script>

最新

  • 831密码安全口令
  • 链接跳转到百度地图的指定地址
  • 云服务提到的99.99%的服务可用性,这是个什么概念?
  • 兼容IE的CSS竖排文字代码
  • 网页灰度

标签

831 a标签 canvas clone csrf echarts filter GB2312 grayscale Hello html2canvas iframe prism Unicode UTF-8 wordpress world XSS 不触发 云服务 代码雨 大数据 异常 手机号 打印 拼多多 数组 文字转语音 朗读 正则 深浅拷贝 热力图 竖排 签名验证 编码 编程圈 置灰 背代码 节流 速度 链接 链接跳转 键盘 防抖 验证

友情链接

  • staggering-beauty
  • 编程侠
©2025 编程侠 渝ICP备20006693号-4