JSFiddle - React, Tailwind, and code Playground

by mrmyh

HTML

<script>
    speechSynthesis.getVoices();
    function play() {
        speechSynthesis.cancel();
        let voices = speechSynthesis.getVoices();
        let ssu = new SpeechSynthesisUtterance(Array.from({ length: 30 }, (v, i) => i).join(', Hello '));
        ssu.voice = voices.find(v => v.voiceURI === 'Google US English');
        speechSynthesis.speak(ssu);
    }
</script>

<button onclick="play()">Play</button>