Repolode
Uberi

Uberi/speech_recognition

A Python library for speech recognition that wraps many online and offline engines behind one consistent interface.

Stars
8,999
Forks
2,415
Open issues
313
Last commit
2 months ago

What is it?

SpeechRecognition is a Python module for converting spoken audio into text. Instead of learning the separate APIs of each provider, developers call one Recognizer object and choose the backend per call, such as recognize_google, recognize_whisper, recognize_vosk or recognize_sphinx.

The supported backends cover both cloud services (Google Cloud Speech, Microsoft Azure Speech, IBM Speech to Text, Wit.ai, Houndify, OpenAI and Groq Whisper APIs) and local engines that work offline (CMU Sphinx/PocketSphinx, Vosk, OpenAI Whisper and Faster Whisper). OpenAI-compatible self-hosted endpoints, such as vLLM or Ollama, can also be used through the OpenAI backend.

The library reads audio from files and from microphones through PyAudio, and it includes helpers for ambient-noise energy threshold calibration and background listening. Running python -m speech_recognition after installation gives a quick way to test it.

Key features

  • 01Unified Recognizer interface that switches among many speech engines
  • 02Supports both cloud APIs and offline engines such as Vosk, Whisper and Sphinx
  • 03Reads audio from files and microphones (microphone needs PyAudio)
  • 04Ambient-noise energy threshold calibration and background listening
  • 05Works with OpenAI-compatible self-hosted endpoints

Use cases

  • Transcribing recorded audio or meeting files in a Python script
  • Building a voice command interface that listens to a microphone
  • Running offline speech-to-text on a local machine without sending audio to a cloud service
  • Comparing several recognition engines behind one code path

Quick start

  1. 1

    Install the library from PyPI

    pip install SpeechRecognition
  2. 2

    Run the built-in demo to try it out

    python -m speech_recognition

Things to know

  • Several engines need paid or cloud API keys, such as Google Cloud, Azure, OpenAI, Groq and Cohere.
  • Microphone input requires PyAudio, which needs system PortAudio installed first on some platforms.
  • Offline engines like Sphinx and Whisper need extra packages and models, and the README notes Sphinx setup can be fiddly.

In collections

Topics

FAQ

What is speech_recognition?
A Python library for speech recognition that wraps many online and offline engines behind one consistent interface. SpeechRecognition is a Python module for converting spoken audio into text. Instead of learning the separate APIs of each provider, developers call one Recognizer object and choose the backend per call, such as recognize_google, recognize_whisper, recognize_vosk or recognize_sphinx.
Is speech_recognition free to use? What license does it have?
speech_recognition is open source under the BSD-3-Clause license. Check the license terms before using it in commercial products.
Is speech_recognition still maintained?
Updated within 6 months. The last commit to speech_recognition was on Sep 2, 2026.
What can I use speech_recognition for?
Transcribing recorded audio or meeting files in a Python script Building a voice command interface that listens to a microphone Running offline speech-to-text on a local machine without sending audio to a cloud service Comparing several recognition engines behind one code path
How do I install speech_recognition?
Install the library from PyPI: pip install SpeechRecognition Run the built-in demo to try it out: python -m speech_recognition
Where can I get speech_recognition?
The source code and installation instructions are on GitHub: https://github.com/Uberi/speech_recognition

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects