# Making open-source text to speech sound right: ranked voices, text normalization and one engine for Python and the browser

> Source: <https://dev.to/secretheart49/making-open-source-text-to-speech-sound-right-ranked-voices-text-normalization-and-one-engine-for-3oia>
> Published: 2026-10-16 07:58:38+00:00

Open text-to-speech models have become small and fast enough to run anywhere. Piper voices run faster than real time on a laptop CPU. But when we built the text-to-speech tool on Loudness.ai, three problems stood between "it runs" and "it sounds right". loudness-tts is what we built to solve them, and it is free and open source.

Piper has more than 170 voice files, some with hundreds of speakers. Their quality varies a lot, and many are licensed for non-commercial use only. We tested every one: 1,683 voices that a business may use, scored for naturalness (UTMOS22) and clarity (character error rate with Whisper large-v3). The full study, data and a voice explorer are public:

In loudness-tts, voice="auto" picks the best voice with a clear licence for your language, and every voice tells you the credit line its licence asks for.

Piper does no text normalization. "$5.50" becomes "dollar five point five zero", "4/5/2026" becomes "four slash five slash two thousand twenty-six", and "Dr. Smith" ends a sentence after "Dr.". loudness-tts runs a rule layer first: money, dates, times, units, phone numbers, ranges, fractions, abbreviations and Roman numerals become words, in English and Spanish. Every spoken word keeps a pointer to the text it came from, so subtitles and word highlighting stay aligned with what was written. We measured the effect on our own test suite and on an independent one: [https://loudness.ai/research/piper-tts-text-normalization/](https://loudness.ai/research/piper-tts-text-normalization/)

Every result is loudness-normalized to -16 LUFS with true peak at or below -1.5 dBTP, which suits podcasts and video. Word timings come from the model's own phoneme durations, so SRT and VTT subtitles are exact. Joins between speech and silence get short fades, so there are no clicks.

The Python edition is a normal package (pip install loudness-tts). The JavaScript edition had to give the same speech without Python, in Node, Bun, Deno and the browser. We compiled espeak-ng from the commit Piper uses to WebAssembly, ran the voices on onnxruntime-web, and ported the text rules line by line, with a small helper that gives JavaScript regular expressions Python's Unicode behaviour. Parity tests compare both editions on 8,609 text cases and all 78 voice models.

```
pip install loudness-tts
loudness-tts "Dr. Smith paid $5.50 on 4/5/2026." -o speech.wav --srt speech.srt
```

For chat apps there is an OpenAI-compatible server (loudness-tts serve, or the Docker image), with guides for Open WebUI, LibreChat and AnythingLLM: [https://loudness.ai/developers/guides/](https://loudness.ai/developers/guides/)

Try it without installing anything: [https://huggingface.co/spaces/Loudness-ai/text-to-speech-browser](https://huggingface.co/spaces/Loudness-ai/text-to-speech-browser)

Code: [https://github.com/Loudness-ai/loudness-tts](https://github.com/Loudness-ai/loudness-tts)

What's next: reading rules for more languages, and npm. Issues and pull requests are welcome.
