bobby-snips-tts is an implementation of snips-tts written in Node.js. Why? Because Node.js is life!
It's a part of Bobby Assistant Project but it's designed to run in standalone. So, feel free to fork, use and modify it.
This implementation can use Google Text-To-Speech (and maybe more in the future) as replacement of pico2wave for more natural speak.
Because Google TTS (and much more TTS) are Online TTS, pico2wave is used has offline or timeout failover.
-
Select or create a Cloud Platform project.
-
Enable billing for your project.
-
Enable the Google Cloud Text-to-Speech API.
-
Set up authentication with a service account so you can access the API from your local workstation.
This guide is an exact of Official Google Text-To-Speech Project. See more on googleapis/nodejs-text-to-speech
LAME is used for converting MP3 buffer from Google TTS API to WAV buffer on the fly because Snips Audio Server play only WAV buffer.
bobby-snips-tts can work without LAME by asking WAV buffer directly from Google TTS API but WAVs are about 10 times bigger than MP3s so slower on network.
With apt-get LAME can be simply install by running
apt-get install lameSee more on LAME Website
First, you need Node.js and Git.
Go in your favorite Node.js project directory (for me /home/pi) and run
git clone https://github.com/BenjaminPoncet/bobby-snips-tts.gitMove to bobby-snips-tts directory and run
npm installCopy your JSON GOOGLE APPLICATION CREDENTIALS in bobby-snips-tts directory and rename it google-credentials.json
See top of index.js:
// Default Lang
// Available Snips language: en, fr, it, es, de, ja, ko
var defaultLang = "fr";
// pico2wave Voice Config
// Available Voices: en-US, en-GB, de-DE, es-ES, fr-FR, it-IT
var voicePico = [];
voicePico['en'] = "en-GB";
voicePico['fr'] = "fr-FR";
voicePico['it'] = "it-IT";
voicePico['es'] = "es-ES";
voicePico['de'] = "de-DE";
voicePico['ja'] = "en-US";
voicePico['ko'] = "en-US";
// Google Voice Config
// Available Voices: node listVoices.js
var voiceGoogle = [];
voiceGoogle['en'] = {voiceName: "en-US-Standard-B", voiceType: "MALE"};
voiceGoogle['fr'] = {voiceName: "fr-CA-Standard-D", voiceType: "MALE"};
voiceGoogle['it'] = {voiceName: "it-IT-Standard-A", voiceType: "FEMALE"};
voiceGoogle['es'] = {voiceName: "es-ES-Standard-A", voiceType: "FEMALE"};
voiceGoogle['de'] = {voiceName: "de-DE-Standard-B", voiceType: "MALE"};
voiceGoogle['ja'] = {voiceName: "ja-JP-Standard-A", voiceType: "FEMALE"};
voiceGoogle['ko'] = {voiceName: "ko-KR-Standard-C", voiceType: "MALE"};
// Timeout before offline Speak for Cloud TTS call (in ms)
var timeoutCloudTTS = 2500;Stop snips-tts by running
systemctl stop snips-ttsMove to bobby-snips-tts directory and run
node index.jsEdit bobby-snips-tts.service and change the path of index.js if need (default is /home/pi/bobby-snips-tts/index.js)
Move bobby-snips-tts.service in /etc/systemd/system/ directory.
Stop and disable snips-tts by running
systemctl stop snips-tts
systemctl disable snips-ttsEnable and start bobby-snips-tts by running
systemctl --system daemon-reload
systemctl enable bobby-snips-tts
systemctl start bobby-snips-ttsTODO
Snips Voice Platform
KiboOst/SNIPS-Tips and snipsco/awesome-snips for inspiration