Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript testing speechSynthesis voices

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #169132
    magician11
    Participant

    I want to listen to every voice available uttering the same phrase to choose one.

    var testPhrase = new SpeechSynthesisUtterance("Hello there!");
    
    window.speechSynthesis.getVoices().forEach(function(voice) {
    
            testPhrase.voice = voice.voiceURI;
            console.log(voice.voiceURI);
            window.speechSynthesis.speak(testPhrase);
    });
    

    This doesn’t work as the voices get changed while the first voice is speaking. How do I delay the voice changing until the utterance is done?

    Thanks :)

    #169147
    magician11
    Participant

    Maybe this code is better… but still the same issue of the delay.

            var testPhrase = new SpeechSynthesisUtterance("Hello there!");
    
            for (var voice in allVoices) {
    
                console.log(allVoices[voice]);
                testPhrase.voice = allVoices[voice];
                window.speechSynthesis.speak(testPhrase);
            }
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.