- Back to Home »
- NodeJS , Python , Text-to-Speech »
- Google Text-to-Speech with Python and Nodejs
Tuesday, February 18, 2020
A. FOR PYTHON
1.Install
$ pip install gTTS
Link:
https://pypi.org/project/gTTS/
2.Using
https://gtts.readthedocs.io/en/latest/index.html
2.1 Command line
List available languages:
$ gtts-cli --all
$ gtts-cli 'hello' --output hello.mp3
2.2 Python script
Ex:
from gtts import gTTS tts = gTTS('anh yêu em mãi mãi không rời xa', lang='vi') tts.save('hello1.mp3')
B. FOR NODEJS
https://github.com/zlargon/google-tts
1. Install
$ npm install google-tts-api --save
2.Using
Ex:
https://github.com/zlargon/google-tts/blob/master/example/download.js
Note: RECOMMENT to use NODE
because node very fast, python very slow ><