Convert Text to Speech from Command Line using Google Translate API

Editor Ratings:
User Ratings:
[Total: 0 Average: 0]

gTTS is a free tool to convert text to speech from command line using Google Translate API. This is a simple command line tool which takes a piece of text from you and then converts it to audio. It saves the MP3 file as the output. You can get the audio by giving any text and it will do it for you quickly depending on the length of specified text. And the best part is that it supports multiple languages to convert text to speech. Additionally, there are some other arguments that you can add in the command to tweak the final output. However, during testing, I was able to use only one voice and didn’t see any option to change it on its documentation page as well.

There are various Text to Speech software and websites you can try. But Google’s API is more accurate and reliable and supports multiple languages. And that is why gTTS is much better text to speech converter that you can use. You can convert any given text to an audio speech by running a simple command. Also, this tool can be used in your applications to add functionality for text to speech conversion. If you are normal user or developer, you can easily use this simple command line tool in your PC and in your applications.

text to speech using google translate

Convert Text to Speech from Command Line using Google Translate API:

To use this text to speech command line tool, you just have to install it via Python After that, you can keep using it from any location on your PC and on any piece of text. And as it is written in Python, you can use this tool on almost any platform without any problem.

Make sure that you have Python is installed and PIP is working. After that, just run the following command in the command prompt or terminal window and then wait for the installation process to finish.

pip install gTTS

Pip install Gtts-cli

Now, when it has installed, you can start using it. The syntax for the main command is very simple. You just run the command in the following syntax to convert then give text to audio. The following command will save then “audio.mp3” in the current folder. But you can change it as per your convenience.

gtts-cli "InputText" --output audio.mp3

gtts-cli in action

You can see above how this simple tool works to quickly convert text to speech. The above command will generate the audio in normal speed of voice. But you can use some additional switches along with the above command to make then final speech in the audio file slower. For more technical details about this tool, you can go through its documentation here.

Final thoughts

gTTS is a very nice tool that you can use to convert text to speech. And what is best is that it uses Google Translate API to do the heavy lifting. The simplicity of this tool is what I liked best. You can easily use it from your terminal and even use it in your applications. It is open source and an actively maintained project. If you want to peek into its source code then you can find that on GitHub.

Editor Ratings:
User Ratings:
[Total: 0 Average: 0]
Free/Paid: Free

Leave A Reply


Get 100 GB FREE

Provide details to get this offer