Conversation
| toSpeak.voice = voices.find(voice => voice.lang === voiceLang); | ||
| synth.speak(toSpeak); | ||
| const desiredVoice = voices.find(voice => voice.lang === voiceLang); | ||
| if (desiredVoice) { |
There was a problem hiding this comment.
What happens if the desired voice can not be found? Nothing will be spoken at all, right? Can we fall back to English? Or at least throw an error message in the console?
There was a problem hiding this comment.
Yes, we can fall back to English. However, I have observed a warning I'm getting regarding the usage of speechSynthesis.speak(). It seems that it isn't allowed to use this method without user activation since M71, around December 2018.
Check: https://www.chromestatus.com/feature/5687444770914304
There was a problem hiding this comment.
So, I suggest we should add a little button per message that when clicked triggers the speechSynthesis.speak() function, this will be less annoying for users who don't want to be listening to every message and will be equally accessible for those who need this feature to work.
What is your opinion on this approach? @hotzenklotz
There was a problem hiding this comment.
I don't feel strongly about that. I guess having to trigger speech output by pressing a button next every message is a bit tedious/besides the point. What I mean is, that it might feel less like an "audio" chat and rather "just a like yet another feature".
I would leave it as is. The browser warning should only be shown when TTS was enabled by the devs, right? I think this is a design decision that chatbot designers should deal with themselves. Do they want speech or not? If yes, perhaps the first bot message should explain to enable it in Chrome...
There was a problem hiding this comment.
I agree with you. So, I'm going to change to English as the default language as we talked.
Related Issue: #122
This changes the expected behavior of TTS. Now it will only trigger TTS when the passed
voiceLangmatches the supported languages by SpeechSynthesis API.