🖥️프론트엔드/HTML | CSS | JAVASCRIPT

자바스크립트 - text to speech(text2speech)(SpeechSynthesisUtterance)

Janger 2022. 11. 5. 05:09
728x90
function say(m) {
  var msg = new SpeechSynthesisUtterance();
  var voices = window.speechSynthesis.getVoices();
  msg.voice = voices[10];
  msg.voiceURI = "native";
  msg.volume = 1;
  msg.rate = 1;
  msg.pitch = 0.8;
  msg.text = m;
  msg.lang = 'en-US';
  speechSynthesis.speak(msg);
}

 

출처: 

https://stackoverflow.com/questions/15653145/using-google-text-to-speech-in-javascript

 

Using Google Text-To-Speech in Javascript

I need to play Google text-to-speech in JavaScript. The idea is to use the web service: http://translate.google.com/translate_tts?tl=en&q=This%20is%20just%20a%20test And play it on a cert...

stackoverflow.com

 

728x90