pocketsphinx
Official Python bindings for PocketSphinx
What it is and what it does
PocketSphinx is a mature, speaker-independent continuous speech recognition engine originally developed at Carnegie Mellon University. It provides Python bindings to recognize speech from live microphone streams or pre-recorded audio files, supporting both general speech-to-text transcription and keyword spotting. The package includes built-in language models and dictionaries for US English and can be extended with custom models.
The library offers two main interfaces: LiveSpeech for real-time microphone input and AudioFile for processing recorded audio. It depends on sounddevice for audio I/O and requires the PortAudio library on most systems. Development has largely ceased and the engine is acknowledged to be far from state-of-the-art, but it remains actively maintained and is used in production by many projects.
Use it for:
- Build offline speech-to-text applications that don't require cloud API calls or internet connectivity.
- Implement keyword spotting or wake-word detection in IoT or embedded voice applications.
- Process batch audio files to extract transcriptions with custom language models.
- Create voice command interfaces for desktop or server applications with low latency requirements.
- Prototype speech recognition features without dependency on external speech recognition services.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PocketSphinx provides Python bindings for Carnegie Mellon University's open-source speech recognition engine, enabling continuous speech-to-text and keyword spotting from live microphone input or audio files.
Yes, if you need offline speech recognition without cloud dependencies and can accept that the engine is mature but no longer state-of-the-art. Install friction is moderate (system library required on Linux/macOS), but prebuilt wheels ease setup. No security vulnerabilities are known. Best suited for keyword spotting, voice commands, and prototyping rather than high-accuracy transcription tasks.
Install
pocketsphinx on PyPI
pip
pip install pocketsphinxuv
uv add pocketsphinxpoetry
poetry add pocketsphinxInstalling pocketsphinx
Before you install
Medium install friction due to compiled wheels and a system dependency: PortAudio (libportaudio2 on Debian) is required for the LiveSpeech class to function. Prebuilt wheels are available for recent Python versions on common platforms. The package is actively maintained with a recent release (69 days old) and 4332 repository stars.
License in practice
Licensed under a permissive BSD-like license, which allows commercial and private use with minimal restrictions. No licensing concerns for typical adoption.
Quickstart
pip install pocketsphinx
from pocketsphinx import LiveSpeech
for phrase in LiveSpeech():
print(phrase)
PortAudio library must be installed on the system (libportaudio2 on Debian-like systems) for LiveSpeech to work; AudioFile class does not require it.
Verify before relying
- Whether the package's accuracy and model quality meet requirements for production speech recognition tasks.
- Performance characteristics and latency for real-time transcription on typical hardware.
- Availability and quality of language models beyond the default US English model.
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — sounddevice |
| Maintenance | actively maintained — 69 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 382,553/month — #7,086 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pocketsphinx-5.1.1-cp311-cp311-macosx_10_9_universal2.whl; pocketsphinx-5.1.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pocketsphinx-5.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; pocketsphinx-5.1.1-cp311-cp311-musllinux_1_2_aarch64.whl; pocketsphinx-5.1.1-cp311-cp311-musllinux_1_2_x86_64.whl; pocketsphinx-5.1.1-cp311-cp311-win_amd64.whl; pocketsphinx-5.1.1-cp313-cp313-macosx_10_13_universal2.whl; pocketsphinx-5.1.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pocketsphinx-5.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; pocketsphinx-5.1.1-cp313-cp313-musllinux_1_2_aarch64.whl; pocketsphinx-5.1.1-cp313-cp313-musllinux_1_2_x86_64.whl; pocketsphinx-5.1.1-cp313-cp313-win_amd64.whl
Keywords: asr, speech
Tags
More Speech packages
Performs speech recognition and transcription…
permissive · top 5,000 on PyPI
gTTSgTTS converts text to speech using Google…
permissive · top 5,000 on PyPI
lhotseLhotse prepares multimodal (speech, audio,…
permissive · top 5,000 on PyPI
piper-ttsPiper TTS is a local neural text-to-speech…
copyleft · top 5,000 on PyPI
funasrFunASR is a speech recognition toolkit that…
permissive · top 15,000 on PyPI
aic-sdkPython bindings for ai-coustics audio…
permissive · top 15,000 on PyPI
sherpa-onnxSherpa-onnx runs speech recognition,…
permissive · top 15,000 on PyPI
sherpa-onnx-coresherpa-onnx-core provides pre-built ONNX…
permissive · top 15,000 on PyPI
onnx-asrAutomatic Speech Recognition using ONNX models…
permissive · top 15,000 on PyPI
openwakewordopenWakeWord detects wake words and phrases in…
permissive · top 15,000 on PyPI
voskVosk provides offline speech recognition for…
permissive · top 15,000 on PyPI
pyobjc-framework-SpeechProvides Python bindings to macOS's native…
permissive · top 15,000 on PyPI
deepgram-sdkOfficial Python SDK for Deepgram's speech…
permissive · top 5,000 on PyPI
qwen-asrQwen3-ASR provides speech recognition and…
permissive · top 15,000 on PyPI
whisperxWhisperX performs fast automatic speech…
permissive · top 5,000 on PyPI