Skip to main content

inflectsynth

InflectSynth is the text/frontend layer for Inflect v2 synthesis: inflectg2p produces model-ready token IDs, while ONNXVoice owns the split ONNX Runtime sessions for Inflect Nano v2 and Inflect Micro v2.

The package has a flat layout (no src/) and dynamic Git-tag versioning through setuptools-scm.

Install

CPU:

python -m pip install "inflectsynth[cpu]"

CUDA or DirectML:

python -m pip install "inflectsynth[gpu]"
python -m pip install "inflectsynth[directml]"

Python

from inflectsynth import InflectVoice

with InflectVoice.from_pretrained("nano-v2", providers="cpu") as tts:
    result = tts.synthesize(
        "A small voice can still have something meaningful to say.",
        speed=1.0,
        variation=0.667,
        seed=7,
    )
    result.save_wav("sample.wav")

Use micro-v2 (or alias micro) for the larger v2 model.

The first managed run downloads exactly two revision-pinned upstream artifacts, duration.onnx and decode.onnx, and verifies both byte size and SHA-256 before opening.

Voice contract

The upstream Inflect v2 base releases each contain one fixed synthetic English voice. Accordingly:

tts.available_voices == ("default",)

voice="default" is the only supported runtime voice. There are no hidden style rows, speaker embeddings, or reference-audio voice cloning inputs in the published v2 ONNX ABI.

Controls

The public upstream ranges are preserved:

  • speed: 0.5 to 2.0, default 1.0
  • variation: 0.0 to 1.0, default 0.667
  • seed: integer, default 0

A call processes one input through one frontend/runtime request. InflectSynth does not currently implement the official runner's long-text wrapper behavior: punctuation-aware chunking, per-chunk pauses/noise, concatenation, or edge fades.

Local graphs

from inflectsynth import InflectVoice

with InflectVoice.from_local(
    duration_path="duration.onnx",
    decode_path="decode.onnx",
    providers="cpu",
) as tts:
    result = tts.synthesize("Local inference.")

Voice-level calibration

InflectSynth ships measured BS.1770 static-gain calibration for both managed v2 models. Calibration is opt-in; the default mode remains off, so existing synthesis returns the raw model level.

from inflectsynth import InflectVoice, SynthesisConfig, VoiceLevelConfig

config = SynthesisConfig(
    voice_level=VoiceLevelConfig(mode="calibrated"),
)

with InflectVoice.from_pretrained("nano-v2", providers="cpu") as tts:
    result = tts.synthesize(
        "Use the packaged voice-level calibration.",
        config=config,
    )

The v0.1.0 calibration catalog contains:

  • inflect:nano-v2:default: -0.0423775698 dB
  • inflect:micro-v2:default: -0.3353773193 dB

Both records target -24.0 LUFS using the inflectsynth-prepared-speech-v1 corpus and nine measurements per model (three prepared-speech stimuli × three seeds). The applied gain and catalog revision are reported under result.metadata["voice_level"]. Local/unmanaged graphs do not receive a managed calibration identity automatically.

Catalog

Catalog discovery is delegated to ONNXVoice. Its Inflect adapter uses the authoritative inflect-onnx-bundles catalog source and cache; InflectSynth does not package a second model catalog. For sibling-repository testing or a separately updated catalog, pass catalog_url="../inflect-onnx-bundles/catalog/models.json" to InflectVoice.from_pretrained() or the corresponding discovery API. The authoritative catalog repo is intentionally not a Python package.

Runtime ownership

InflectSynth owns text preparation and calls inflectg2p to produce the model-ready token IDs. It passes those IDs and the speed, variation, and seed controls to ONNXVoice's registered Inflect adapter. ONNXVoice owns catalog resolution, pinned artifact integrity checks, provider/session configuration, and ONNX graph execution; InflectSynth does not open ONNX Runtime sessions directly.

Real-model release smoke

The real CPU integration smoke is excluded from normal unit runs and downloads model files only when explicitly enabled. Install the candidate ONNXVoice checkout/wheel and InflectSynth's CPU test dependencies, then run from this repository root:

python -m pip install -e "../onnxvoice[cpu]" -e ".[cpu,dev]"
env INFLECTSYNTH_RUN_REAL_MODEL_TESTS=1 python -m pytest -s -m "integration and network" tests/integration/test_inflect_real_models.py

The test runs both nano-v2 and micro-v2 through real InflectG2P and ONNXVoice CPU inference, checks output/seed behavior, and prints the resolved revision, artifact sizes and SHA-256 digests, and runtime/package versions. Run this gate against the candidate ONNXVoice build before release.

Dynamic versioning

Versions come from Git tags through setuptools-scm; source archives without Git metadata use 0.1.dev0. inflectsynth.__version__ reports the installed distribution version.

License

Apache-2.0. Inflect code and weights referenced by this project are published by Owen Song under Apache-2.0; model weights are downloaded from their official Hugging Face repositories and are not included in this source package.

Metadata

Release files for inflectsynth 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 inflectsynth 0.1.0
File Size Uploaded
inflectsynth-0.1.0.tar.gz 60.9 kB Details

Built distribution (wheel)

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

Total release size: 88.4 kB

Release files / inflectsynth-0.1.0.tar.gz

Download URL inflectsynth-0.1.0.tar.gz
Size 60.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a5efb069757ea2b6d3cff0d1fd6cc42c4300336054e96ecc86ac83ee09a951a2
BLAKE2b-256 checksum
How to use checksums
a924dea98340516dff1221ba7914d3b162cf97e117dbfb4b6f062f16ad8c3f12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

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

Download URL inflectsynth-0.1.0-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f32b138bfe782122e2de1f67fd5d1490eb745128a9f90a97907004d1d09a1ce
BLAKE2b-256 checksum
How to use checksums
3aa802623c88abe179806b8ec4fb626e604254c079f4c0ac15c3183bea807e6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.1.1

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