![]() Then retrieves that text from the file and convert it into a speech. Define Buttons Button(root, text = "PLAY", font = 'Verdana 15 bold', command = Text_to_speech, width =4).place(x=30, y=150)īutton(root,text = 'EXIT',font = 'Verdana 15 bold', command = Exit, bg = 'OrangeRed1').place(x=100,y=150)īutton(root, text = 'RESET', font='Verdana 15 bold', command = Reset).place(x=185, y =150)īutton() widget used to display button on the windowroot.This is a simple python project that extracts the text from the image. Reset function set Msg variable to empty strings. stroy() will quit the program by stopping the mainloop(). ![]() ![]() speech.save(‘DataFlair.mp3’) will saves the converted file as DataFlair as mp3 file.speech stores the converted voice from the text.The default is False.Īs we want the default value of lang, so no need to give that to gTTS. lang takes the language to read the text.text is the sentences or text to be read.Message variable will stores the value of entry_field.Function to Convert Text to Speech in Python def Text_to_speech(): place() organizes widgets by placing them in a specific position in the parent widgetģ.textvariable used to retrieve the current text to entry widget.Entry() used to create an input text field.root is the name which we refer to our window.Label() widget is used to display one or more than one line of text that users can’t able to modify. Label(root, text ='Enter Text', font ='Verdana 15 bold', bg ='white smoke').place(x=30,y=70)Įntry_field = Entry(root,textvariable =Msg, width ='50') Label(root, text ='Techarge', font ='Verdana 15 bold', bg = 'white smoke').place(x=190,y=260) Label(root, text = 'TEXT TO SPEECH', font='Verdana 30 bold', bg ='white smoke').place(x=30,y=10) bg will used to set the color of the background.configure() used to access window attributes.geometry() used to set the width and height of the window.Tk() to initialized tkinter which will be used for GUI.Let’s start by importing the libraries: tkinter, gTTS, and playsound from tkinter import *įrom playsound import playsound Initializing window root = Tk() So these are the basic steps that we will do in this Python project. In this project, we add a message which we want to convert into voice and click on play button to play the voice of that text message. To install the required libraries, you can use pip install command: With this module, we can play a sound file with a single line of code. The playsound module is used to play audio files.gTTS ( Google Text-to-Speech) is a Python library, which is a very easy library that converts the text into audio.Tkinter is a standard GUI Python library that is one of the fastest and easiest ways to build GUI applications using Tkinter.To implement this project, we will use the basic concepts of Python, Tkinter, gTTS, and playsound libraries. Text to speech python project is very helpful for people who are struggling with reading. Text to speech project takes words on digital devices and convert them into audio with a button click or finger touch. Text to speech is a process to convert any text into voice. Hope you are doing great! Today, We are going to see how can we create text to Speech using Python Function to Convert Text to Speech in Python
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |