Giter Club home page Giter Club logo

bobby-snips-tts's Introduction

bobby-snips-tts

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.

Dependencies

Get Google Text-To-Speech API Key

  1. Select or create a Cloud Platform project.

    Go to the projects page

  2. Enable billing for your project.

    Enable billing

  3. Enable the Google Cloud Text-to-Speech API.

    Enable the API

  4. 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

Install LAME

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 lame

See more on LAME Website

Install bobby-snips-tts

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.git

Move to bobby-snips-tts directory and run

npm install

Copy your JSON GOOGLE APPLICATION CREDENTIALS in bobby-snips-tts directory and rename it google-credentials.json

Voice configuration

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;

Manual run (for testing)

Stop snips-tts by running

systemctl stop snips-tts

Move to bobby-snips-tts directory and run

node index.js

Run as a service

Edit 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-tts

Enable and start bobby-snips-tts by running

systemctl --system daemon-reload
systemctl enable bobby-snips-tts
systemctl start bobby-snips-tts

Todo

TODO

Credits

Snips Voice Platform

KiboOst/SNIPS-Tips and snipsco/awesome-snips for inspiration

bobby-snips-tts's People

Contributors

benjaminponcet avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dragonskymine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.