0
stars
11
commits
Python
primary language
Apr 2, 2026
updated
Real-time voice conversation system: browser mic → WebRTC → STT → LLM → TTS → browser speaker.
Browser Mic → WebRTC → VAD (silero) → STT (Whisper/Granite)
→ Mellea stream_with_chunking (LM Studio) → sentence chunks
→ Kokoro TTS → audio frames → WebRTC → Browser Speaker
The Mellea-partials library streams validated LLM output sentence-by-sentence, which maps naturally to per-sentence TTS synthesis for low-latency audio responses.
uv pip install mellea-partial-webrtc
git clone https://github.com/HendrikStrobelt/mellea-partial-webrtc
cd mellea-partial-webrtc
uv sync
Note: Three dependencies are sourced outside PyPI and require uv to resolve:
mellea(git),mellea-partial(git),en-core-web-sm(direct wheel URL). They are declared in[tool.uv.sources]and installed automatically byuv sync.
# 1. Install dependencies (uv)
uv sync
# 2. Start LM Studio and load a model, then enable the local server (default: http://localhost:1234)
# 3. Start the server
mellea-webrtc
# or: uv run mellea-webrtc
# 4. Open http://localhost:8080 in your browser, click Start, and speak
mellea-partial-webrtc/
├── pyproject.toml # project metadata and dependencies
├── src/
│ └── mellea_webrtc/
│ ├── __init__.py
│ ├── server.py # aiohttp app, WebRTC signaling, entry point
│ ├── pipeline.py # Orchestrates VAD → STT → LLM → TTS per utterance
│ ├── vad.py # Silero-VAD wrapper, detects utterance boundaries
│ ├── stt.py # STT protocol + Whisper & Granite backends
│ ├── llm.py # Mellea-partials integration (stream_with_chunking)
│ ├── tts.py # Kokoro TTS wrapper
│ ├── audio_utils.py # Resample/format conversion helpers
│ ├── tracks.py # Custom MediaStreamTrack for TTS output
│ └── static/
│ └── index.html # Browser client
└── tests/
└── test_stt.py # Standalone WebRTC test client
All options are set via environment variables:
| Variable | Default | Description |
|---|---|---|
STT_BACKEND | whisper | whisper or granite |
WHISPER_MODEL | base | base, small, or medium |
LM_STUDIO_URL | http://localhost:1234/v1 | LM Studio OpenAI-compatible endpoint |
LM_STUDIO_MODEL | local-model | Model name as shown in LM Studio |
TTS_VOICE | bf_emma | Kokoro voice (British English bf_* voices) |
HOST | 0.0.0.0 | Server bind address |
PORT | 8080 | Server port |
Example with custom settings:
LM_STUDIO_MODEL="llama-3.2-3b" WHISPER_MODEL="small" mellea-webrtc
Uses faster-whisper, runs on CPU, no GPU required.
STT_BACKEND=whisper mellea-webrtc
Uses IBM Granite Speech via transformers. Requires a CUDA GPU and additional dependencies:
uv sync --extra granite
STT_BACKEND=granite mellea-webrtc
Set GRANITE_MODEL to override the default model (e.g. ibm-granite/granite-speech-3.3-8b).
Key packages:
bf_emma)| Stage | Sample Rate | Format |
|---|---|---|
| WebRTC in/out | 48 kHz | s16 mono, 960 samples/frame (20ms) |
| VAD / STT | 16 kHz | float32 mono |
| TTS output | 24 kHz | float32 mono |
One utterance is processed at a time. When speech is detected, further utterances are queued until the current response finishes playing.
en_core_web_sm spacy model (installed automatically via uv sync).11 commits
Python
76.2%
HTML
23.8%
0
stars
11
commits
Python
primary language
Apr 2, 2026
updated
Real-time voice conversation system: browser mic → WebRTC → STT → LLM → TTS → browser speaker.
Browser Mic → WebRTC → VAD (silero) → STT (Whisper/Granite)
→ Mellea stream_with_chunking (LM Studio) → sentence chunks
→ Kokoro TTS → audio frames → WebRTC → Browser Speaker
The Mellea-partials library streams validated LLM output sentence-by-sentence, which maps naturally to per-sentence TTS synthesis for low-latency audio responses.
uv pip install mellea-partial-webrtc
git clone https://github.com/HendrikStrobelt/mellea-partial-webrtc
cd mellea-partial-webrtc
uv sync
Note: Three dependencies are sourced outside PyPI and require uv to resolve:
mellea(git),mellea-partial(git),en-core-web-sm(direct wheel URL). They are declared in[tool.uv.sources]and installed automatically byuv sync.
# 1. Install dependencies (uv)
uv sync
# 2. Start LM Studio and load a model, then enable the local server (default: http://localhost:1234)
# 3. Start the server
mellea-webrtc
# or: uv run mellea-webrtc
# 4. Open http://localhost:8080 in your browser, click Start, and speak
mellea-partial-webrtc/
├── pyproject.toml # project metadata and dependencies
├── src/
│ └── mellea_webrtc/
│ ├── __init__.py
│ ├── server.py # aiohttp app, WebRTC signaling, entry point
│ ├── pipeline.py # Orchestrates VAD → STT → LLM → TTS per utterance
│ ├── vad.py # Silero-VAD wrapper, detects utterance boundaries
│ ├── stt.py # STT protocol + Whisper & Granite backends
│ ├── llm.py # Mellea-partials integration (stream_with_chunking)
│ ├── tts.py # Kokoro TTS wrapper
│ ├── audio_utils.py # Resample/format conversion helpers
│ ├── tracks.py # Custom MediaStreamTrack for TTS output
│ └── static/
│ └── index.html # Browser client
└── tests/
└── test_stt.py # Standalone WebRTC test client
All options are set via environment variables:
| Variable | Default | Description |
|---|---|---|
STT_BACKEND | whisper | whisper or granite |
WHISPER_MODEL | base | base, small, or medium |
LM_STUDIO_URL | http://localhost:1234/v1 | LM Studio OpenAI-compatible endpoint |
LM_STUDIO_MODEL | local-model | Model name as shown in LM Studio |
TTS_VOICE | bf_emma | Kokoro voice (British English bf_* voices) |
HOST | 0.0.0.0 | Server bind address |
PORT | 8080 | Server port |
Example with custom settings:
LM_STUDIO_MODEL="llama-3.2-3b" WHISPER_MODEL="small" mellea-webrtc
Uses faster-whisper, runs on CPU, no GPU required.
STT_BACKEND=whisper mellea-webrtc
Uses IBM Granite Speech via transformers. Requires a CUDA GPU and additional dependencies:
uv sync --extra granite
STT_BACKEND=granite mellea-webrtc
Set GRANITE_MODEL to override the default model (e.g. ibm-granite/granite-speech-3.3-8b).
Key packages:
bf_emma)| Stage | Sample Rate | Format |
|---|---|---|
| WebRTC in/out | 48 kHz | s16 mono, 960 samples/frame (20ms) |
| VAD / STT | 16 kHz | float32 mono |
| TTS output | 24 kHz | float32 mono |
One utterance is processed at a time. When speech is detected, further utterances are queued until the current response finishes playing.
en_core_web_sm spacy model (installed automatically via uv sync).11 commits
Python
76.2%
HTML
23.8%