SSML-H Tools
ssml-h-tools is the reference Python parser, validator, and builder for
SSML-H 1.0. It also supports a bounded
subset of standard W3C SSML 1.1.
The package is engine-neutral. It compiles markup into immutable synthesis plans and leaves model inference, voice catalogs, profile storage, audio assembly, and authorization to the integrating speech engine.
Install
pip install ssml-h-tools
Python 3.10 or newer is required.
Validate and compile
from ssml_h import validate_ssml
plan = validate_ssml(
"""<speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis">
Hello.<break time="250ms"/>Welcome back.
</speak>""",
"ssml",
)
for unit in plan.units:
print(unit.kind, unit.text, unit.duration_ms)
Language and voice resolution are supplied by the host application:
plan = validate_ssml(
document,
"ssml-h",
default_language="en",
resolve_language=my_language_resolver,
validate_voice=my_voice_validator,
)
The parser rejects DTDs, entities, external references, unknown synthesis namespaces, unsupported elements, and documents exceeding bounded resource limits before model inference begins.
Build documents
from ssml_h import SSMLBuilder
document = SSMLBuilder.ssml_h(language="en-US")
document.define_voice(
"Bob",
gender="male",
age="elderly",
accent="american",
seed=4242,
sample="My name is Bob.",
sample_language="en-US",
)
with document.voice("Bob") as bob:
bob.text("Are we ready?")
with document.voice("Bob", direction="Calm and reassuring") as bob:
bob.text("Everything is under control.")
document.break_(milliseconds=300)
with document.prosody(rate="slow") as slower:
slower.text("Everything is prepared.")
xml = document.build()
plan = document.validate(allow_turn_direction=True)
XML is built with ElementTree; text and attributes are escaped rather than
concatenated. scope="profile" must be requested explicitly when defining a
persistent voice.
Per-turn natural-language direction is an optional processor capability. The
parser rejects h:direction unless the host explicitly passes
allow_turn_direction=True; compiled speech units then expose the normalized
instruction as unit.direction. The builder emits the namespaced attribute
through voice(..., direction="...") only for SSML-H documents.
Processor adapters
<phoneme> is disabled unless the host supplies a render_phoneme callback.
This prevents the core package from claiming an alphabet that the active model
cannot render. The callback receives (alphabet, ph, source_text, language)
and returns the text representation expected by the engine.
The host remains responsible for:
- mapping BCP 47 tags to model languages;
- validating saved or built-in voice names;
- advertising its actual capabilities;
- creating and cleaning request-scoped voices;
- atomically publishing persistent profiles; and
- executing advertised per-turn directions without speaking or persisting the instruction; and
- enforcing model, queue, duration, and output limits.
Development
python -m venv .venv
.venv/bin/python -m pip install -e ".[test]"
.venv/bin/python -m unittest discover -s tests -v
python -m build
python -m twine check dist/*
On Windows, use .venv\Scripts\python.exe.
Release
Releases are published from GitHub Releases through PyPI Trusted Publishing. No long-lived PyPI token is stored in GitHub. See the publishing guide.
License
The tools are licensed under the Apache License 2.0. The SSML-H
specification is maintained separately in
hangry-labs/ssml-h-spec.
Metadata
Release files for ssml-h-tools 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ssml_h_tools-0.2.0.tar.gz | 23.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ssml_h_tools-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.8 kB
Release files / ssml_h_tools-0.2.0.tar.gz
| Download URL | ssml_h_tools-0.2.0.tar.gz |
|---|---|
| Size | 23.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49da430bbc52e07e5b77582fc56fa26ce79a6792abac7145efa73dcbcde12a4a
|
|
BLAKE2b-256 checksum How to use checksums |
7a6822c5ba23663182f95bc0804ab965a4f3cf65dba6a79dce675b165b23c53b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logRelease files / ssml_h_tools-0.2.0-py3-none-any.whl
| Download URL | ssml_h_tools-0.2.0-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef6e1e6aae296fc4b5fe9436e56ecbbe5cfd0dab6f378528195071175d674acc
|
|
BLAKE2b-256 checksum How to use checksums |
8e92cc4f8122fb5f11f376e90b2e69b2d88505636dc1b25e3ca7dc5f5b52999c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency log