4 ms·
FF's TTS is an important project for anyone who wants a trivial to use text-to-speech system. It's built into the browser so you can just run wss = window.
by sxp 3y ago
FF's TTS is an important project for anyone who wants a trivial to use text-to-speech system. It's built into the browser so you can just run
wss = window.speechSynthesis;
for (let i = 0; i < wss.getVoices().length; ++i){
str = `Voice ${i} is ${wss.getVoices()[i].name}`;
s = new SpeechSynthesisUtterance(str);
s.voice = wss.getVoices()[i];
wss.speak(s);
console.log(str);
}
in the console to get various TTS examples. For some browsers, this can be done offline while others use a cloud based TTS system.
- aragonite 3y agoNice! For debugging I've been having a lot of fun supplementing stderr (for especially important messages that I don't want to miss) with the free TTS voices available on Windows (by running a Powershell command) and from Chrome (via WebSocket). It's nice to have even more voices to choose from.
- alacode 3y agoPretty cool, it printed a list of over 8000 on my machine (Ubuntu, well Kubuntu now) and then proceeded to speak the voices after printing them all.
- j45 3y agoThis is handy to know, thanks. I was just trying out Common Voice a few days ago. They have a good example of a community page for folks wanting to help with a particular language. I was just thinking today that Firefox is worthy of switching back to because it was so fast,except I hadn't had a chance to do it. If anyone else thinks it's important for there to be an independent browser dedicated to privacy and security (and independence), they could as many casual browser switchers. I'm happy to be back on a few FF extension that didn't work quite the same on any chrome based browser.
- vlod 3y agoThis also works in Chrome (My version is: 119.0.6045.199) FF has 8611 voices, chrome has 19.
- joshstrange 3y agoThat's odd, my Chrome (119.0.6045.199) has 176 voices. Not all are English though.
- vlod 3y agoMaybe it's because I'm linux? (Pop!_OS 22.04 LTS) Also I have 3 English only.
- rollcat 3y agoOn macOS, it's say "enter text here" To pick a different voice: say -v Fred "enter text here" To list voices: say -v "?" (The quoting is necessary to prevent ZSH from interpreting the question mark as a glob.) I hear Firefox's TTL is important, yet prior to your comment I didn't even know it existed. This sort of stuff should be more discoverable, and have a more accessible (ahem) API.
- fzzzy 3y agoIt's part of the web apis, it's not just firefox. Chrome and Safari have supported it since 2013/2014.
- marcellus23 3y agoIt looks like speechSynthesis is supported in all the major browsers, not just FF. https://developer.mozilla.org/en-US/docs/Web/API/Window/speechSynthesis https://developer.mozilla.org/en-US/docs/Web/API/Window/spee...
- dan-robertson 3y agoDo you know if it’s been extracted into a standalone library? The state of the open source TTS seems to not be great. Presumably the data for a voice is harder to put together than training a speech to text system like whisper.
- malermeister 3y agoThis is a reasonably good open source local TTS that's fast enough to use in home automation: https://github.com/rhasspy/piper https://github.com/rhasspy/piper
- miki123211 3y agoThe voices don't come from the browsers themselves, but from operating systems and their underlying TTS APIs, SAPI on Windows, Speech Dispatcher on Linux and AVSpeechSynthesizer on Apple Devices. If you install a third-party voice compatible with one of these, the browsers will pick that up.
- amelius 3y agoIs there a handy demo website somewhere to access that?
- python273 3y agoI extracted Narrator module from Firefox'es reader mode. It's not so good in other browsers though. On macOS, I'm using Alex voice. https://tts.cns.wtf/ https://tts.cns.wtf/ https://github.com/python273/tts-app https://github.com/python273/tts-app
- amelius 3y agoI've tried this on Linux+Firefox, but it doesn't sound very good yet, I'm afraid.
- python273 3y agoYeah, it's using OS's voices and usually they are quite robotic. But it's still quite useful if you want to upload a long text into your brain. I'm also using Narrator in my HN reader (no settings for voice right now though, except localStorage['cfg-narrator-rate'] via devtools): https://hn.cns.wtf/#38532761 https://hn.cns.wtf/#38532761