Skip to main content

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?")
document.break_(milliseconds=300)
with document.prosody(rate="slow") as slower:
    slower.text("Everything is prepared.")

xml = document.build()
plan = document.validate()

XML is built with ElementTree; text and attributes are escaped rather than concatenated. scope="profile" must be requested explicitly when defining a persistent voice.

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
  • 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.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ssml-h-tools 0.1.0
File Size Uploaded
ssml_h_tools-0.1.0.tar.gz 21.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ssml-h-tools 0.1.0
File Interpreter ABI Platform
ssml_h_tools-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 39.3 kB

Release files / ssml_h_tools-0.1.0.tar.gz

Download URL ssml_h_tools-0.1.0.tar.gz
Size 21.5 kB
Tags Source
SHA-256 checksum
How to use checksums
eaa2289f6e5e400acbd29471d2f12d5e4fba890a3c1af6d0efb6c1f2262fbfc2
BLAKE2b-256 checksum
How to use checksums
caac687d4d56b65203ef45ef17423feaf36965ba03546c690dfa265fadcfb52e
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 6, 2026.

Transparency log

Release files / ssml_h_tools-0.1.0-py3-none-any.whl

Download URL ssml_h_tools-0.1.0-py3-none-any.whl
Size 17.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6314588c262e51544249227311622a34611c92ca60e70fb312d7a1ddd29d6f0
BLAKE2b-256 checksum
How to use checksums
51f684eca7e26be9d93629999ff712f36dea3016621b5486c0f8f0babeb143ff
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 6, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page