Skip to content

Use Vosk speech recognition toolkit to transcribe real-time audio from your microphone.

Notifications You must be signed in to change notification settings

Nenotriple/PySpeech

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PySpeech 🎀

PySpeech is a Python script that uses the Vosk speech recognition toolkit to transcribe real-time audio from your microphone.

cover

Description πŸ“

This script initializes a Vosk model and a PyAudio stream to capture audio from your microphone. It then uses the Vosk recognizer to transcribe the audio offline, and in real-time, printing both partial and final transcriptions to the console.

Key Notes πŸ“Œ

  • The script uses the Vosk speech recognition toolkit.
  • It captures audio using PyAudio.
  • Real-time transcription is printed to the console.
  • Only tested on Windows, but it should work on Linux/Mac

Installation πŸ› οΈ

  1. Clone the repository:

    git clone https://github.com/Nenotriple/PySpeech.git
    cd PySpeech
  2. Create and activate a virtual environment:

    python -m venv venv
    venv\Scripts\activate
  3. Install the required libraries:

    pip install -r requirements.txt

Usage πŸš€

  1. Run the script:

    python PySpeech.py
  2. Speak into your microphone:

    • The script will print Listening... and start transcribing your speech.
    • Partial transcriptions will be printed as Partial: ....
    • Final transcriptions will be printed as You said: ....
  3. Stop the script:

    • Press Ctrl+C to stop the script. The script will handle the interrupt and close the audio stream gracefully. (Or close the terminal)

Additional Notes πŸ—’οΈ

  • Ensure your microphone is properly configured and accessible by PyAudio.
    • It should be the default input device.
  • The script is configured to use a sample rate of 16000 Hz and a single audio channel.
  • Additional Vosk models can be found here: https://alphacephei.com/vosk/models

About

Use Vosk speech recognition toolkit to transcribe real-time audio from your microphone.

Topics

Resources

Stars

Watchers

Forks

Languages