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 DEFAULT_MODEL, InflectVoice

with InflectVoice.from_pretrained(DEFAULT_MODEL, 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.

Atomic request ownership

One InflectVoice.synthesize_prepared() call processes one exact prepared-text request. The caller owns text boundaries, subdivision, and any composition of child requests. InflectSynth does not split or concatenate long text, add pauses, or perform sentence segmentation.

Request capacity and token measurement

InflectVoice.measure_prepared() runs the same InflectG2P prepared-text frontend used by synthesis and reports the actual model-token count without acoustic inference:

from inflectsynth import DEFAULT_MODEL, InflectVoice

with InflectVoice.from_pretrained(DEFAULT_MODEL, providers="cpu") as tts:
    measure = tts.measure_prepared("The exact prepared text to send.")
    print(measure.amount, measure.unit, measure.maximum, measure.fits)

Managed canonical models nano-v2 and micro-v2 have an evidence-backed supported safe request budget of 400 model tokens each. For these managed models, maximum is 400 and fits is true exactly when the measured request uses at most that many tokens. This is a conservative request budget, not a claim about the ONNX graph's hard maximum or a guarantee of perceptual quality. The packaged policy revision is available from capacity_api_contract() and managed discovery metadata; it records the benchmark evidence digest, runtime/package versions, model source revisions, and ONNX artifact hashes.

Local and unmanaged models always report maximum=None and fits=None; they do not inherit managed capacity by model ID or file name. No text splitting, retry chunking, or sentence segmentation is performed. Discovery publishes the same policy maximum and revision as metadata["max_input_tokens"] and metadata["capacity_policy_revision"] when its managed source revision matches the policy.

For debugging, the optional CLI measurement command prints the same fields as JSON and does not synthesize audio:

python -m inflectsynth --measure "The exact prepared text to send."

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 DEFAULT_MODEL, InflectVoice, SynthesisConfig, VoiceLevelConfig

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

with InflectVoice.from_pretrained(DEFAULT_MODEL, 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.2

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.2
File Size Uploaded Provenance Actions
inflectsynth-0.1.2.tar.gz 120.1 kB Without provenance Details for inflectsynth-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 154.9 kB

Release files / inflectsynth-0.1.2.tar.gz

Download URL inflectsynth-0.1.2.tar.gz
Size 120.1 kB
Tags Source
SHA-256 checksum
How to use checksums
08310bbac7c59f5d7f483332b6f9a45fdcd9fcedda9605a5161171ea9d6e0450
BLAKE2b-256 checksum
How to use checksums
93847cc6f61e5375b154cea0a6d34655e5bb413050738c32c049880dd6eb5831
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.2-py3-none-any.whl

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

Security for inflectsynth 0.1.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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