vue 文字转声音

const synth = window.speechSynthesis;
const msg = new SpeechSynthesisUtterance();

export function voiceSpeak(e) {
  msg.text = e;
  msg.lang = 'zh-CN';
  msg.volume = '1';
  msg.rate = 1;
  msg.pitch = 1;
  // synth.cancel();
  synth.speak(msg);
}

记录下,

posted @ 2021-09-08 17:57  天天的蓝色  阅读(154)  评论(0编辑  收藏  举报