Text to Speech using python


Text2speech

Today's video we are going to create Text to speech using python

First of all you have to install pyttsx3 library

Pyttsx3- Pypl

You can just write pip install pyttsx3 in your cmd or Powershell. It will start installing in your system environment.

After installation, open your text editor or IDE.

Import libraries

Just Import pyttsx3

import pyttsx3 as pt

Start engine

Now it's time to start engine of pyttsx3 module.

engine= pt.init()

pt is the alias that we used instead of pyttsx3. we used init() method to initialize pyttsx3 library.

Here engine is the variable used to start the engine.

say()

say() is the pyttsx3 method to say or speek the written text.

engine.say("Hello World")

by calling the engine.say() method we are going to make our computer able to speek

runAndWait()

It is the method which tells user to run the program and wait for a bit to execute the output.

Output:- Hello World

Other Variable:-

We can also store text to other varible and just call the varible name as argument of say() method.

var= Hello this is codin india and here we are going to learn text to speech program in python

engine= pt.say(var)
engine.runAndWait()

Output:- Hello this is codin india and here we are going to learn text to speech program in python
I hope you find this tutorial helpful. Kindly subscribe to our blogspot to find the latest blog early.

I you want to learn python from scratch. Python tutorial will help you the most

Comments

Popular posts from this blog

Components of VIRTUAL REALITY (VR) | Codin india

Max Min and Nested List in Python | Python programming | Codin India

Introduction to Python Pandas | Data science full course with Python in Hindi