Rename the attached file to detect.py - this script requires numpy and ffmpeg - it's command line only.
install numpy (python3-numpy) - apt install python3-numpy on Debian.
Install ffmpeg
Run it: python3 detect.py <filename> - only tested on flac so far (this is a very quick draft written with the help of AI)
python3 detect.py 01BlackCow.flac
Analyzing: 01BlackCow.flac
Detected Native Sample Rate: 88200 Hz (Max printable frequency: 44100 Hz)
Processing 29 non-final audio segment(s)...
==============================
ANALYSIS REPORT
==============================
Highest frequency detected in best segment: 20989.10 Hz
------------------------------
Verdict: FAKE HD
Reason: File is detected as a high-definition 88200 Hz container, but cuts off below 22,050 Hz. This is in fact a fake HD file.
==============================
python3 detect.py /mnt/music/Yes_-_Yessongs_-_Disc_1/1_Opening-Excerpt_from_Firebird_Suite-.flac
Analyzing: 1_Opening-Excerpt_from_Firebird_Suite-.flac
Detected Native Sample Rate: 44100 Hz (Max printable frequency: 22050 Hz)
Processing 21 non-final audio segment(s)...
==============================
ANALYSIS REPORT
==============================
Highest frequency detected in best segment: 22050.00 Hz
------------------------------
Verdict: AUTHENTIC STANDARD DEFINITION
Reason: File detected has a sample rate of 44100 Hz and as such is not an HD file, and neither is it fake.
==============================
Thanks for sharing your script and the analysis. I took a closer look at the logic, and while the approach of checking the maximum frequency is a great starting point, I noticed a critical blind spot in how detect.py evaluates high-definition audio.
The Blind Spot in the Python Script
In your script, "Rule 1" considers a 96 kHz container to be "Authentic" as long as its maximum frequency extends past 22,050 Hz.
While this logic successfully catches fake Hi-Res files upsampled from standard 44.1 kHz CDs (which naturally cap at 22.050 kHz), it completely misses files upsampled from 48 kHz sources. A native 48 kHz master (very common in modern digital productions) has a natural Nyquist limit of 24,000 Hz. If you artificially upsample a 48 kHz track to 96 kHz, its frequency spectrum will still abruptly stop around 24 kHz.
Because your script detected a maximum frequency of 22,264 Hz in Live Forever—which is greater than 22,050 Hz—it mistakenly gave it an "Authentic" verdict. It was tricked by a 48 kHz master.
Why the File is Actually a "Fake 96kHz"
For Hi-Res files, my utility relies on a custom spectrogram engine that combines strict FFT cutoff evaluation with high-frequency ratio checks to expose both artificial upsampling and quantization noise.
When analyzing Afterlife (from the exact same album), the engine found a hard frequency cutoff at 24,352 Hz.
In a true, authentic 96 kHz Hi-Res recording, the high-frequency harmonic content should extend safely past 28 kHz (up to a theoretical maximum of 48,000 Hz). The fact that the audio hits a "brick wall" right around the 24 kHz mark is the mathematical proof that the track is simply a standard 48 kHz master placed inside a 96 kHz container.
Your script is very close to being perfect! It just needs to account for the 24,000 Hz cutoff of 48 kHz masters to catch these types of "Fake HD" files.