https://github.com/blazeinferno64/text-to-speech
A simple text to speech program made in Python
https://github.com/blazeinferno64/text-to-speech
Last synced: 4 months ago
JSON representation
A simple text to speech program made in Python
- Host: GitHub
- URL: https://github.com/blazeinferno64/text-to-speech
- Owner: BlazeInferno64
- License: gpl-3.0
- Created: 2024-03-20T07:01:06.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-22T13:24:32.000Z (over 1 year ago)
- Last Synced: 2025-02-26T00:13:44.447Z (8 months ago)
- Language: Python
- Size: 42.1 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Introduction
Ever wanted to make your PC speak?
Fortunately its possible now :)
|-----|
# AboutThis program needs python to work,
So if you don't have it download from here -
https://python.org/download
This example will show you how you can make your PC say,whatever you want!
But-but it wont happen until you install the required Python libraries for that!Paste the following commands in your terminal before running the program -
```
pip install pyttsx3 pyaudio
```or
```
pip install -r requirements.txt
```# Basic breakdown
Let me give you some brief breakdown details about the program!
So, basically first of all lets import some libraries into the script```python
import pyttsx3
```Then we gotta setup the voice otherwise our PC wont be able to speak!
```python
engine = pyttsx3.init()
voices = engine.getProperty("voices")
# If you want to see all the available voices on your device
# Use print(voices)
engine.setProperty("voice",voices[0].id) # For example if you want another voices, Set it to voices[1].id
```As we have setup the voice, now lets create some basic functions
```python
# This function would allow our pc to speak
def speak(input):
engine.say(input)
engine.runAndWait()
```
And then -```python
# Function for user input
def inputCommand():
textInput = input("What do you want me to speak?:\n")
text = textInput.lower()
speak(text)
```Lastly lets finish this with -
```python
# Main function setup
if __name__ == "__main__":
while True:
inputCommand()
```Alright that's it!
Also, you can run the executables made for the scripts from the `app` directory
There are 2 executables
1. TextToSpeech-1 (Its the executable for the first voice)
2. TextToSpeech-2 (Its the executable for the second voice)`
Thanks for reading :)
`
`
Have an absolutely fantastic day ahead :D
`