Uberi/speech_recognition

Speech recognition module for Python, supporting several engines and APIs, online and offline.

What it solves

This library provides a unified interface for performing speech recognition in Python, allowing developers to easily switch between different speech-to-text engines and APIs without rewriting their core logic. It simplifies the process of capturing audio from a microphone or file and converting it into text, supporting both online cloud services and offline local engines.

How it works

The library acts as a wrapper around multiple speech recognition backends. It provides a consistent set of tools to handle audio input (via PyAudio for microphones) and then routes that audio to a chosen recognition engine. Supported backends include:

  • Offline engines: CMU Sphinx, Vosk, and OpenAI Whisper.
  • Online APIs: Google Speech Recognition, Google Cloud Speech, Wit.ai, Microsoft Azure Speech, Houndify, IBM Speech to Text, OpenAI Transcription API, Groq Whisper API, and Cohere Transcribe API.

It also includes utility functions to calibrate for ambient noise and manage audio data encoding (e.g., using FLAC).

Who it’s for

Developers building voice-controlled applications, transcription tools, or any software that requires converting spoken audio into text using a variety of available AI models and services.

Highlights

  • Multi-engine support: Compatible with a wide array of local and cloud-based speech-to-text providers.
  • Online and Offline: Supports fully offline recognition for privacy or low-latency needs via Sphinx, Vosk, or Whisper.
  • Flexible Input: Can process audio directly from the microphone or from existing audio files.
  • Ambient Noise Handling: Includes features to calibrate the energy threshold to better handle background noise.

Related

  • Project
  • Project
  • Project
  • Project
  • Project