
Show HN: MeSpeak.js 2.0 – Text-to-Speech in JavaScript - masswerk
https://www.masswerk.at/nowgobang/2019/mespeak_2_0
======
kevincennis
I'm a little surprised to have not seen any mention of the Speech Synthesis
API ([https://caniuse.com/#feat=speech-
synthesis](https://caniuse.com/#feat=speech-synthesis)).

It's supported _almost_ everywhere that the Web Audio API is.

~~~
est31
For me, running window.speechSynthesis.getVoices() in the web console of both
Firefox and Chromium results in an empty list. Any idea how to populate it?
Using ubuntu packages of Firefox/Chromium. Nor does this demo work in any of
the two: [http://mdn.github.io/web-speech-api/speak-easy-
synthesis/](http://mdn.github.io/web-speech-api/speak-easy-synthesis/)

~~~
Etheryte
On macOS, the returned list contains the built-in operating system voices
(about 50) and some additional ones by Google (roughly 20). The spec [1] says
the voices made available are entirely up to the browser. Doesn't really
answer your question, but at least some additional insight.

[1] [https://w3c.github.io/speech-api/#dom-speechsynthesis-
getvoi...](https://w3c.github.io/speech-api/#dom-speechsynthesis-getvoices)

~~~
est31
Thanks for confirming that I'm looking at the right list!

------
masswerk
Author here, I'll check this every so often and try to answer any questions…

~~~
Etheryte
Very cool project and good job on releasing a new version! Libraries like
these are huge work.

One question: compared to the native text-to-speech on macOS, the synthesized
speech sounds, for a lack of a better word, robotic. Is this an inherent
property of the approach you used or a result of trying to squeeze something
as complex as this into a Javascript library?

~~~
masswerk
This is based on eSpeak [1] for Un*x environments, which is based on an
application for Acorn/Risc OS. So, yes, it's quite dated. On the other hand,
it's lean enough to be run in realtime in Emscripten...

However, all the configuration data, including phoneme tables, may be
overwritten (but you would have to install eSpeak on your machine first, in
order to compile these.)

Another approach would be actually porting this to JS (instead of cross-
compiling), by this having full access. But I simply do not have the resources
for this. (Meanwhile, there's the Web Speech Synthesis API. With this being
available on most modern clients, it's probably not worth the effort.)

[1] [http://espeak.sourceforge.net/](http://espeak.sourceforge.net/)

------
tenryuu
Haha, the article says it might not work on mobile. It completely (and
immediately) crashed Firefox Android alongside my Live Wallpaper upon pressing
the Read button

~~~
masswerk
Sorry! (Maybe an out of memory issue?)

------
dsteinman
Very nice work, Norbert. I have had an absolute ton of fun playing with your
older version and ended up writing wrapper library around your code to add
some similar features (webworkers, voices, visualizer) but done in a slightly
different way.

[https://github.com/jaxcore/jaxcore-
speak/](https://github.com/jaxcore/jaxcore-speak/)

~~~
masswerk
Interesting! Workers fail for me on iOS (even with an ontouch-
preplay/unlocker. Can you confirm Android?

If so, I may enable them again for Android based systems.

~~~
dsteinman
Actually I edited my comment because I couldn't remember if it works on IOS. I
just double checked and yeah my code fails on IOS also but does work fine
(albeit slowly) on Android.

~~~
masswerk
Please check this test application:

[https://www.masswerk.at/mespeak/android-worker-
test.html](https://www.masswerk.at/mespeak/android-worker-test.html)

~~~
dsteinman
It didn't seem to work on my tablet (samsung tab, few years old).

~~~
masswerk
Thanks! (Even, if reasults aren't what we may have hoped for.)

~~~
dsteinman
Feel free to look through my code, I haven't touched it in a few months but
does seem to work alright on Android. I had to change how the espeak files get
loaded quite a bit.

------
matthewtoast
Beware, this code is licensed under the GPL.

------
stevefan1999
Why did I read Meeseeks.js 2.0 initially...

~~~
asaddhamani
Look at me!

