1 min read

Build Free Text To Speech with Web API & JavaScript

Building a text to speech app could be your next project. Forget Google Text to Speech API if you are on budget, Speech Synthesis may be your better option.
Build Free Text To Speech with Web API & JavaScript

When you challenged to build an app that able to read aloud text or document, your first option is Google Text to Speech API. It is indeed powerful, and pricey. Google's solution may not suit for developer on budget.

Here is an alternative for Google Text to Speech API that you may utilize. The idea is to use a Web API, embedded in modern web browser, even mobile.

Web Speech API - Web APIs | MDN
The Web Speech API enables you to incorporate voice data into web apps. The Web Speech API has two parts: SpeechSynthesis (Text-to-Speech), and SpeechRecognition (Asynchronous Speech Recognition.)

The basic code is simply:

var speech = new SpeechSynthesisUtterance();
specch.text = "This is the way";
window.speechSynthesis.speak(speech);

You can try it now in your browser's console. The downside, it may not compatible with some browser such as IE, Web View Android & Opera.

The good part? IT IS FREE! For more practical demonstration, you may check Mohan Raj's Text to Speech quick demo