scripts/xa-advanced.js — Griffin-Lim reconstruction A/B (post-repair)

A 440 + 660 Hz chord's |STFT(1024, 256)| goes through griffinlim(32) with deterministic zero-phase init. Before the repair this returned one sample (istft arg-shift put center=true into length). Badges mirror examples/node/xa-advanced.mjs: audio-length output, strictly decreasing spectral convergence over iterations 1–8, <10% relative L2 magnitude error after 32 iterations, and an FFT-peak pitch within 1% of 440 Hz. A/B the audio yourself — phase is invented, pitch must survive.

target |STFT| (original)

|STFT| of the 32-iteration reconstruction

spectral-convergence error vs iteration (k = 1..8, deterministic)