当前位置 : 主页 > 网络编程 > JavaScript >

PC WEB语音合成,语音播放

来源:互联网 收集:自由互联 发布时间:2021-06-30
PC WEB语音合成,语音播放 var msg = new SpeechSynthesisUtterance();var voices = window.speechSynthesis.getVoices();msg.voice = voices[64]; // Note: some voices don't support altering paramsmsg.voiceURI = 'Google 普通话(中国大陆
PC WEB语音合成,语音播放
var msg = new SpeechSynthesisUtterance();
var voices = window.speechSynthesis.getVoices();
msg.voice = voices[64]; // Note: some voices don't support altering params
msg.voiceURI = 'Google 普通话(中国大陆)';
msg.volume = 1; // 0 to 1
msg.rate = 2; // 0.1 to 10
msg.pitch = 0; //0 to 2
msg.text = '你好,世界!';
msg.lang = 'zh-CN';
speechSynthesis.speak(msg);
网友评论