Skip to main content

safaz

safaz reads and writes SFZ instruments using uFor as the native instrument format. It preserves supported musical behavior and reports unsupported features with precise source locations or native model paths.

from pathlib import Path

from safaz.exporter import write
from safaz.reader import read
from ufor.codec import score_toml

result = read(Path('Glass.sfz'))
if result.complete and result.instrument is not None:
    Path('instrument.toml').write_text(score_toml(result.instrument), encoding='utf-8')
    exported = write(result.instrument)

Check complete and inspect unimplemented before accepting an import or export. Import seals existing audio assets; it does not rewrite them. The file reader defaults to 48 kHz stereo output, with explicit rate/layout options.

For conversion without file I/O, use safaz.parser.parse, safaz.parser.sample_paths, and safaz.compiler.compile_instrument with caller-supplied ufor.samples.metadata.AudioMetadata facts. safaz.exporter.write returns text without writing files.

Static two-pole filter responses can be imported with read(Path('Glass.sfz'), filter_response='sfizz_rbj'). The default diagnoses them without importing a filter. Accepted responses use native filtering after amplitude, matching the sfizz voice pipeline; see the filter conversion rules.

uFor owns generic instrument definitions, controller bindings, and preparation. safaz owns SFZ rules, compatibility diagnostics, sample-file inspection, tests, and documentation. Rendering and live device access belong to consuming applications.

safaz supports Linux, Windows, and macOS with Python 3.13 or newer. SFZ files are read as UTF-8, with an optional BOM; save exported text with Path('output.sfz').write_text(exported.contents, encoding='utf-8'). Both slash and backslash sample separators are accepted and stored as portable relative paths using slashes. Match filename case exactly so instruments also work on case-sensitive filesystems.

SoundFile wheels bundle libsndfile for the supported Linux, Windows, and macOS platforms. Source installations need a system libsndfile installation; see the SoundFile installation instructions. The symlink containment test requires Windows Developer Mode or symlink privileges and skips only when Windows reports that privilege is unavailable.

Development uses uv sync, uv run pytest, uv run ruff check safaz test, and uv run ty check safaz. Tests default to serial execution because worker startup costs more than it saves for this suite. Use uv run --locked pytest -n 4 --dist=worksteal to check parallel isolation. Regenerate regression baselines separately with -n 0. Run one full suite at a time when also verifying uFor or enge; their workers share the same CPU budget. The manual cross-platform workflow checks both serial execution and four workers on Linux, Windows, and macOS. See test performance for measurements and worker choices.

The optional reference suite compares imported playback against a pinned, unmodified sfizz client. Its separate manual workflow preserves mismatches as failure evidence; it does not imply playback equivalence.

The implementation and tests were extracted from uFor and recs; this project retains their MIT license and copyright notices.

Metadata

Release files for safaz 0.2.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 safaz 0.2.0
File Size Uploaded Provenance Actions
safaz-0.2.0.tar.gz 130.5 kB Without provenance Details for safaz-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 169.4 kB

Release files / safaz-0.2.0.tar.gz

Download URL safaz-0.2.0.tar.gz
Size 130.5 kB
Tags Source
SHA-256 checksum
How to use checksums
96c8dc7beac87cdbe51243d66259adecf3d87cc1f3d3d8a44c8a52dbadf5a45d
BLAKE2b-256 checksum
How to use checksums
241ae041d64f17ddaabdddcbeb7854682aa073da79529a7ac4172df8d7566666
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / safaz-0.2.0-py3-none-any.whl

Download URL safaz-0.2.0-py3-none-any.whl
Size 38.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
334555b70658ef3e46f0242702acec130c0976b9c23725de646c1a95a2df31b2
BLAKE2b-256 checksum
How to use checksums
ab09f8f203897adbadce91c10ce8bdbe7076f641e81ae8ef5cdae5e3449ef2a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for safaz 0.2.0

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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