Audio Align (XCorr)
Fix the 40ms delay that's ruining your null test
- audio_ref
- audio_proc
- audio_proc_aligned
- delay_samples
- delay_ms
- peak_corr
- debug_image
Any audio processor worth its salt adds a delay. Denoisers, dereverbers, neural codecs, even some resamplers - they buffer frames and shift your audio in time without telling you. Compare the processed file against the original sample-by-sample and you'll get garbage: the null test will look terrible even if the processor was perfect, because you're subtracting two versions that aren't aligned. This node is the fix - it measures the time offset between a reference and a processed file and shifts the processed one back into line.
It's the first stage of the Egregora null-test pipeline (align → gain match → subtract), and it's also the one you run when a previous null test came back noisy and you suspect timing rather than quality.
How it works
The node uses GCC-PHAT - Generalized Cross-Correlation with Phase Transform - to estimate the delay. That's the audio-alignment workhorse: it cross-correlates the two signals in the frequency domain while phase-normalizing, which makes the correlation peak sharp even on reverberant or noisy material. The default align_method dropdown only offers gcc-phat, which tells you this pack is making one deliberate choice rather than exposing the whole menu.
Two settings control precision:
max_shift_ms(default 200) - how far to search for the offset. Bigger is safer but slower; 200 ms covers real-world processor latency.fractional(default on) - enables sub-sample alignment via an FIR fractional-delay filter withfir_lentaps (default 64). Processors don't delay by whole-sample counts, so this is usually what makes the null test actually null.
The node resamples the processed file to the reference rate if they differ, then reports the offset as both delay_samples and delay_ms, plus a peak_corr FLOAT and a debug_image (a matplotlib plot of the two waveforms) so you can eyeball whether the alignment actually landed.
The inputs that matter
audio_ref/audio_proc- reference and (misaligned) processed audio.max_shift_ms- raise it only if your delay is longer than 200 ms.fractional- keep on; it's the difference between "aligned" and "sample-locked."
Outputs: audio_proc_aligned (the shifted audio), the two delay numbers, peak_corr, and the debug image.
The take
There's nothing to install beyond the pack (NumPy + matplotlib, which ComfyUI already has). The one habit to build: after a processor changes timing, re-align before you trust any downstream measurement. And note this node only aligns - the null-test suite's Full node chains alignment, gain matching, and subtraction into one go, so if you're new, start there and use this when you want to see the delay step in isolation.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| audio_ref | AUDIO | — | |
| audio_proc | AUDIO | — | |
| max_shift_msopt | INT | 2000–5000 | — |
| align_methodopt | COMBO | 1 options: gcc-phat | |
| fractionalopt | BOOLEAN | true | — |
| fir_lenopt | INT | 6416–256 | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| audio_proc_aligned | AUDIO | — |
| delay_samples | FLOAT | — |
| delay_ms | FLOAT | — |
| peak_corr | FLOAT | — |
| debug_image | IMAGE | — |