Check whether hi-res PCM was upsampled, CD-rate audio came from a lossy file, or DSD was made from PCM
For PCM files, hirescheck answers: was a high-rate file (96k/192k, …) upsampled from a lower rate, roughly from which rate, does it hold anything a 48 kHz file cannot, and how much energy does a trip through 48 kHz remove? It cannot prove from one file that 192 kHz sounds better, nor certify where a recording came from.
For 44.1 kHz / 48 kHz files (ordinary "CD lossless"), it answers: was this made from an MP3, AAC, Opus, Vorbis or other lossy file?
With --check-sr it also answers: was the ultrasonic band of a hi-res file made by a known processing chain? (for example 192k files whose ultrasonic content was added in processing). See "Processing-chain check".
For DSD files (DSF, DFF, including DST-compressed DFF), it answers: was it converted from PCM, roughly from which rate, and was it raised from a lower DSD rate (e.g. DSD64→DSD128)?
It reads whatever FFmpeg can decode: FLAC, WAV, AIFF, ALAC, APE, WavPack, DSF, DFF and more. Formats are recognised by content, not by extension.
Program output is available in Chinese and English (see "Output language").
pipx is recommended: it creates an isolated virtualenv and puts the hirescheck command on your PATH:
pipx install "hirescheck[plot]" # from PyPI; drop [plot] to skip matplotlib and the spectrum plot pipx upgrade hirescheck # upgrade pipx uninstall hirescheck # uninstall; reports and learned chain fingerprints are kept The latest code installs straight from GitHub: pipx install "hirescheck[plot] @ git+https://github.com/hubee73/hirescheck.git", or git clone and run pipx install ".[plot]" in the project folder.
python3 -m venv .venv .venv/bin/pip install "hirescheck[plot]" .venv/bin/hirescheck "song.flac" Windows:
winget install Gyan.FFmpeg # then reopen the terminal py -m venv .venv .\.venv\Scripts\python.exe -m pip install "hirescheck[plot]" .\.venv\Scripts\hirescheck.exe "D:\Music\song.flac" If you used the install.sh of versions before 1.5.0, remove the old install by hand: rm -rf ~/.local/share/hirescheck ~/.local/bin/hirescheck.
hirescheck "/path/song.flac" # report goes to ./song_hirescheck/ hirescheck "/path/album/01.dsf" --out "results" hirescheck "song.flac" --max-seconds 60 # first minute only; the report says so hirescheck "song.flac" --compare-seconds 60 # longer 48 kHz round-trip excerpts hirescheck "song.flac" --compare-seconds 0 --no-plot # spectrum checks only: no round trip, no plot hirescheck "song.flac" --check-sr # also compare against known processing chains hirescheck "song.flac" --lang zh # Chinese output hirescheck --version Output language follows the system: the first of LC_ALL, LC_MESSAGES, LANG that is set decides — Chinese for zh_*, English otherwise; on macOS with none of them set, the system language decides. --lang zh or --lang en overrides it, including for --help.
Arguments can be folders, several of them, mixed with files. Folders are scanned recursively:
hirescheck "/path/album" # reports go to ./album_hirescheck/ hirescheck ~/Music -j 4 --out ~/music-check # 4 files at a time hirescheck "album1" "album2" "single.flac" # several inputs default to ./hirescheck_reports/ Which files: audio is picked by extension: .flac .wav .wave .w64 .rf64 .aif .aiff .aifc .caf .m4a .alac .mka .ape .wv .tta .tak .dsf .dff. What is skipped: hidden files and folders, and the ._xxx.flac files macOS leaves when copying; symlinks to folders are not followed, so they cannot loop; files that probe as a lossy codec (e.g. AAC in .m4a) are listed as "skipped". A single file given directly is always analysed, whatever its extension or codec. Report folders: one per file, mirroring the input tree, e.g. album_hirescheck/CD1/01 title/. When one folder holds files with the same name in different formats (01.flac and 01.dsf), the report folder name gets the extension, e.g. 01_flac/. Nothing is ever written into your music folders. Summary: summary.csv and summary.txt in the report root, one entry per file: the plain-language conclusion, the likelihood grades, format, inferred source rate, technical verdict and report location. summary.csv has a BOM so Excel opens it correctly. Errors: a broken or undecodable file is listed as "error" and does not stop the batch. Parallel: -j N analyses N files at once. A 28-track CD album takes about a minute on a 4-core machine. Each job peaks at about 250 MB (192k FLAC and DSD128 alike, since audio is read in blocks); keep -j at or below the number of CPU cores. Without installing, run it from the project folder: python -m hirescheck "song.flac" (numpy and scipy required, matplotlib for plots).
Decoding is done by FFmpeg: 64-bit float PCM at the file's own rate and channel count, with no resampling, channel mixing or dither; integer samples convert to float exactly.
The whole file is scanned by default, decoded in blocks, never loaded into memory at once. Spectral windows are 32768 samples with 50% overlap (about 5.86 Hz resolution at 192 kHz). Channels are averaged by power so out-of-phase channels cannot cancel. Near-silent windows are excluded by relative and absolute level gates, both written to the report. The 48 kHz round trip uses up to three evenly spread excerpts, about 24 s in total; DSD files get no round trip.
Inputs at 48 kHz or lower get the lossy check instead of the upsampling check and round trip; see below.
By default _hirescheck/ is created in the current folder; --out picks another. Re-running overwrites the reports in that folder; the input audio is never modified.
plot_generated and plot_status record whether a plot was made this time; with plotting off or matplotlib missing, an older PNG in the folder is not deleted, so trust the JSON. Report text is UTF-8 in the output language; report.json records it in language, and stores the likelihood grades as language-neutral codes (very_high, high, unsure, low, very_low, unknown) for scripts. Plots always use English labels, so missing CJK fonts are never a problem.
The "Conclusion" at the top answers two or three questions in plain words, for example:
Conclusion ------------------------------------------------------ Looks like a real hi-res recording: it holds treble CD/48 kHz cannot. Made from a lossy file (MP3, AAC ...): likelihood very low Lossy formats cut everything above about 20 kHz; this file's treble goes past 24 kHz and moves with the music. Upsampled to 192kHz from a lower rate: likelihood low There is sound above 24 kHz (CD and 48 kHz recordings cannot hold it), and it moves with the music ... The questions:
Likelihoods are very high / high / unsure / low / very low, plus "cannot tell". They grade the strength of the evidence and are not probabilities:
The verdict codes and numbers under "Technical details" are for those who want to check. The technical verdicts by file type:
24 kHz is the key boundary against 48 kHz. A 48 kHz file's Nyquist frequency is 24 kHz, so 20–24 kHz is within what 48 kHz holds and is not 192k-only information. The energy above 26 kHz is also reported, clear of real converters' transition bands.
The whole-file average spectrum is scanned continuously from 10 kHz up, not just at preset frequencies. The spectrum is averaged in 100 Hz groups and the medians below and above each position compared, with 0.3–1.5 kHz windows for steep filters and 1–3 kHz windows for gentler ones. A band limit needs:
Quantisation/dither floor steps count too. A 16-bit source's dither floor is about −140 dBFS/Hz; padded to 24 bit, everything above the old Nyquist frequency falls below −180 dBFS/Hz. So a cut shows even when the recording has almost no treble.
The source rate is inferred from the start or midpoint of the cut: either must lie within 80–103% of a standard rate's Nyquist frequency (the start reads low when treble is already falling, the midpoint high with gentle filters). Among several candidates, the one whose Nyquist frequency puts the midpoint closest to 97.5% ranks first: steep resamplers put the midpoint a little below Nyquist, FFmpeg's swr right at it. With wide transition bands 44.1k and 48k often cannot be separated, and both are listed.
Image detection: cheap upsampling such as linear interpolation barely attenuates images; the spectrum "folds back" at the old Nyquist frequency with no steep drop. The shapes on either side of 22.05k, 24k and so on are compared, and a correlation ≥0.9 counts as imaging. Natural spectra fall with frequency and correlate negatively with their own mirror, so false alarms are unlikely.
Multi-stage upsampling (e.g. 44.1k→96k→192k) shows only when a middle step leaves a trace (images, noise or a second cut); if every step is clean, it is mathematically identical to one direct upsampling.
These thresholds are rules of thumb tuned on synthetic samples and one real SACD, and all are written to heuristics in report.json. Known limit: with a very gentle filter and a recording with almost no treble, images sit on a flat floor and upsampling may be missed.
Ultrasonic energy more than 75 dB below the audible band, or below −95 dBFS RMS, counts as "little"; above −65 dB and −95 dBFS it counts as clearly present. These are screening thresholds, not hearing thresholds or confidence levels. Spectral flatness and the correlation with the music's level give hints but cannot separate music from noise.
The automatic "clear ultrasonic content" label uses a >24.5 kHz guard band, so FFT leakage from content right at 24 kHz cannot trigger it; the raw >24 kHz and >26 kHz measurements are still reported. Energy only near the cut edge may give "uncertain". Readings below −300 dB are shown as −300 dB (the display floor).
To save bits, lossy encoders put a steep low-pass at 16–20.4 kHz, and their psychoacoustic model drops parts of the treble from moment to moment, leaving blocky holes in the spectrogram. Two analyses look for this:
The thresholds were calibrated on 4 CD rips (two Adele, two Beyond tracks) and 13 lossy transcodes of each:
Because the rules were tuned on these same files, the table shows how well the rules can separate them, not accuracy on an unknown library.
An independent check used a 1961 jazz tape recording not in the calibration set (a 44.1 kHz CD version made from DSD256): the original was not flagged; MP3 320k, AAC 128k and Opus 160k were caught; MP3 V0 and AAC 256k were not. V0's low-pass sits near 21 kHz, on top of the CD version's own filter, and this recording's treble is weak, leaving holes of only 0.27%. So on recordings with weak treble, high-quality MP3 such as VBR V0 can be missed. In a real library of 100 tracks at 44.1/48k the median hole share was 0.002%, with only a few above 0.5%.
FFmpeg decodes DSD to PCM at 1/8 of the bit rate (DSD64 → 352.8 kHz). Its decimation filter is faithful (within 1 dB) only up to half of that PCM's Nyquist frequency, so analysis stops there: 88.2 kHz for DSD64, 176.4 kHz for DSD128.
Every DSD comes out of a sigma-delta modulator whose noise shaping pushes quantisation noise into the ultrasonic band, so "noise rising with frequency" proves nothing either way. The check looks at two other things:
Many legitimate SACDs are edited or mastered in PCM/DXD, so "PCM source" is not forgery; but a hard cut near 22.05 kHz usually means a CD-resolution master. DSD files get no 48 kHz round trip.
Some hi-res releases are not simply upsampled in software. Their ultrasonic band is not empty, so the cut detection above calls them "looks like real hi-res". But that ultrasonic layer was added by a fixed production process (for example "play back, then re-record with 192 kHz equipment") rather than recorded. Such a chain leaves the same fingerprint on every file it touches:
With --check-sr, each file is compared against the built-in fingerprints and the ones you learned. Without it nothing changes.
hirescheck "song.flac" --check-sr hirescheck ~/Music --check-sr -j 2 hirescheck --list-chains # list available fingerprints Rules:
All tones must be present: one native 2L 192k recording had a 7.9 dB tone at 48 kHz, but nothing at 72 kHz.
On a match, files that were "looks like real hi-res", "treble looks like noise", "hi-res adds little" or "cannot tell" get the conclusion "the ultrasonic band may not be from the original recording". Files already judged upsampled get one extra sentence about the chain. The summary table gains a chain column, and the tag reads "processing chain: name".
Learned from 14 192 kHz FLAC files carrying the same source tag (in their comment field), from 13 albums recorded 1988–2019. The common tones are at 48 kHz and 72 kHz, with match thresholds of 11.2 dB and 8.7 dB. This chain's shape fingerprint is weak (leave-one-out minimum 0.10), so it cannot match on shape alone.
In the spectrograms of this chain's files, instrument overtones mostly end near 22 kHz, with only a haze above that follows the drums. Hence the built-in fingerprint concludes "the source is probably 48 kHz or lower".
Limits: the control group is one label's recordings (2L) plus a few upsampled files. Real recordings made on the same kind of 192 kHz equipment may carry the same tones. A match only says the file went through the same processing as the learning files; it cannot say whether that was re-recording, AI or something else. If the source changes its equipment or its sample rate, the fingerprint stops working and must be learned again.
If you know a set of files comes from one source, you can learn a fingerprint from them:
hirescheck --learn-chain "store X 96k" albumA albumB albumC # folders are scanned recursively hirescheck --learn-chain "store X 96k" *.flac --chain-note "store X hi-res releases from 2023 on" Requirements (the command stops and says why if one is not met):
While learning, the leave-one-out shape correlation and tone strengths are printed for every file. Each tone's match threshold is the weakest learned value minus 3 dB, kept within 8–12 dB. Fingerprints are saved to ~/.config/hirescheck/chains/NAME.json (or the file named by --out) and survive reinstalling or uninstalling. Afterwards, try a few files you know are not from the chain, to make sure it does not give false matches.
The excerpts are converted down to 48 kHz and back to the original rate, group delay compensated, level kept, and subtracted from the originals. The filter is a linear-phase FIR with about 110 dB stopband rejection, passband to 20 kHz, stopband from 24 kHz; 50 ms at each end of every excerpt is excluded to limit edge effects. Everything runs in floating point, with no extra integer quantisation.
Residuals are energy ratios in dB: −60 dB is a millionth of the original's energy, about a thousandth in RMS amplitude. dBFS is relative to a sample value of 1, so a full-scale sine is −3.01 dBFS RMS; PSD in dBFS/Hz is density per hertz, not overall loudness.
A smaller residual means this particular conversion changed less. It covers only the excerpts, and cannot rule out differences from playback filters, non-linearity or different masters. To find out whether you can hear a difference, compare level-matched versions of the same master in a randomised blind ABX test.
Exit codes: 0 done; 1 a decoding, analysis or writing failure (in a batch: at least one file failed, or no files were found); 2 bad arguments; 130 interrupted with Ctrl-C (finished reports are kept, but no summary is written).
tests/ has a set of synthetic samples with expected verdicts:
DSD samples need a C compiler (for the 1-bit modulator in tests/sdm.c).
python tests/make_corpus.py /tmp/corpus # about 30 s, writes about 200 MB python tests/run_tests.py /tmp/corpus # -v shows every cut in detail python tests/run_tests.py /tmp/corpus --real-dsd "/path/to/SACD-albums-known-to-be-CD-mastered" With a real hi-res recording known not to be upsampled, you can derive a set of fakes from it: via 44.1/48/88.2/96 kHz, multi-stage chains, MP3/AAC/Opus transcodes, and DSD64/DSD128. run_tests.py reads the expected.json in the derived folder:
python tests/derive_from_source.py "/path/to/real-192k.flac" /tmp/derived # uses 60–120 s by default python tests/run_tests.py /tmp/derived Cases marked KNOWN are physically hard to see, such as a 96 kHz source inside DSD64 or DSD upsampling via a wide DXD step. They are reported but not counted as failures.
Chain fingerprints have no samples that could ship with the repository, so test them on your own files. Each list file holds one path per line:
Lint with ruff: ruff check hirescheck tests. GitHub Actions runs ruff, the synthetic corpus and the regression tests on Linux and macOS with Python 3.10 and 3.13.
git clone https://github.com/hubee73/hirescheck.git && cd hirescheck python3 -m venv .venv && . .venv/bin/activate pip install -e ".[plot]" ruff build twine # -e: code changes take effect without reinstalling hirescheck --version # or python -m hirescheck ruff check hirescheck tests # lint python tests/make_corpus.py /tmp/corpus && python tests/run_tests.py /tmp/corpus # regression tests python -m build && twine check dist/* # build: a .whl and a .tar.gz in dist/ pip install dist/hirescheck-*.whl # try the built package in another virtualenv To release a new version:
The Release workflow then checks the tag against VERSION, builds, creates a GitHub Release with the .whl and .tar.gz attached, and publishes to PyPI. PyPI uses trusted publishing, so no password is stored in the repository, but it has to be set up once on pypi.org before the first release; see the top of .github/workflows/release.yml.
All 2 files in this release have provenance metadata.
audio hi-res upsampling flac dsd lossless spectrum
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
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 verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
All 2 files in this release have been uploaded with provenance metadata.
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.




