Skip to main content

hz432 — MP3 to A4 = 432 Hz converter

CI License: MIT Python Version

🇵🇱 Polska wersja README

hz432 is a command-line tool that retunes MP3 files — a single file or a whole folder tree — to A4 = 432 Hz. Instead of blindly assuming every recording is in 440 Hz, it measures the actual tuning of each track first, so the A in the converted file lands as close to 432 Hz as possible.

  • recursive folder conversion with the same directory structure in the output,
  • per-track tuning detection with a confidence score,
  • near-lossless resampling by default (like slowing down a record), optional tempo-preserving pitch shift,
  • ID3 tags and cover art are copied; converted files are tagged and skipped on re-runs,
  • no ffmpeg required, parallel processing, originals are never modified.

Installation

Requires Python 3.10+ (python.org) and internet access on the first run.

Windows — run setup.bat (double-click or from a console in the project folder). Linux / macOS — run ./setup.sh.

The script creates a virtual environment in .venv (if missing) and installs the dependencies from requirements.txt into it — nothing goes into your system Python. It is safe to run again; it only installs what is missing. .venv is not part of the repository, so re-run the script after cloning or deleting it.

Windows without Python — download hz432-windows-x64.exe from the latest release and run it from a console, e.g. hz432-windows-x64.exe "C:\Music". The file is not code-signed, so Windows SmartScreen may warn on the first run.

Alternatively, install it as a package (adds an hz432 command):

pip install hz432        # from PyPI
pip install .            # from a clone of this repository

Usage

.venv\Scripts\python hz432.py "C:\Music"                 # folder + subfolders -> C:\Music_432Hz\ (same structure)
.venv\Scripts\python hz432.py "C:\Music\a.mp3"           # single file -> "a [432Hz].mp3" next to the original
.venv\Scripts\python hz432.py "C:\Music" --analyze-only  # measure tuning only, write nothing
.venv\Scripts\python hz432.py --version

On Linux / macOS use .venv/bin/python instead of .venv\Scripts\python.

Options

Option Description
-o PATH output folder (or an exact .mp3 path for a single file)
-j N number of parallel worker processes
--mode speed (default) resampling — pitch and tempo change together (~1.8–2.7 %), practically lossless
--mode pitch pitch only, tempo unchanged (Rubber Band) — use when sync with video/lyrics matters
--ref-hz HZ force a known source tuning (skips detection), e.g. --ref-hz 440
--policy auto (default), measured or assume-440
--target HZ target A4 (default 432)
--snap-cents C in auto, deviations ≤ C cents are treated as exactly 440 (default 1)
--min-confidence X below this detection confidence assume 440 (default 0.35)
--force re-convert files already tagged as converted

How the decision is made (auto policy)

  1. Measurement — spectral peaks → distance from the 440 Hz equal-temperament grid in cents → histogram → track tuning plus a confidence score (≈0.2 = noise, ≈1 = clean tonal music).
  2. Confidence < 0.35 (drums, electronic, noise) → assume 440 Hz (the standard).
  3. Within measurement error of 440 (±1 cent ≈ ±0.25 Hz) → treat as 440. The measurement is repeatable to ~0.5 cent (same track across different releases), while real recordings deviate from 440 by 1–10 cents, so a wider snap would move the result away from 432.
  4. Otherwise → shift from the measured value (e.g. 437 → 432, 442 → 432). Orchestras often tune to 442–443 Hz, analog tapes drift; "snapping to 440" would leave such a track several Hz off.
  5. About ±50 cents from 440 (e.g. 428 / 453 Hz) → skipped: tuning is only known modulo a semitone, so the direction of the correction is ambiguous. Use --ref-hz for those files.
  6. Tracks already at ~432 Hz (±1 cent) are skipped.

Note: MP3 is re-encoded (lossy) at the original bitrate. Keep your originals for archival purposes.

Development

pip install -e ".[dev]"
ruff check .
pytest

See CONTRIBUTING.md (PL) for guidelines and CHANGELOG.md for release history.

License

MIT © DO IT GLOBAL LTD

Metadata

Release files for hz432 1.0.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 hz432 1.0.0
File Size Uploaded Provenance
hz432-1.0.0.tar.gz 11.1 kB With provenance Details

Built distribution (wheel)

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

Total release size: 21.2 kB

Release files / hz432-1.0.0.tar.gz

Download URL hz432-1.0.0.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3762a78cf5b5397025896eeaa06b14323bd5838cfe8664cb7715527deb9d20ef
BLAKE2b-256 checksum
How to use checksums
a5781f351ac182c8e9d3ce443b1b6b4213dd30441058de29fce459c97ce4eab4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 22, 2026.

Transparency log

Release files / hz432-1.0.0-py3-none-any.whl

Download URL hz432-1.0.0-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ab1ed514df41bd4075553547056786f2416c259f888da82b6c6fd397761f67b
BLAKE2b-256 checksum
How to use checksums
7224b4ce4fb7211ed466c76ee7224ead9ee9e8b3782ef8bdaf295978fb1bb60a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 22, 2026.

Transparency log

Security for hz432 1.0.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hz432-1.0.0.tar.gz

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 22, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full 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