-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
At the moment the SpeechSynthesis API in chromium doesn't seem to respect the users preferred voice (at least I haven't gotten it to work on Linux).
We should add a way to set this in the config and to monkey-patch speechSynthesis.speak to add the voice if no voice was set.
- Add a new
speechSynthesis.voiceconfig item, default tonull - In the settings page add a dropdown which populates with the
namesfromspeechSynthesis.getVoices() - There should be an option whose value is
"null"so users can "unset" their preference - Add some JS to each page which does something along these lines
((() => {
const realSpeak = SpeechSynthesis.prototype.speak
SpeechSynthesis.prototype.speak = patchedSpeak
function patchedSpeak(utterance) {
if(utterance.voice === null) {
for(const voice of this.getVoices()) {
if(voice.name === ${JSON.stringify(config.speechSynthesis.voice)}) {
utterance.voice = voice
}
}
}
realSpeak.call(this, utterance)
}
})())If utterance.voice is never null we should mokeypatch the setter for voice and track a private flag using a Symbol saying "a voice was set".
This should be injected inside a preload, I think.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Type
Projects
Status
Ready