Skip to main content

Text to speech using python||Python practice Programs||codeandman(SourceCode)

hey guys how are you all today in this post I am going to give kyou the sourcecode of my video called "Text to speech using python||Python practice Programs||codeandman" so let's begin:



Here's the complete sourcecode:
# text to speech using python
# speak
import pyttsx3
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
text = input("Enter the text you want to speak as a machine:")
voice = engine.setProperty(voices,[0])
engine.say(text)
engine.runAndWait()

The Logic

Steps :
  • Go to your terminal and type pip install pyttsx3 and wait till the python module is installed
  • after that once again type pip install wheel in the terminal.
  • after this create a python file
  • now import pyttsx3
  • after that initialize it as the voice engine of windows called sapi5
  • Now take a input as a string and add its value to variable text
  • after this tell the python which voice do you want to use
  • now run engine.say and inside this give the text as a argument
  • now run engine.runAndWait with no arguments
  • Now run the program and enter the text you want to be spoken by the machine.
  • and now the machine will speak the text.
I hope that you liked this post.
Thank You.

Comments

Popular posts from this blog

How to create a Personal Portfolio website [source code]

  Hey guys how are you all today in this post I am going to give you the source code of my portfolio website’s part 1st video so let’s begin with this post:- Source code of Index.html file:- <DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Gautam Sharma</title> <link rel="stylesheet" href="../CSS-Files/style.css"> <link rel="stylesheet" href="../CSS-Files/utils.css"> </head> <body> <header> <nav> <li><a href="./index.html">Home</a></li> <li><a href="./Contact.html">Contact</a></li> <li><a href="./Haier.html"

Step by step guide to coding a game in Python

  How to Code a Simple Game in Python Python is a powerful and versatile programming language that can be used for a wide range of applications, including game development. In this tutorial, we will be creating a simple game using the Pygame library in Python. Pygame is a set of Python modules designed for writing video games. It provides functionality for creating 2D graphics, handling events, and playing sounds and music. By the end of this tutorial, you will have a basic understanding of how to create a game using Pygame and Python. Setting up the Development Environment Before we can start coding our game, we must set up our development environment. To do this, we will need to install Python and the Pygame library. If you already have Python installed on your machine, you can install Pygame by running the following command in your terminal: pip install pygame If you don't have Python installed, you can download the latest version from the official Python website. Once you have

How to write youtube channel description

Hey guys how are you all today in this post I am going to tell you that How to write youtube channel description . So if you want to know that how to write youtube channel description  then it is very easy there are simple tips for writing youtube channel description so now without any delay let's begin with this post:- watch the complete video here:-  https://youtu.be/CmZmozRmSFk   so guys if you want to write your channel description then you have to firstly learn that from where you have to edit your YouTube channel description. Firstly you have to open the YouTube Studio  website from there  you have to move to the customization tab. Now you have to go to the basic info option and from here youtube can edit your youtube channel description easily. How to write youtube channel description (Tips) In the first paragraph write a text which welcomes the viewer like the first paragraph of my post. In the second one write about your channel what you cover in that youtube channel etc.