Web Speech APIと戯れる
まずは、音声一覧を取ってくる、こちらなどを参考にしてくだされ。。
Web Speech API で使える音声一覧。 - 脱力系日記
こんな感じで、どんな音声が使えるか一覧表示してみます。
<!DOCTYPE html> <html> <head> <script> // wait on voices to be loaded before fetching list window.speechSynthesis.onvoiceschanged = function() { window.speechSynthesis.getVoices().filter(function(voice){ console.log(voice.voiceURI); }); }; </script> </head> <body> get voices! </body> </html>
Web Speech API Specification
あとは、voiceURI アトリビュートにて設定するといいらしい。
<html> <head> <script> var synthes = new SpeechSynthesisUtterance("hello world"); speechSynthesis.voiceURI = 'Google 日本語'; speechSynthesis.speak( synthes ); </script> </head> <body> get voices! </body> </html>