To convert text to speech in Node.js, there are various modules but the most popular among them is gtts
(Google Text to Speech) module.
Feature of gtts module:
- It is easy to get started and easy to use.
- It is widely used and popular for converting text to speech.
Installation of gtts module:
- You can visit the link to Install gtts module. You can install this package by using this command.
npm install gtts
- After installing gtts module, you can check your gtts version in command prompt using the command.
npm version gtts
- After that, you can create a folder and add a file, for example index.js. To run this file you need to run the following command.
Steps to run the program:
- The project structure will look like this:
- Make sure you have installed gtts module using the following commands:
npm install gtts
- Run index.js file using below command:
- After running above command, your text is converted to speech and save in your Voice.mp3 file as shown below:
So this is how you can use the gtts (Google Text to Speech) module for converting text to speech in Node.js.
- Nodejs | Automatic restart NodeJs server with nodemon
- Text to Voice conversion using Web Speech API of Google Chrome
- Text Animation with changing the color of the text using HTML & CSS
- How to create long shadow of text without using text-shadow in HTML and CSS ?
- Nodejs - Connect MongoDB with Node app using MongooseJS
- Cowsay in Nodejs using Requests library
- Nodejs | Web Crawling using Cheerio
- Web-Socket in NodeJS
- Signup Form Using Nodejs and MongoDB
- Dockerizing a simple Nodejs app
- Nodejs | DNS
- Encrypting Data in NodeJS
- Difference between NodeJS and AngularJS
- Nodejs | Jimp
- Nodejs – Connect Mysql with Node app
- Nodejs | DNS | setServers()
- NodeJS | Building simple REST API in express
- NodeJs - Handling invalid routes
- Nodejs | authentication using Passportjs and passport-local-mongoose
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.