An experimental Text-To-Speech module for MagicMirror² which uses the Web Speech API of the browser.
This module is still under construction and only works partially!
The architecture of the module is still not good, but the approach of using the Web Speech API makes sense and is worth pursuing further.
I am currently investing my time in other projects, but I am happy to receive PRs or talk about issues.
So far, only German is supported, but other languages are to follow. Support would be very welcome!
- Greeting with time at the start of the MagicMirror².
- Read aloud by pressing key:
- Time
- Departures from MMM-PublicTransportHafas
- Clone this module into your MagicMirror² modules folder.
cd ~/MagicMirror/modules
git clone https://github.com/KristjanESPERANTO/MMM-WebSpeechTTS/
- Install dependencies:
sudo apt-get install espeak-ng speech-dispatcher
Add the configuration of the module to your config.js
:
{
module: "MMM-WebSpeechTTS",
position: "top_left",
config: {
greetingsAtStartup: true,
modules: ["MMM-PublicTransportHafas"]
}
},
Option | Default | Description |
---|---|---|
greetingsAtStartup |
true |
If true, the MagicMirror² will greet you after it has started. |
hidden |
true |
Set the value to false if you want to see the text that is read out on your mirror. |
modules |
[] |
Array of modules which you wanna use. Till now only "MMM-PublicTransportHafas" is possible. |
text |
"MMM-WebSpeechTTS" |
Text to display at startup if hidden:false . |
Key | Modul | Description |
---|---|---|
g |
built-in |
Greeting. |
s |
built-in |
Stop the reading. |
t |
built-in |
Tell the time. |
d |
"MMM-WebSpeechTTS" |
Read the departures. |
You have to modify the way you are starting MagicMirror². You have three options:
Add script to package.json:
"start:tts": "speech-dispatcher -s -t 0 & npm run start -- --enable-speech-dispatcher",,
Start with: npm run start:tts
Run speech-dispatcher -s -t 0 & npm run start -- --enable-speech-dispatcher
instead of npm run start
.
Start with: npm run server
and open MagicMirror² in Firefox.
ToDo: Test with other browsers.
Go to the module’s directory and pull the latest version from GitHub:
cd ~/MagicMirror/modules/MMM-WebSpeechTTS
git pull
- Use MMM-Keypress instead of self handling keys
- Mention in MMM-Public-TransportHafas that TTS is possible with this module
- Translations
- Read messages from notifications like other modules.