Files
SpotiFLAC-Mobile/lib
zarzet 21232cfdae feat(audio): null test engine that aligns and subtracts two files
Adds the engine behind "Compare with another file". FFmpeg decodes both
files at the reference's sample rate (capped at 96 kHz) as float PCM in
the same channel layout. Short excerpts line the files up: a decimated
4 kHz cross-correlation searches 3 s either way, ranking peaks by their
height between samples, and a full-rate pass refines the offset and fits
a least-squares gain. A second excerpt later in the song measures drift.

One FFmpeg graph then subtracts the whole songs and reports residual and
reference levels per window, overall and above 8 kHz, so memory stays
bounded for long files. The residual spectrogram reuses the existing
spectrogram filter. The result carries a plain-language level, the band
the difference sits in, its peak, and notices for weak alignment, a
residual as loud as the music, drift and differing lengths, with the
thresholds and the experiments behind them documented in code.

Runs are serialized with the other analysis jobs, cancel cleanly and
always remove their temporary directory. AC-4, unreadable, too short and
undecodable files raise typed errors. Tests cover the DSP on synthetic
signals, the FFmpeg argument builders, cancellation and errors with a fake
FFmpeg, and an end-to-end run with the FFmpeg found on the machine.
2026-11-11 11:54:00 +07:00
..