phasecheck
Finds stereo files that lose level or sound thin when played in mono, usually because one channel is polarity-inverted or partly out of phase with the other.
Status: 0.1.0. Checked on real stereo music (MUSDB18-HQ) with planted problems and untouched originals; results below. The thresholds (6 dB and 10 dB) were set on generated audio and are unchanged. They are provisional.
pip install -e ".[dev]"
phasecheck check my_songs/ --out report.csv
phasecheck check song.wav --json
What it measures
Over the loud parts of the file (frames within 30 dB of the loudest, middle 2 minutes of long files):
- Downmix loss (dB): how much quieter the mono sum is than the average of the two channels. 0 dB means identical channels, about 3 dB means unrelated channels, large values mean the channels cancel.
- Correlation between the channels (-1 to 1), and the loss in four bands (20-250 Hz, 250 Hz-2 kHz, 2-8 kHz, above 8 kHz; a band counts only if it holds at least 1% of the energy).
- Dual mono (identical channels) and a silent channel.
| Verdict | When |
|---|---|
| FAIL | full-band loss of 10 dB or more |
| WARN | loss of 6 dB or more, or one band at 10 dB or more |
| REVIEW | one channel is silent, or too little audio to judge |
| SKIP | mono, or more than two channels |
| PASS | otherwise (identical channels are noted) |
Exit code 1 only when a FAIL exists; 2 for a bad path or settings.
Real-data results (MUSDB18-HQ, 200 files per run)
Two runs on different songs: test split first, then train. The plan for each was fixed and tagged before the run
(eval-spec-pc-v1, eval-spec-pc-v2; see docs/). The first run failed its plan (inverted-channel copies were expected
to reach FAIL in 99% of cases; they reached 54%). The criterion was wrong, because how much an inversion loses depends on how
correlated the channels were; the v2 plan corrected it and was run once on new songs, with no code or threshold change.
train split (v2 run) |
result |
|---|---|
| Untouched originals flagged WARN or FAIL | 1 of 200 (range 0-3%) |
| Right channel inverted, original correlation 0.5 or more: flagged WARN or FAIL | 168 of 169 = 99% (97-100%) |
| Same copies reaching FAIL (10 dB or more) | 128 of 169 = 76% |
| Same inversion, original correlation under 0.5 | 1 of 11 flagged: not reliably detectable |
| Right channel inverted, all copies | 169 of 180 = 94% flagged, 128 of 180 = 71% FAIL |
| Only full mixtures | 39 of 39 flagged, 28 of 39 FAIL |
| 2-8 kHz band inverted | 62 of 71 = 87% (78-93%) |
| Dual mono recognised | 180 of 180 |
On the first (test) run: 0 of 199 originals flagged; all-copies detection 180 of 194 = 93% flagged, 104 of 194 = 54% FAIL; band 31 of 38 = 82%.
The one flagged original (train: a vocals stem, correlation -0.79) measures 9.7 dB quieter in a mono mix (bass about 19.5 dB quieter); not yet checked by ear.
Ranges are 95% Wilson intervals. Stems and mixtures of the same song are not independent, so the real uncertainty is wider. The planted copies are made by one method; real polarity mistakes may differ. Only MUSDB18-HQ was used.
Limits (please read)
- One dataset. Tested on MUSDB18-HQ only (western-style studio stems and mixtures). Field recordings, spaced microphones and other styles may behave differently. Wide stereo can have low correlation without any mono problem; that is why the verdict uses the downmix loss, not the correlation.
- Swapped left and right channels cannot be detected. Nothing in the audio says which side is which.
- A passage that cancels is averaged into the whole file. A short out-of-phase section in a long song may not reach WARN.
- A flagged file is not proof of a mistake: some recordings really cancel in mono. Listen to the mono mix.
- Only the middle 2 minutes of a long file are judged.
- Inverted channels whose correlation was under about 0.5 are not reliably caught: the mono mix hardly changes.
- An inverted mixture usually shows as WARN, not FAIL (about 72% of inverted mixtures reached FAIL).
- Thresholds (6 / 10 dB) are provisional and were chosen on generated audio.
Tests
pytest -q (57 tests). The checker itself was also tested by planting 21 deliberate bugs in the code and confirming
the tests catch them (the two that survived the first round now have their own tests).
License
MIT. Copyright (c) 2026 Boobalan Arjunan.
Metadata
Release files for phasecheck 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| phasecheck-0.1.0.tar.gz | 16.6 kB | Without provenance | Details for phasecheck-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| phasecheck-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for phasecheck-0.1.0-py3-none-any.whl |
Total release size: 28.2 kB
Release files / phasecheck-0.1.0.tar.gz
| Download URL | phasecheck-0.1.0.tar.gz |
|---|---|
| Size | 16.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d84d6bae26704e961dc990ed4f2c7c9075454c5304f24cf7372cbbe9ab5ea254
|
|
BLAKE2b-256 checksum How to use checksums |
223bb14371ff4ffaa06f06af635b38d46d78125a2921b75d8f02eb7b10e4b0e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Release files / phasecheck-0.1.0-py3-none-any.whl
| Download URL | phasecheck-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3f518330aa535eb9addd0c68ae4d4d277b015df19ea4dd2b7484d33e4657045c
|
|
BLAKE2b-256 checksum How to use checksums |
40de8a96a61e749abe8081bd25ea74e2ab08928816c54bb87462eed1ef17a484
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Security for phasecheck 0.1.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.