Text to voice converter - python
Hello guys,
in today's blog, I am going to show you how you can make your own text-to-speech converter.
this project is actually very easy to understand because we have already a pre-built library we just wanna use that library to make this project
ok before diving into the project we need some pre-requirements :
1. install gtts library (open your vs code editor -> open terminal -> new terminal ->type - pip install gtts
2. a basic understanding of Python syntax
now let's see the code for the project:
first, you need to import the gtts file previously installed
once you install next create a function for taking user input
create a function called text to speech pass the text that is user-entered.
next call the function for achieving our project :
#create an output file to convert text into speech
#now call gTTS inside the gTTS
#assign text to store the text we wanna change into speech
#assign lang to setting the language
#assign slow = False for the speed of the voice
Now we have completed this project code here is the full code :
once you run the code the output will be like this :
once you enter the text immediately it creates a file called speech.mp3
.png)
.png)
.png)
Comments
Post a Comment