tcdweb/AGENTS.md
2026-07-05 00:44:08 +02:00

2.2 KiB

Implements a browser-based audio authenticity analyzer that detects the TRUE quality of audio files using psychoacoustic spectral analysis. Uses the same scientifically proven principles as the original tcd CLI:

  • ISO/IEC 11172-3:1993 - Coding of moving pictures and associated audio for digital storage media at up to about 1.5 Mbit/s, Part 3: Audio (MPEG-1 Audio Layer III, "MP3").
  • ISO/IEC 13818-7:2006 - Generic coding of moving pictures and associated audio information, Part 7: Advanced Audio Coding (AAC).
  • Zwicker, E. & Fastl, H. - Psychoacoustics: Facts and Models, Springer, 1999 (Fletcher-Munson equal-loudness contours).
  • Lerch, A. - An Introduction to Audio Content Analysis, Wiley, 2012 (spectral features for audio forensics).

The web version runs entirely in the browser via the Web Audio API — no server-side processing, no file uploads, no FFmpeg dependency. It implements:

  • Client-side audio decoding via Web Audio API (supports MP3, FLAC, WAV, AIFF, Ogg Vorbis, Opus, M4A/AAC, WMA, AC3, EAC3, MP2, ALAC, WavPack, APE, DSF, DFF)
  • Full psychoacoustic analysis pipeline: Hann-windowed FFT (4096-point, 50% overlap), averaged power spectrum, cutoff detection, transition bandwidth (steepness), noise floor, spectral roughness (CoV), band ratio
  • Transcode/upscale detection using the same two-layer verdict logic as tcd (primary: cutoff+steepness, secondary: roughness+band ratio)
  • Confidence scoring (0-100%)
  • Realtime FFT spectrum analyzer with playback, peak hold, and hold-max-cutoff
  • BPM detection via autocorrelation of onset detection function
  • Metadata tag parsing: ID3v1, ID3v2, FLAC Vorbis comments, APE tags
  • Stereo mode detection (MP3: Joint Stereo, Dual Channel, etc.) and VBR/CBR detection
  • Logarithmic power spectrum visualization with noise floor and cutoff markers

Always implement only what is scientifically provable. As it is possible to view on a spectrum analysis of the audio to see the hard cutoff introduced by compression algorithms as MP3, it is possible to tell if we have a 96k MP3 file that just was re-encoded as 320k, for example, or a 128k as 320k, or a 320k as FLAC, and so on. This tool should allow to spot exactly those re-encoded / transcoded files.