R&D · Voice AI
What we learned building streaming Bangla speech.
An internal research prototype, not a client project. We wanted to see how far the LLM-plus-neural-codec approach to speech goes for Bangla, and whether it could stream audio as it generates. Here's what we built and what we learned.
Good Bangla speech synthesis is still hard to find.
Bangla has hundreds of millions of speakers, yet the text-to-speech options we tried tended to sound flat or break on real-world text: news articles, numerals, conjunct consonants and the rest of Bengali orthography.
Newer TTS systems generate discrete audio tokens with a language model and decode them with a neural codec. We wanted to know whether that approach could produce natural Bangla from arbitrary text, on our own hardware, and stream it rather than wait for a full clip.
- Type
- Internal R&D
- Domain
- Bangla NLP · Speech
- Approach
- LLM + neural audio codec
- Status
- Prototype, not running
Text in, audio streaming out.
- 01
Normalise the text
Bangla text is cleaned before the model sees it: Unicode and halant normalisation for conjuncts, vowel-carrier fixes, numbers spelled out as words (২৫ → পঁচিশ), punctuation spacing, then chunking into roughly 150-character pieces.
- bkit
- unicode
- number spelling
- chunking
- 02
Generate audio tokens with a fine-tuned LLM
A language model, fine-tuned with parameter-efficient methods, takes a voice name and the normalised text and emits discrete audio-codec token IDs instead of a mel-spectrogram. It is served with vLLM behind an OpenAI-compatible streaming API.
- vLLM
- PEFT
- streaming tokens
- 03
Decode with a neural codec, in two chunk sizes
Every 7 generated tokens map to one SNAC frame, redistributed across its 3 hierarchical layers. The first decode fires after just 21 codes so audio can start early; after that, decoding switches to 210-code chunks to amortise the overhead.
- SNAC
- 21-code first chunk
- 210-code chunks
- 04
Stream it out
A FastAPI service streams chunked WAV over HTTP, with short fades at chunk edges to avoid clicks and async cancellation when the listener disconnects. The model server and the API run as separate processes.
- FastAPI
- chunked WAV
- async cancel
# input
[SOH] voice_name: normalised_text [EOT][EOH]
# output: audio-codec token IDs
[SOS] 128271 128394 128511 … [EOS] Four things we'd carry into the next one.
Normalisation matters more than the model
On real news text, many of the audible errors traced back to the input rather than the model: conjunct consonants, zero-width joiners, vowel carriers and numerals. Generic normalisers handle these poorly, so a Bangla-specific normalisation step had to come before any token reached the model.
Time-to-first-audio is a chunking problem
The codec decodes in batches. Small fixed chunks waste decode overhead; large ones keep the listener waiting. Using a small first chunk and larger ones after was the simplest way to get both an early start and efficient decoding.
LLM-style TTS is a good fit for a low-resource language
Treating speech as tokens lets the model lean on language-model pre-training for rhythm and intonation, and keeps the stack to one model plus a codec, with no separate vocoder. That is what made a working prototype possible in a few weeks.
Separate the model server from the API
Keeping the LLM in its own vLLM process, and doing normalisation, decoding and streaming in the API layer, made it easy to restart and iterate on either side without reloading the model.
A prototype, honestly scoped.
This was a short research build, and it isn't running today. What it doesn't tell us yet:
- No formal quality evaluation (MOS or similar). We only ran an informal listening check with a small group.
- Latency and real-time factor were not benchmarked in a way we can publish, and the prototype is not running to re-measure.
- The prototype was trained and tested with a single male voice.
- Models
- Fine-tuned LLM (PEFT) · SNAC neural codec
- Training & data
- PyTorch · Hugging Face Transformers · PEFT · Demucs · Whisper · PostgreSQL · S3
- Inference
- vLLM · bkit · asyncio
- Serving
- FastAPI · Uvicorn