A package for converting 'speech markdown' flavor of markdown to SSML, with service-specific formatters.
-
Clone down the repo and cd into the project root.
-
Install dependencies:
pip install -r requirements.txt
-
Run the sample
main.py
script:python main.py <path_to_markdown_file> [--output-dir] [--voice]
Or modify the script to meet your needs.
-
Running the sample script will produce an SSML-formatted XML file from your Markdown file.
--output-dir
: Set a custom output directory. Defaults to./data
.--voice
: Set a custom voice (for use with the Azure formatter). Options: cora, adam, nancy, emma, jane, jason, davis, samuel. Default: jane.
ssml_extention.py
: Classes for extendingpython-markdown
parser, to handle speech markdown conventions.formatters.py
: Formatters for aligning SSML with requirements of specific cloud-service providers. Currently includes a formatter for Azure only.validators.py
: Function for validating base SSML against W3C schema. Schemas are saved locally in the project/assets
folder.
elementpath==4.8.0
Markdown==3.8
xmlschema==4.0.1
- Tested with Python 3.13.3
Speech Markdown parsing support is currently limited to:
- sub:
(text)[sub:"value"]
- emphasis:
(text)[emphasis:"level"]
; levels:reduced
,medium
,strong
- say-as:
(text)[say-as:"value"]
; values:cardinal
,ordinal
,characters
- ipa:
(text)[ipa:"value"]
; values: string using IPA; see IPA resources - break:
text [break: "250ms"] text
- prosody: WIP, untested
And a huge thank you to Andy Barrett-Sprot, whose awesome markdown-to-ssml mistune renderer inspired the SSMLTreeprocessor
in markdown-to-ssml-converter
.