{
  "id": 16545551,
  "title": "Detecting fake hi-res audio in the browser: a peak-hold FFT with the Web Audio API",
  "url": "https://urgent.news/2026/10/26/detecting-fake-hi-res-audio-in-the-browser-a-peak-hold-fft-with-the",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-26T01:52:56.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/theaudiostuff/detecting-fake-hi-res-audio-in-the-browser-a-peak-hold-fft-with-the-web-audio-api-5a23"
  },
  "original_language": "en",
  "account": "Detecting fake high-resolution audio in a web browser requires understanding that the file header does not always accurately describe the contents. To analyze a file's true properties, it is necessary to examine its spectrum. The Audio Stuff has created a browser tool to perform this analysis called The FLAC & Hi-Res Audio Checker. This tool utilizes the Web Audio API and a plain JavaScript Fast Fourier Transform (FFT) without relying on any additional libraries or servers.\n\nOne common mistake is allowing the decodeAudioData() function to resample the audio file. This function defaults to sampling the decoded audio at the context's sample rate, which is typically 44.1 or 48 kHz. Consequently, a genuine 96 kHz file would be sampled at 48 kHz, losing all data above 24 kHz before analysis can begin. To prevent this, the sample rate must be read from the file header first, then decoded using an OfflineAudioContext at the correct rate.\n\nTo read the sample rate, a function called readSampleRate() is provided. This function takes the bytes of the file as input and checks for different file types such as FLAC and WAV, extracting the sample rate from the appropriate byte positions. If the file type is not recognized or the rate is unsupported, a default sample rate of 48000 Hz is used.\n\nOnce the correct sample rate is determined, the decodeNative() function can be used to decode the audio file. This function first converts the file bytes into an ArrayBuffer, then attempts to create an OfflineAudioContext with the determined sample rate. If this fails, it falls back to using a default OfflineAudioContext with a 48000 Hz sample rate. The decoded audio is then returned, allowing for further analysis.",
  "summary": "The file header says 24-bit/96 kHz, but that only describes the container. If you want to know what is actually in the file, you have to look at the spectrum. I built a browser tool that does this for The Audio Stuff, the FLAC & Hi-Res Audio Checker . Here is how to build the core of one with the Web Audio API and a plain JavaScript FFT, with no server and no libraries. 1. Don't let…",
  "key_points": [
    "Detects fake high-res audio by analyzing spectrum, not file header",
    "Prevents resampling by reading sample rate from file header first",
    "Uses OfflineAudioContext for accurate decoding at correct sample rate"
  ],
  "editors_take": "Moving analysis to the browser via the Web Audio API allows users to bypass deceptive file headers and verify true high-resolution audio quality without relying on external servers.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}