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 via PyPI:
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file faststt-0.1.0.tar.gz.
File metadata
- Download URL: faststt-0.1.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2108f472ecdbcefc7c3aa827b8eee799c8fdfe027911a8e5b78b6f705b892db
|
|
| MD5 |
41dfabd851af3ffb0b972f23edbd8042
|
|
| BLAKE2b-256 |
54bf082c8f6b137f89bc706840e90965043c0f60ea22f59a6f346be192a1f488
|
File details
Details for the file faststt-0.1.0-py3-none-any.whl.
File metadata
- Download URL: faststt-0.1.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5f8cdd69cac1655ce941c535798e7a041d2860e88181d6d09cdeb258f2fdb68
|
|
| MD5 |
c0e96f32e2b9d0b9461faa3c6b6b417b
|
|
| BLAKE2b-256 |
be702b785f9161540694b078affcc1d67f0e4e7e92f7cb0672ec89c267640944
|