Skip to main content

Hybrid Speech-to-Text using Faster-Whisper and SpeechRecognition

Project description

FastSTT

FastSTT is a lightweight, hybrid Speech-to-Text Python library with real-time microphone and audio file transcription. Ideal for virtual assistants, chatbots, and low-latency voice input applications.

Features

  • Offline transcription with low latency
  • Real-time microphone transcription
  • Audio file transcription (WAV, MP3, M4A, etc.)
  • Optional timestamps for segments
  • Automatic or forced language detection
  • Lightweight and easy to use
  • Compatible with Python 3.10+

Installation

You can install FastSTT using pip:

pip install faststt

Note: Microphone support requires PyAudio installed. On some systems, you may need system dependencies:

Ubuntu/Debian:

sudo apt-get install portaudio19-dev

Windows: Use the prebuilt PyAudio wheel for your Python version.

Usage

1. Transcribe from microphone

from faststt import FastSTT
import logging

logging.basicConfig(level=logging.INFO)

stt = FastSTT(model_size="base", device="cpu")

print("Speak something...")
text = stt.listen_and_transcribe(timeout=5, phrase_time_limit=10)

print("Transcription:", text)

2. Transcribe from microphone in real-time

from faststt import FastSTT
import logging

logging.basicConfig(level=logging.INFO)

stt = FastSTT(model_size="base", device="cpu")

print("Listening continuously. Press Ctrl+C to stop.\n")

try:
    while True:
        text = stt.listen_and_transcribe(timeout=3, phrase_time_limit=5)
        if text and isinstance(text, dict):
            print("Transcription:", text["text"])
        else:
            print("...no speech detected.")
except KeyboardInterrupt:
    print("\nStopped by user.")

3. Transcribe from audio file

from faststt import FastSTT

stt = FastSTT(model_size="base", device="cpu", compute_type="int8")

file_path = "audio_file.wav"
result = stt.listen_from_file(file_path, with_timestamps=True)

if result:
    print("Transcription with timestamps:")
    for seg in result:
        print(f"[{seg['start']:.2f}s - {seg['end']:.2f}s]: {seg['text']}")
else:
    print("Transcription failed.")

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

faststt-0.1.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

faststt-0.1.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file faststt-0.1.1.tar.gz.

File metadata

  • Download URL: faststt-0.1.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for faststt-0.1.1.tar.gz
Algorithm Hash digest
SHA256 df1dca0b2001757444e31bee74d2b58ba6837e5094a09a46c6d1a38baeb7ea11
MD5 8d4c925368afc4ec9e474efa249d5b00
BLAKE2b-256 1973274fda74ccb023ab3d96be49cddb111cc83752163ac5a0a905e216ad246e

See more details on using hashes here.

File details

Details for the file faststt-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: faststt-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for faststt-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72cca4ce632b5321e48e472de225b256e67caaca61c72db1a7fc28daf7b0895f
MD5 19cfdd794f7f54d21641a6b97580349a
BLAKE2b-256 f91bcc2a44d050462ea1c2db2eb3599f9c47e2d3638dd65c042e4c6aae438b2c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page