资讯动态

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

发布时间:2026/8/15 1:38:33 来源:尧图企业网站定制
SpeechSynthesisUtterance是HTML5中新增的API用于将指定文字合成为对应的语音。button onclickplay()朗读/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

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价