code:
"""
@author: Rajat Bisht
"""
#---------------------------importing required modules------------------------
import pyttsx3
#--------------__main__----------------------------------
converter=pyttsx3.init()
b='''type 1 to convert text to speech
type 2 to get list of voices
type 3 to change voice'''
print(b)
converter.say(b)
converter.runAndWait()
user=input("Enter your choice: ")
for m in range(5):
if user=='1':
a=input("Enter what you want to say: ")
converter.setProperty('rate',170)
converter.say(a)
converter.runAndWait()
qeu=input("Press y if you want to save it: ")
if qeu=='y':
converter.save_to_file(a,'converted.mp3')
if user=='2':
voices = converter.getProperty('voices')
for voice in voices:
to get the info. about various voices in our PC
print("Voice:")
print("ID: %s" %voice.id)
print("Name: %s" %voice.name)
print("Age: %s" %voice.age)
print("Gender: %s" %voice.gender)
print("Languages Known: %s" %voice.languages)
if user=='3':
b=input('enter voice id: ')
a=input("Enter what you want to say: ")
c=float(input('enter the speed exapmle 1x or 2x or 3x'))
d=c*100
converter.setProperty('voice', c)
converter.setProperty('rate',d)
converter.runAndWait()
qeu=input("Press y if you want to save it: ")
if qeu=='y':
converter.save_to_file(a,'converted.mp3')
#MyFirstApp, #PythonToExe #TextToSpeechUsingPython
#pyttsx3
#PythonToExe
On this page of the site you can watch the video online MAKE TEXT TO SPEECH CONVERTER APP USING PYTHON with a duration of hours minute second in good quality, which was uploaded by the user Rajat Bisht 21 February 2021, share the link with friends and acquaintances, this video has already been watched 87 times on youtube and it was liked by 10 viewers. Enjoy your viewing!