v0.5.0 — Inline language switching
md-tts now pronounces backticked code segments inside Spanish
paragraphs with the English voice (Edge backend), so technical
terms like framework, pipeline, or Docker sound natural instead
of being read as Spanish phonetics.
Highlights
- Per-span voice synthesis on the Edge backend: each inline-code
span becomes its ownedge_tts.Communicatecall, and the resulting
MP3 bytes are concatenated (Edge frames are independently
decodable). Blocks whose spans all resolve to the same voice keep
the single-shot fast-path, so monolingual documents pay zero extra
cost. Span(text, lang)dataclass onBlock(additive — existing
iterator API unchanged).- New CLI flags:
--inline-code-lang en|none(defaulten): enable / disable per-
span voice switching for backticked code.--voice-en VOICE/--voice-es VOICE: override the default
voice for each language (works in both interactive and--export
modes).
- 63 tests passing across Python 3.11 / 3.12 / 3.13.
Behaviour change (breaking-ish, minor version bump)
The default for --inline-code-lang is en. For pure-English or
pure-Spanish documents without backticks, this is a no-op (the
single-voice fast-path handles them as before). Only Spanish
documents that contain backticked code see different audio: the
backticked content is now spoken with the English voice.
Opt out with --inline-code-lang none to restore v0.4.x behaviour.
What's not in v0.5.0 (deferred to v0.6.0)
- EN-tech-term heuristic outside backticks: too prone to false
positives on Spanish words likeno,pin,mar,id,son.
Backticks already cover ~90% of real-world technical writing. - Disk cache for repeated spans: the single-voice fast-path
already eliminates the extra cost in the common case.
Design decisions log: docs/v0.5.0-design-decisions.md.
Install
pip install --upgrade "md-tts[edge]"