unclutter
unclutter copied to clipboard
feat: add tts support
This PR adds in TTS support via the Web Speech API. TTS is handled via a button on the side of the article. Upon enabling TTS, the article's contents are grabbed and then piped into the Web Speech API, prefixed by "From" and then the hostname of the article; likewise, clicking the button again will cancel the current TTS operation.
Resolves: #11
Hey @ElijahPepe again thank you very much for the PR and the idea!
I haven't forgotten about this and #21, just wanted to ship some unclutter reliability improvements before adding more features (which also then avoids speaking-out things like "share button").
Do you know of a way to improve the voice quality of the Web Speech API? Maybe some relatively inexpensive API to plug into it?
Unfortunately, without detecting the voices the user has, there's no way to improve the voice quality. The API works by plugging into the user's TTS voices for their operating system, which most will have.
@phgn0 I'd like to open this back up. If native TTS via the OS isn't possible, then we should look into alternatives. Google Cloud looks like a great option, but costly, and depends on an API key.
@ElijahPepe You're right, probably it makes sense to start with the OS TTS. We can always add the GCP TTS as another SpeechSynthesis
implementation later. Thank you for the reminder!
It would also be cool to highlight the spoken words via SpeechSynthesisUtterance#events like in the Firefox reader mode -- that's yet another future improvement :)
I converted the UI overlay code to Svelte in the past weeks, do you want to rebase the PR or should I take a look?
I'll have you take a look, I'm pretty busy this week. If I get to it, I'll revise this PR.