jmoenig / Snap

a visual programming language inspired by Scratch
http://snap.berkeley.edu
GNU Affero General Public License v3.0
1.52k stars 748 forks source link

Problems with text-to-speech library's "accent" #2104

Open ToonTalk opened 6 years ago

ToonTalk commented 6 years ago

Accents (or voices) differ greatly from browser to browser and OS. In Chrome about half of the accents have any effect. In FireFox none do. In Edge nothing is said unless the American accent is chosen. No voices are available in Chromium (e.g. on a Raspberry Pi).

Even pitch and rate are ignored by some browsers.

cycomachead commented 6 years ago

This is because the SpeechSynthesis API is still experimental.

There's nothing we can do about the lack of support, though I wonder if there's anything good to do able detecting the right options?

ToonTalk commented 6 years ago

While it is experimental (i.e. subject to change) it is supported by all browsers except IE (and has been for a while). https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis#Browser_compatibility I'd be surprised if the API changes incompatibly.

The underlying problem is that the available voices isn't (and I expect never will be) standardised.

What I did to deal with this is to implement a block that searches for a matching voice (e.g. "uk", "english", "female") and also a block to specify the default voice if there is no matching voice.