How to convert text to speech in Node.js ? Last Updated : 27 Mar, 2023 Comments Improve Suggest changes Like Article Like Report 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 the 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. node index.js Project Structure: Filename: index.js javascript const gTTS = require('gtts'); let speech = 'Welcome to GeeksforGeeks'; const gtts = new gTTS(speech, 'en'); gtts.save('Voice.mp3', function (err, result){ if(err) { throw new Error(err); } console.log("Text to speech converted!"); }); Steps to run the program: Make sure you have installed gtts module using the following commands: npm install gtts Run the index.js file using the below command: node index.js Output: After running the 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. Comment More infoAdvertise with us Next Article How to convert text to speech in Node.js ? G gouravhammad Follow Improve Article Tags : JavaScript Web Technologies Node.js Node.js-Misc Similar Reads How to Work with 'word-count' Module in Node.js ? The word-count module is a lightweight and straightforward Node.js library designed to count words in a given text or string. It provides a convenient way to analyze text content programmatically, which can be useful in various applications such as text processing, analytics, and content management. 3 min read How can you cast a simple spell in Node.js ? Node.js is a cross-platform, open-source back-end JavaScript runtime environment that uses the V8 engine to execute JavaScript code outside of a web browser. Node.js allows developers to utilize JavaScript to create command-line tools and server-side scripting, which involves running scripts on the 1 min read How to Render Plain Text of HTML in Node.js ? Rendering plain text from HTML in Node.js can be useful for various applications, such as generating plain text email content, creating summaries, or extracting data from web pages. This article will guide you through the steps to achieve this using Node.js. Express Js is the web application framewo 2 min read How to Take Input in Node.js ? Taking input in a Node.js application is essential for building interactive command-line interfaces, processing user input, and creating dynamic applications. Node.js provides several methods for receiving input from users, including reading from standard input (stdin), command-line arguments, and u 2 min read How to handle badwords in Node.js ? The bad-words module is used to handle the bad-words by cleaning the given string. It is a JavaScript filter for bad words. This module searches for profane words and replaces them with placeholder characters. Feature of bad-words module: It is easy to get started and easy to use.It is a widely use 2 min read Like