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 ? 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 Build a Text to Speech Converter using HTML, CSS & Javascript A text-to-speech converter is an application that is used to convert the text content entered by the user into speech with a click of a button. A text-to-speech converter should have a text area at the top so that, the user can enter a long text to be converted into speech followed by a button that 3 min read How to Generate and Validate OTPs in Node.js with 'Speakeasy' Module ? Speakeasy is a very important and useful npm module that can generate and validate OTPs (One Time Passwords). OTPs are mainly used for security-related purposes. This module basically supports two types of OTPs: TOTP and HOTP. The main difference between these two types of OTPs is TOTP generates a t 3 min read How to write âBeautiful Lifeâ in Node.js ? Node.js is an open-source and cross-platform runtime environment for executing JavaScript code outside a browser. You need to remember that NodeJS is not a framework and itâs not a programming language. Most people are confused and understand itâs a framework or a programming language. We often use 1 min read Text to Voice conversion using Web Speech API of Google Chrome Creating a web app that converts text to speech incorporated to it sounds pretty cool, and if all these facilities are available without the interference of any third party library then it is even more easy to implement. The web speech API provides with basic tools that can be used to create interac 5 min read How to Create Sentiment Analysis Application using Node.js ? Sentiment Analysis is a natural language processing technique used to determine emotions from textual data. It's often performed to know customer requirements, study product sentiment in user feedback, decision-making, and more.Types of Sentiment Analysis:Fine-grained Sentiment Analysis: It is done 10 min read Like