█

AI/TLDR

Buy me a coffee
Buy me a coffee

SpeechRecognition

One Python API in front of a dozen speech-to-text engines

Audio, Music & VoiceOpen source
Language
Python
License
BSD-3-Clause
$pip install SpeechRecognition
IN SHORT

What is SpeechRecognition?

SpeechRecognition is a long-running Python library that gives you a single interface for turning audio into text, whichever engine is behind it. You write the capture and recognition code once, then choose — or switch — between offline and hosted backends without restructuring your program. It sits in the Audio, Music & Voice category of the Multimodal Generation tools and is open-source, written in Python and licensed BSD-3-Clause.

Overview

SpeechRecognition is a long-running Python library that gives you a single interface for turning audio into text, whichever engine is behind it. You write the capture and recognition code once, then choose — or switch — between offline and hosted backends without restructuring your program.

The offline options are CMU Sphinx, the Vosk API, OpenAI Whisper running locally, Tensorflow and Snowboy hotword detection. The online options include Google Speech Recognition and Google Cloud Speech, Microsoft Azure Speech, IBM Speech to Text, Wit.ai, Houndify, the OpenAI transcription API, Groq's Whisper API and Cohere Transcribe. That spread is the point: prototype against a free hosted endpoint, then move to a local Whisper or Vosk model when privacy, cost or latency demands it.

It also handles the unglamorous part — microphone capture and audio-file loading — which is why it remains a common first dependency for voice projects. It is maintained by Anthony Zhang (Uberi), requires Python 3.10 or newer, and is released under the 3-clause BSD licence.

What it does

  • One recognition API across many backends, so swapping engines is a call change rather than a rewrite
  • Offline engines: CMU Sphinx, Vosk, local OpenAI Whisper, Tensorflow, and Snowboy hotword detection
  • Online engines: Google Speech Recognition, Google Cloud Speech, Azure Speech, IBM Speech to Text, Wit.ai, Houndify, OpenAI, Groq Whisper and Cohere Transcribe
  • Built-in microphone capture as well as audio-file input
  • Permissive 3-clause BSD licence, suitable for commercial use
  • Ships runnable examples, including microphone_recognition.py and audio_transcribe.py

Getting started

Install from PyPI and run the built-in module to confirm your microphone and defaults work before writing any code. Python 3.10+ is required.

Install the package

bashbash
pip install SpeechRecognition

Check the install against your microphone

The package is runnable as a module — the fastest way to confirm audio capture works on your machine.

bashbash
python -m speech_recognition

Work from the bundled examples

The examples/ directory in the repository holds the canonical starting points: microphone_recognition.py for live capture and audio_transcribe.py for transcribing a file. Pick the recognizer method matching the engine you want, and add that engine's credentials or model as needed.

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Reach for it when prototyping a voice feature and you do not yet know which recognition engine you will ship with
  • Reach for it to move an existing prototype from a hosted API to local Whisper or Vosk without rewriting the audio layer
  • Reach for it for batch transcription of recorded audio files in a Python pipeline
  • Reach for it when you need microphone capture handled for you rather than dealing with PortAudio directly

How SpeechRecognition compares

SpeechRecognition alongside other open-source audio, music & voice tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
VoiceStudio★ 121kA local-first desktop voice studio that clones and designs voices, dubs video, and handles dictation, running 16 text-to-speech and 11 speech-recognition engines on your own hardware.
Whisper★ 114kOpenAI's speech recognition model that transcribes and translates audio across many languages.
GPT-SoVITS★ 64.3kAn open-source WebUI that clones a voice from a short audio sample and turns text into speech, with zero-shot and few-shot fine-tuning.
Voicebox★ 61.6kLocal-first voice studio that clones a voice from a short sample, generates speech across seven TTS engines and 23 languages, handles system-wide dictation, and speaks for agents over MCP.
VibeVoice★ 57.6kMicrosoft's text-to-speech model for generating long, expressive multi-speaker audio like podcasts.
whisper.cpp★ 55.7kA dependency-free C/C++ port of Whisper built on ggml, running speech recognition on CPU, Metal, CUDA, Vulkan and NPUs from phones to servers.
Coqui TTS★ 46.3kA library of text-to-speech models including the multilingual XTTS voice-cloning model.
SpeechRecognition★ 9kOne Python API in front of a dozen speech-to-text engines