This Python script utilizes the speech_recognition library to enable speech-to-text dictation. The code allows for continuous speech recognition, converting spoken words into text and typing them using the pyautogui library.
-
Python 3
-
Install required Python libraries:
pip install pyautogui pip install SpeechRecognition
-
Clone this repository:
git clone https://github.com/your-username/your-repository.git
-
Navigate to the project directory:
cd your-repository -
Run the script:
python your_script.py
- Start and stop dictation using voice commands.
- Continuously transcribe spoken words into text.
- Typing the transcribed text using
pyautogui. - Graceful handling of stop commands to end dictation.
start: Initiates the dictation process and continuously listens in the background.stop: Stops the dictation process.callback: Callback function for speech recognition, typing the recognized words usingpyautogui.
- Creates an instance of the
Dictationclass and starts the dictation process.
- Takes an input text and returns a string spelling out each letter.
To test the script, run the provided test() function. Speak into the microphone, and the recognized words will be typed using pyautogui. The dictation will stop when you say "stop," "dictate," or "jarvis."
from your_script import test
test()