Discussion:
[chromium-discuss] Yet another topic on Chromium + Speech Synthesis TTS (Raspberry)
Juliosor
2018-07-30 12:15:53 UTC
Permalink
After a lot of googling, visiting many forums (here, SO, askubuntu.com,
raspberrypi ...) and testing in many ways, I haven't found a solution (nor
anyone else apparently), posts are either old, incomplete or unsolved. I
come searching for solutions (and hell I will document them if found).

*Desired Output*

Chromium parses strings to audio with the native Javascript SpeechSyntesis
library.

*Problem*

Chromium returns empty *voices *array first, then upon reload Ctrl + R
finds all the voices, but returns a robotic-like, incomprehensible voice.

*Code*














*<html><head><meta
charset="utf-8"/><script>window.speechSynthesis.onvoiceschanged = e => { //
Words to talk var utterance = new SpeechSynthesisUtterance('Hello hell');
// This is empty console.log(window.speechSynthesis.getVoices()); voices =
window.speechSynthesis.getVoices(); // This is empty as well
console.log(voices); utterance.voice = voices.filter(function(voice) {
return voice.name == "english espeak-ng"; })[0]; // This is null
console.log(utterance.voice);
window.speechSynthesis.speak(utterance);}</script></head><body></body></html>*

*Output (in Chromium's Dev. console)*

Array(0) x2
null

** Robotic noises **

*After browser reload:*

(95) [SpeechSynthesisVoice, SpeechSynthesisVoice, ...] x2
{SpeechSynthesisVoice {voiceURI: "english espeak-ng", name: "english
espeak-ng", lang: "", localService: true, default: false}

** Robotic noises **

*Deploy*

From terminal: chromium-browser textToSpeech.html --enable-speech-dispatcher

*System and software versions*

- Raspberry pi 3B+ 1GB 1.3
- Raspbian GNU/Linux 9 (stretch)
-
- Chromium 65.0.3325.181 Built on Raspbian 9.4
- Advanced Linux Sound Architecture Driver Version k4.14.50-v7+
-
- PulseAudio card 10.0
- Installed --> speech-dispatcher 0.8.6
- Installed --> eSpeak text-to-speech: 1.48.15 (eSpeak-ng not regular)

*Notes*

- Installing regular eSpeak does nothing.
- Using *--enable-speech-synthesis* flag is necessary for chromium to
detect the voices, but raises a *"You are using and unsupported
command-line flag..."* in the browser. Without this flag, no noise is
ever made or voices ever detected in any reload.
- A similar version of this code works fine in Chrome 67.0.3396.99 (32
bits) for Windows 10 (32 bits) (replacing *voice.name* for *voice.lang
== "en-UK"* ).
- No Google API keys are being used in either of the OS.
- *spd-conf and spd-conf -d* do not exist or work in the Raspberry
terminal.
- External libraries like ResponsiveVoice.js
<https://responsivevoice.org/> work fine (so audio is OK).
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Loading...