Windowsの音声合成エンジン のAPI
JavaScriptで、音声合成(テキストを音声に変換)する。
ALICE'S ADVENTURES IN WONDERLAND (www.gutenberg.org))
speechSynthesis.getVoices()
var msg = new SpeechSynthesisUtterance(); var voices = window.speechSynthesis.getVoices(); msg.voice = voices[10]; // Note: some voices don't support altering params msg.voiceURI = 'native'; msg.volume = 1; // 0 to 1 msg.rate = 1; // 0.1 to 10 msg.pitch = 2; //0 to 2 msg.text = 'Man shall not live by bread alone, but by every word that proceeds from the mouth of God.'; msg.lang = 'en-US'; msg.onend = function(e) { console.log('Finished in ' + event.elapsedTime + ' seconds.'); }; speechSynthesis.speak(msg);
Web Speech API Specification Editor's Draft: 6 June 2014