How to Create Text to Speech from Google Colab using gTTS Library

Google Text-to-Speech (gTTS) is one of several text-to-speech library available to used on Google Colab. It has simple code and reliable to use with, for example it also provide a simple language parameter so the speech out depend on what country id will be used. Don't forget to add audio player library since gTTS will create an audio file on-the-fly and need the audio player to make a sound. Check a compact code below and run it from Google Colab:

!pip install gTTS
from gtts import gTTS
from IPython.display import Audio

tts = gTTS('Selamat datang di channel youtube eko wahyudiharto',lang='id')
tts.save('1.wav')
sound_file = '1.wav'
Audio(sound_file, autoplay=True) 
 

I wrapped above code into a 5 mins video below in  my Youtube channel (in Bahasa). Please subscribe if you haven't or send your thumbs for the video or share it if you like.


PS: Still unable how to play a loop string in a 'for' syntax. Anyone can help? Share your thoughts on below comment box. Thank you!

Labels: ,


PS: If you've benefit from this blog,
you can support it by making a small contribution.

Enter your email address to receive feed update from this blog:

Post a Comment

 

Post a Comment

Leave comments here...