Skip to content

v0.5.0 — Inline language switching

Latest

Choose a tag to compare

@jmponcebe jmponcebe released this 14 May 14:25
· 3 commits to main since this release
a52cc2a

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 own edge_tts.Communicate call, 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 on Block (additive — existing
    iterator API unchanged).
  • New CLI flags:
    • --inline-code-lang en|none (default en): 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 like no, 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]"