Hi friends,
This video shows how to create audio file using google text to speech module and create automated audio file with python
Required modules: gtts
install using: pip install gtts
Sample code used in video below:
from gtts import gTTS
import os
import time
print("Hello, Welcome to Booking Agency")
get_name= input("Please Enter your Name : ")
print('\n')
print("Good Morning %s : " %get_name)
get_travel = input("What is your favourite holiday destiny?: ")
print("Well, %s is an excellent choice" %get_travel)
print('\n')
get_date = input("Please select the month you wish to travel? :")
print("Please wait until we check the ticket availibility.")
time.sleep(3)
print("Generating ticket.. please wait...")
time.sleep(3)
language = 'en'
read_text = "Hello %s, you have choosen your holiday destiny as %s and tickets are available at %s, but unfortunately due to covid 19 it is not recommended to travel outside. Please stay home and stay safe with your family" %(get_name,get_travel,get_date)
audio = gTTS(text=read_text,lang=language)
audio.save('sampleaudio.wav')
os.system('sampleaudio.wav')
#end of code
python exercises
python simple application
python tutorial
python exercises
python examples
On this page of the site you can watch the video online Python Exercise #3 | Google text to speech with python | Technolazy with a duration of hours minute second in good quality, which was uploaded by the user Technolazy 19 July 2020, share the link with friends and acquaintances, this video has already been watched 28 times on youtube and it was liked by 0 viewers. Enjoy your viewing!