Real-time speech-to-text streaming with OpenAI Whisper
Project description
whisperpipe
Real-time, offline speech-to-text streaming powered by OpenAI Whisper
whisperpipe is a Python library that turns your microphone into a real-time transcription pipeline powered by OpenAI's Whisper model — running entirely on your own machine. No API keys, no cloud services, no subscriptions, and no data ever leaves your device.
whisperpipe uses a dual-buffer architecture with a hybrid Voice Activity Detection (VAD) pipeline to minimize unnecessary inference and keep latency low. It is designed to plug directly into conversational AI systems and any other application that requires real-time speech-to-text: register a callback, start streaming, and every finalized sentence is delivered to your function automatically. Pause and resume control makes it easy to build turn-based interactions where the assistant stops listening while it responds, then picks up exactly where it left off.
📖 Academic Backing: This repository contains the official implementation of our paper, WhisperPipe: A Resource-Efficient Streaming Architecture for Real-Time Automatic Speech Recognition. If you use whisperpipe in your research, please cite our paper as described in the Citation section.
Features
- Real-time transcription — continuous audio capture and live text output
- Callback system — hook any function to receive transcribed text (LLM, logging, UI, etc.)
- Pause / Resume — stop listening while your assistant responds, resume on demand
- Multi-language — any language supported by Whisper
- Device selection — choose which microphone to use
- Thread-safe — designed for concurrent use
- CUDA support — automatically uses GPU if available
Installation
pip install whisperpipe
Or for the latest version directly from GitHub:
pip install git+https://github.com/Erfan-ram/whisperpipe.git
System dependencies: PyAudio requires PortAudio. On Linux:
sudo apt install portaudio19-dev, on macOS:brew install portaudio.
Quick Start
from whisperpipe import pipeStream
import time
transcriber = pipeStream(model="base", language="en")
transcriber.start_streaming()
print("Listening... Press Ctrl+C to stop")
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
transcriber.stop_streaming()
Usage Examples
With a Callback (LLM Integration)
Register any function to be called each time a sentence is finalized:
from whisperpipe import pipeStream
import time
def my_callback(text):
print(f"Transcribed: {text}")
# Send to your LLM, log it, update UI, etc.
transcriber = pipeStream(model="base", language="en")
transcriber.set_def_callback(my_callback)
transcriber.start_streaming()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
transcriber.stop_streaming()
Turn-based Conversation (Pause / Resume)
Pause listening while your assistant is speaking, then resume:
from whisperpipe import pipeStream
import time
transcriber = pipeStream(model="base", language="en")
def on_speech(text):
transcriber.pause_streaming() # Stop listening
print(f"User: {text}")
response = f"You said: {text}" # Replace with your LLM call
print(f"Assistant: {response}")
transcriber.resume_streaming() # Start listening again
transcriber.set_def_callback(on_speech)
transcriber.start_streaming()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
transcriber.stop_streaming()
For more complete examples including manual control and status checking, see example_usage.py.
Model Selection
| Model | Size | Speed | Accuracy | Recommended for |
|---|---|---|---|---|
tiny |
75 MB | Fastest | Low | Testing, prototyping |
base |
145 MB | Fast | Good | General use |
small |
466 MB | Medium | Better | Balanced performance |
medium |
1.5 GB | Slow | High | High accuracy needed |
large |
3 GB | Slowest | Best | Maximum accuracy |
API Reference
pipeStream()
pipeStream(
model="base",
language="en",
finalization_delay=10.0,
processing_interval=1.0,
buffer_duration_seconds=5.0,
debug_mode=False
)
| Parameter | Type | Default | Description |
|---|---|---|---|
model |
str | "base" |
Whisper model to load |
language |
str | "en" |
Language code ("en", "fa", "es", ...) |
finalization_delay |
float | 10.0 |
Seconds of silence before finalizing a sentence |
processing_interval |
float | 1.0 |
How often (seconds) to process buffered audio |
buffer_duration_seconds |
float | 5.0 |
Audio buffer size in seconds |
debug_mode |
bool | False |
Print internal debug logs |
Methods
| Method | Description |
|---|---|
start_streaming() |
Start microphone capture and transcription |
stop_streaming() |
Stop transcription |
set_def_callback(fn) |
Register a callback — called with (text: str) on each finalized sentence. Pass None to clear. |
pause_streaming() |
Temporarily pause audio processing |
resume_streaming() |
Resume after a pause |
is_running() |
Returns True if actively running |
is_paused() |
Returns True if currently paused |
input_devices() |
List available microphone devices with their IDs |
Requirements
- Python 3.9 – 3.12
openai-whisperpyaudiopynputsounddevice- NumPy and PyTorch (installed automatically with Whisper)
License
MIT — see LICENSE
Authors
Erfan Ramezani
Mohammad Mahdi Giahi
Contributing
Pull requests are welcome. For major changes, please open an issue first.
Citation
If you find this project useful for your research, please consider citing:
@misc{ramezani2026whisperpipe,
title = {WhisperPipe: A Resource-Efficient Streaming Architecture for Real-Time Automatic Speech Recognition},
author = {Erfan Ramezani and Mohammad Mahdi Giahi and Mohammad Erfan Zarabadipour and Amir Reza Yosefian and Hamid Ghadiri},
year = {2026},
month = apr,
publisher = {arXiv},
eprint = {2604.25611},
archivePrefix = {arXiv},
primaryClass = {cs.CL},
doi = {10.48550/arXiv.2604.25611},
url = {https://doi.org/10.48550/arXiv.2604.25611}
}
And the software repository:
@software{whisperpipe_code_2026,
author = {Erfan Ramezani and Mohammad Mahdi Giahi},
title = {WhisperPipe: Source Code and Implementation},
month = apr,
year = 2026,
publisher = {Zenodo},
doi = {10.5281/zenodo.19646625},
url = {https://doi.org/10.5281/zenodo.19646625}
}
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
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 whisperpipe-0.1.3.tar.gz.
File metadata
- Download URL: whisperpipe-0.1.3.tar.gz
- Upload date:
- Size: 24.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
555d171fc37fbc0a3932c559687b1821f4f62f5a4c1182b6fe3d018afe1abefd
|
|
| MD5 |
acc471bd64db6acfe50efe77fcb45ab7
|
|
| BLAKE2b-256 |
4df385f2c4d7d03732f9acb6113faf0ad1ea802294f1d27a4e953a699f810448
|
Provenance
The following attestation bundles were made for whisperpipe-0.1.3.tar.gz:
Publisher:
release.yaml on Erfan-ram/whisperpipe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
whisperpipe-0.1.3.tar.gz -
Subject digest:
555d171fc37fbc0a3932c559687b1821f4f62f5a4c1182b6fe3d018afe1abefd - Sigstore transparency entry: 1872606075
- Sigstore integration time:
-
Permalink:
Erfan-ram/whisperpipe@d7758a0192dac3206afca10a0daf3691f66422e8 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/Erfan-ram
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@d7758a0192dac3206afca10a0daf3691f66422e8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file whisperpipe-0.1.3-py3-none-any.whl.
File metadata
- Download URL: whisperpipe-0.1.3-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
956735753eab8f52de22f3d0005e16a8dce302386b0eef9fd5f61f882199d247
|
|
| MD5 |
dbacd80a60155b355fe921e619419e6f
|
|
| BLAKE2b-256 |
1bb93165f98536dddf6b39cd5cf389ebf6ab582629b4c1bd17494cfd9af4213d
|
Provenance
The following attestation bundles were made for whisperpipe-0.1.3-py3-none-any.whl:
Publisher:
release.yaml on Erfan-ram/whisperpipe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
whisperpipe-0.1.3-py3-none-any.whl -
Subject digest:
956735753eab8f52de22f3d0005e16a8dce302386b0eef9fd5f61f882199d247 - Sigstore transparency entry: 1872606195
- Sigstore integration time:
-
Permalink:
Erfan-ram/whisperpipe@d7758a0192dac3206afca10a0daf3691f66422e8 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/Erfan-ram
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@d7758a0192dac3206afca10a0daf3691f66422e8 -
Trigger Event:
push
-
Statement type: