This project is a Python-based program that:
- Listens to your voice using a microphone.
- Converts spoken words into text.
- Allows interaction via voice commands.
- Speech Recognition: Captures and understands your voice input.
- Speech-to-Text: Responds using a natural-sounding voice.
- Continuous Listening: Keeps running until stopped manually.
- Python 3.7 or higher
- Libraries:
pyttsx3
: For text-to-speech functionality.speech_recognition
: For recognizing spoken words.
Install the required libraries:
pip install pyttsx3 SpeechRecognition
- The program uses the
speech_recognition
library to listen to audio input from your microphone. - Converts the audio into text using Google’s speech recognition API.
- Responds or processes commands based on the spoken input.
- Run the script:
python Speech-to-Text.py
- Speak into the microphone. The program will:
- Print what you said as text.
- Ask you to repeat if it doesn’t understand.
- The loop continues until you manually stop it.
- Voice Settings: Configurable through
pyttsx3
(e.g., voice type, rate of speech). - Thresholds:
pause_threshold
: Controls how long the program waits for a pause in speech.energy_threshold
: Sets the microphone sensitivity to ambient noise.
- Ensure your microphone is properly configured and working.
- Speak clearly for better recognition.
- Modify the speech rate or voice settings in the code if needed:
engine.setProperty("rate", 150) # Adjusts the speed of speech engine.setProperty("voice", voices[1].id) # Changes the voice
This project is open-source and can be used or modified for learning or personal projects.