【语音合成API】SpeechSynthesisUtterance是HTML5中新增的API,用于将指定文字合成为对应的语音.也包含一些配置项,指定如何去阅读(语言,音量,音调)等

// 语音播报
 speek (content) {
      let message = new SpeechSynthesisUtterance()
      message.text = content
      message.lang = 'zh-CN'
      message.volume = 1
      message.rate = 0.7
      speechSynthesis.speak(message)
}

// 调用,结果(房号二二零八,欢迎光临),注意(不截取会读作两千零八)
  this.speek('房号,' + this.BreakfastInfo.roomno.split('') + ',,欢迎光临'

 

相关博文:

【1】web端文字转语音的几种方案:https://www.cnblogs.com/lindping/p/7641480.html

【2】HTML5语音合成Speech Synthesis API简介:https://www.zhangxinxu.com/wordpress/2017/01/html5-speech-recognition-synthesis-api/

【3】SpeechSynthesisUtterance 语音合成使用:https://blog.csdn.net/qq_40571631/article/details/89738575

【4】speechSynthesis,TTS语音合成:https://www.cnblogs.com/wujindong/p/9940630.html

其他相关:标题搜索

 

转载于:https://www.cnblogs.com/mobaiyu/p/11541689.html

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐