Skip to content

Commit a242b48

Browse files
authored
Merge pull request #381 from Sapna2001/cli
text to speech
2 parents 024cc10 + 2f165e2 commit a242b48

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Text to Speech CLI
2+
3+
A simple script to convert text to speech.
4+
5+
## How to use the script ?
6+
7+
Installations:</br>
8+
- readline-sync</br>
9+
npm install readline-sync
10+
- gtts</br>
11+
npm install gtts</br>
12+
13+
To run the script, run this command in the terminal:</br>
14+
$ node "path_of_the_file"</br>
15+
For example:</br>
16+
$ node "c:\Users\Sapna\Desktop\hacking-tools-scripts\JavaScript\Text_to_Speech_CLI\script.js"</br>
17+
18+
Now when you run the script you will get a voice.mp3 file in your folder.
19+
20+
## Screenshot
21+
![demo](https://user-images.githubusercontent.com/56690856/99379972-5e573380-28ef-11eb-84d1-bfefba84cd15.png)
22+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
readline-sync
2+
gtts
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const gTTS = require('gtts');
2+
var readlineSync = require('readline-sync');
3+
4+
var text = readlineSync.question('Enter text');
5+
var gtts = new gTTS(text, 'en');
6+
7+
gtts.save('Voice.mp3', function (err, result){
8+
if(err) { throw new Error(err); }
9+
console.log("Text to speech converted!");
10+
});

0 commit comments

Comments
 (0)