Say It Ain’t So : The Ultimate Text To Speech Node Module

There has been such innovation lately with speech and audio in our tech community today. A billion and one API’s have been made to give users the functionality of Text-to-Speech, Speech-to-Text, Speech recognition, Speech Translation and etc. (My favorite, not being biased, is honestly Microsoft Cognitive Services API– provides more than just speech functions but works great overall). Needless to say this is great for a ton of web and mobile apps but what about us hardware folk? Can we do anything with speech with out creating a web app on the backend?

Issues I have come across with using hardware, node and text-to-speech so that the hardware may play the speech has been the creation of the audio file (where the ‘speech’ is saved and played from). Either the audio buffer is not encoded correctly, the wav/mp3 file cannot be written correctly or the APIs give a link to open up in a browser to actually play the file, and I am hoping not to use any web sites/apps at all for some of my projects.

Well after playing with several Node modules and about 4 different pieces of hardware, I found a great solution (an easy one too)! Keep in mind this solution is best for having your hardware or NodeBot just implement some Text-to-Speech functionality. (Speech-to-Text on hardware is actually pretty easy, feel free to contact me if you are looking for different solutions).

So first, hardware of choice is my Raspberry Pi 2*. Why? Well you don’t have to add any extra shields or sd card writers to save an audio file and it has a auxiliary jack. You can get a more powerful USB speaker, but overall you dont need much/pricey additional hardware to get your audio playing.

And last step is implement the Say.js node module. Its great because no audio file has to be saved and it uses the voices already programmed into the operating system for voice. This module was built to work for Windows, OSX and Linux. And knowing that Raspbian is Linux based, I gave the module a try and it worked great 🙂

It is important that you follow the Linux installation steps for the module found in the README. It is nothing difficult but definitely required !



* You can implement this solution on a Pi 3, I just do not have one


Published by Gabrielle

The Unexpected Nerd | Software Engineer | Gamer | Sneaker Enthusiast | Alpha Woman💗💚

3 thoughts on “Say It Ain’t So : The Ultimate Text To Speech Node Module

      1. Yes, I’m working on a web app. We’re using laravel as our framework with php as our back and javascript as our front. But I actually found a solution to the problem and its working now. Woot! I’m changing things a bit to be cleaner but this is essentially how I got it working. If you’re using php, . Then if you have button to .play() an element with id=’tts’, it works.

Leave a Reply

%d bloggers like this: