瀏覽器可以將文本轉換成聲音,通過html5的函數實現,支持火狐、谷歌瀏覽器。IE不支持
function speckText(text){ var speechInstance = new window.SpeechSynthesisUtterance(text); speechInstance.lang = 'zh'; speechInstance.volume = 100; //聲音的音量 speechInstance.rate = 0.7; //語速,數值,默認值是1,范圍是0.1到10 speechInstance.pitch = 1.5; // 表示說話的音高,數值,范圍從0(最小)到2(最大)。默認值為1 window.speechSynthesis.speak(speechInstance); }