File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed
JavaScript/Text_to_Speech_CLI Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 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 number Diff line number Diff line change 1+ readline-sync
2+ gtts
Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments