SSMD - Speech Synthesis Markdownο
SSMD (Speech Synthesis Markdown) is a lightweight Python library that provides a
human-friendly markdown-like syntax for creating SSML (Speech Synthesis Markup Language)
documents. Itβs designed to make TTS (Text-to-Speech) content more readable and
maintainable. See SPECIFICATION.md in the repo for the canonical syntax rules.
Featuresο
β¨ Markdown-like syntax - More intuitive than raw SSML
π― Full SSML support - All major SSML features covered
π Bidirectional - Convert SSMDβSSML or strip to plain text
π Parser API - Extract structured data for custom TTS pipelines
π TTS streaming - Iterate through sentences for real-time TTS
ποΈ TTS capabilities - Auto-filter features based on engine support
π¨ Extensible - Custom extensions for platform-specific features
π§ͺ Type-safe - Full mypy type checking support
Quick Exampleο
import ssmd
# Convert SSMD to SSML
ssml = ssmd.to_ssml("Hello *world*!")
# β <speak>Hello <emphasis>world</emphasis>!</speak>
# Convert SSML back to SSMD
ssmd_text = ssmd.from_ssml('<speak><emphasis>Hello</emphasis></speak>')
# β *Hello*
# Strip markup for plain text
plain = ssmd.to_text("Hello *world* @marker!")
# β Hello world!
# Or use the Parser API for structured data
from ssmd import parse_paragraphs
for paragraph in parse_paragraphs("Hello *world*!"):
for sentence in paragraph.sentences:
for seg in sentence.segments:
print(f"Text: {seg.text}, Emphasis: {seg.emphasis}")