Front-end text to audio speechSynthesis


const speech = new SpeechSynthesisUtterance();
speech.pitch = 1 // 获取并设置话语的音调(值越大越尖锐,越低越低沉)
speech.rate = 1 // 获取并设置说话的速度(值越大语速越快,越小语速越慢)
speech.text = '加油啊';
window.speechSynthesis.speak(speech);

Disadvantages Not compatible with IE browser

Guess you like

Origin blog.csdn.net/m0_53574149/article/details/129062057