Spectrogram Merger

Build One Ideal Master from Multiple Versions of a Track

Combine 2, 3, or more WAV recordings — different remasters, vinyl rips, AI upscales (Apollo, AudioSR, FlashSR), or studio takes — into one clean master. Keeps the best frequencies and transients from every source without phase cancellation or comb filtering.

LEARN MORE
Product Interface

How Spectral Merging Works

STAGE 02 · BANDS & WINDOWS f_c(t) = Σ f_k·|X(k,t)| / Σ |X(k,t)|

Adaptive Crossovers & Time-Varying STFT

Splits audio into Low, Mid, and High bands at natural spectral dips or with centroid-tracking Linkwitz-Riley filters. Window length σ(t) adapts from 10 ms on sharp hits to 90 ms on sustained tones.

STAGE 03 · MASKING & EQ M₁ = Re(X₁·Mix*) / (|Mix|² + ε), Inf ∈ [0.1×..10×]

7 Masking Engines, 12-Band EQs & Influence Map

PSF, Softmax, Wiener, IBM/IRM with 24-band Zwicker loudness and 5 dynamic modulations (SNR, Flux, Flatness, Coherence, Cross-Adaptive). Three 12-band panels let you steer source preference per band.

STAGE 05 · SPECTRUM CLEANUP HPSS(Median/NMF) → LPC(16) → Q > Q_thr

HPSS (Median/NMF), LPC Envelope & De-Resonance

Separates harmonics and percussion for targeted cleanup, transplants natural LF/MF spectral envelope onto HF (LPC / Cepstrum), and notches narrowband whistling peaks by Q-factor and LGD stability.

UNDER THE HOOD • RUST 2024 & WGPU 30.0

Technology Stack

The one slide about implementation: heavy 2D FFT, NMF, CEEMDAN, and cascaded WOLA math runs in native multithreaded Rust with a hardware-accelerated WGPU 30.0 interface — zero Python, zero Electron overhead.

Rust 2024 Zero Python / C runtime deps
WGPU 30.0 144 Hz UI & live spectrograms
17 Groups / 150+ Inspectable parameter reflection
Rayon + Arena Parallel WOLA & 64 MB scratchpad
01

Core DSP Math Engine

rustfft 6.2 • num-complex • rayon 1.10

Parallel STFT/ISTFT, 2D Poisson FFT solver, Bregman iterations, ensemble CEEMDAN, and 16-byte aligned LinearArena memory.

02

Hardware GPU Interface

wgpu 30.0 • winit 0.30 • ui.wgsl • arcband

Two-layer SDF rounded UI rendering, bilinear Magma/Viridis spectrogram textures, and subpixel typography at full monitor refresh rate.

03

Declarative Reflection

Inspectable trait • serde_json • toml

All 150+ parameters auto-layout into a searchable 3-column inspector with per-pair JSON profile persistence.

04

Native Audio I/O & Audition

hound 3.5 • cpal 0.15 • cubic resampler

Bit-accurate WAV (Float32, PCM 16/24/32 + TPDF/NS), live CPAL playback with cubic resampling and real-time Butterworth band-pass.

RUST 2024
fn align_phase_correlation(
    y1: &[f32], y2: &[f32],
    max_shift: usize, confidence_threshold: f32,
) -> (i64, f32) {
    let fft_len = y1.len().min(y2.len()).next_power_of_two();
    let mut planner = FftPlanner::<f32>::new();
    let fft = planner.plan_fft_forward(fft_len);
    let ifft = planner.plan_fft_inverse(fft_len);

    fft.process(&mut a);
    fft.process(&mut b);
    for i in 0..fft_len {
        let cps = a[i] * b[i].conj();
        a[i] = cps / (cps.norm() + EPSILON);
    }
    ifft.process(&mut a);

    let mut lag = if peak_idx <= fft_len / 2 {
        peak_idx as i64
    } else {
        peak_idx as i64 - fft_len as i64
    };
    if peak_val < confidence_threshold || lag.unsigned_abs() as usize > max_shift {
        lag = 0;
    }
    (lag, peak_val)
}
pub fn calculate_psf_mask(
    stft1: &ComplexSpec2D, stft2: &ComplexSpec2D, psf_power: f32,
) -> (Spec2D, Spec2D) {
    let mut m1 = Spec2D::full(stft1.bins, stft1.frames, 0.5);
    let mut m2 = Spec2D::full(stft1.bins, stft1.frames, 0.5);
    let p = psf_power.clamp(1.0, 4.0);

    for i in 0..stft1.data.len() {
        let mix = stft1.data[i] + stft2.data[i];
        let den = mix.norm_sqr() + EPSILON;
        let a1 = ((stft1.data[i] * mix.conj()).re / den).max(0.0).powf(p);
        let a2 = ((stft2.data[i] * mix.conj()).re / den).max(0.0).powf(p);
        let v1 = (a1 / (a1 + a2 + EPSILON)).clamp(0.0, 1.0);
        m1.data[i] = v1;
        m2.data[i] = 1.0 - v1;
    }
    (m1, m2)
}
pub fn phase_reconstruction_explicit(
    mag: &Spec2D, n_fft: usize, hop_length: usize,
    sr: u32, params: &ProcessingParams,
) -> Spec2D {
    let sigma_sec = params.explicit_relation_window_len as f32 / (6.0 * sr as f32);
    let sigma_sq = sigma_sec * sigma_sec;

    for b in 0..bins {
        let omega = 2.0 * PI * freqs[b];
        for t in 0..frames {
            dphi_dt.set(b, t, omega + dlog_dw.get(b, t) / (2.0 * PI * sigma_sq + EPSILON));
            dphi_dw.set(b, t, -sigma_sq * dlog_dt.get(b, t) - t_half);
        }
    }
    for b in 0..bins {
        for t in 0..frames {
            let lap = if b == 0 && t == 0 { EPSILON } else { -(kx * kx + ky * ky) };
            div[b * frames + t] /= lap;
        }
    }
    solve_2d_ifft(&mut div, bins, frames)
}
fn decompose_emd_1d(
    signal: &[f32], max_imfs: usize, method: EmdMethod,
) -> Vec<Vec<f32>> {
    let ensembles = match method {
        EmdMethod::Emd => 1,
        EmdMethod::Eemd | EmdMethod::Ceemdan => 4,
    };
    let ensemble_imfs: Vec<_> = (0..ensembles)
        .into_par_iter()
        .map(|e| {
            let mut residual = add_ensemble_noise(signal, e, noise_amp);
            (0..k_imfs).map(|_| {
                let imf = sift_single_imf(&residual, 5);
                subtract_in_place(&mut residual, &imf);
                imf
            }).collect::<Vec<_>>()
        })
        .collect();
    average_ensembles(ensemble_imfs, signal.len(), k_imfs)
}

Instant A/B Preview & Cascaded Chain Studio

Load a folder of WAV files, drag and drop to set cascade order, and sculpt each merge pair with 12-band EQs and Influence Map. Switch across 12 spectrogram and mask views, toggle Raw/Final or Previous/Current tests in one click, and solo any frequency range with the live band-pass filter.

12 SPECTRUM & MASK VIEWS A/B: RAW / FINAL / PREVIOUS LIVE BAND-PASS FILTER (HZ) 3×12-BAND EQ & INFLUENCE
Instant A/B Preview & Cascaded Chain Studio
Go to Downloads

Spectrogram Merger Detailed FAQ

Purpose & Use Cases

Why does Spectrogram Merger exist and what problems does it solve?
Simply summing two versions of the same track in a DAW causes comb filtering, volume dips, and metallic phasing. Spectrogram Merger combines two or more versions in the time-frequency domain, picking the cleanest, sharpest, and most detailed source at every frequency bin. It is built for fusing outputs of multiple AI audio upscalers (Apollo, AudioSR, FlashSR, SoundUP), combining a warm vinyl rip with a crisp digital master, or merging the best vocal and instrumental regions from different takes.
Can I merge more than two WAV files in one workflow?
Yes. In the Batch tab, load a folder with 2, 3, 4, or more WAV files and reorder them via Drag & Drop. The app runs a cascaded merge chain: Track 1 + Track 2 (Pair 1), then the result + Track 3 (Pair 2), and so on. Each pair keeps its own independent JSON parameter profile, accessible directly from the top bar of the editor.
How does it handle tracks with different loudness, timing offsets, or EQ tilt?
Both inputs are first normalized to EBU R128 integrated loudness (-23.0 LUFS default with K-weighting). Next, Auto-Align detects sample-accurate time lag via CPSD phase correlation (with confidence threshold) or cross-correlation. Finally, Spectral Balance compares spectral slopes in dB/octave and compensates for brightness mismatches so neither source unfairly biases the mask.
How do the 12-band EQs and Influence Map work?
At the bottom of the editor sit three 12-band graphic panels (29 Hz to 20 kHz). EQ Input 1 and EQ Input 2 (±12 dB) shape each source before masking, while the Influence Map (0.1× – 10.0×) biases mask weights toward Input 1 or Input 2 per frequency band — for instance, locking low-end bass to Source 1 while pulling high-frequency air from Source 2.

Band Splitting & STFT

How is the signal split into Low, Mid, and High frequency bands?
Three modes are available: fixed zero-phase Butterworth filterbanks (order 1–10 via filtfilt), Adaptive Band Frequencies (automatically locating natural spectral dips for Low/Mid and Mid/High splits with prominence control), and Time-Varying Linkwitz-Riley filters (2nd/4th order) whose crossover frequencies track the smoothed spectral centroid over time.
Why use TimeVaryingWindow or multi-scale STFT resolution?
Long windows give sharp frequency resolution on sustained notes but blur drum hits (pre-echo); short windows keep transients crisp but blur bass pitch. TimeVaryingWindow continuously adapts window length (10–90 ms) per frame using transience, spectral flatness, or entropy. Multi-scale mixing (e.g. 12 / 46 / 93 ms) and independent band FFT sizes (Low 2048, Mid 2048, High 4096) are also supported.
How are full-length tracks processed without boundary clicks or high RAM usage?
Full renders slice audio into 15-second chunks with 7.5-second overlap and reflected edge padding, process chunks in parallel, and seamlessly reassemble them via WOLA weighted overlap-add (Hann, Hamming, Blackman, Blackman-Harris, or Bartlett synthesis windows).

Masking & Stereo Image

Which base masking methods are included and how do they differ?
Seven methods are available: PSF (Phase-Sensitive Filter), enabled by default, projects complex source vectors onto the mixture to avoid cancellation; Weights (Softmax) and WeightsPhaseAware blend raw and perceptual magnitudes (24-band Zwicker loudness or A-weighting); Wiener / WienerModulated with optional noise subtraction; plus hard IBM and soft IRM ratio masks.
What do the 5 dynamic mask modulations do?
Modulations refine the base mask with a level- and frequency-aware reliability factor: Spectral Flux protects sharp transients; SNR modulation (LocalMinStats, MedianFilterTime, SpectralSubtractionAvg, GlobalPercentile) favors the cleaner source; Flatness emphasizes tonal clarity; Phase Coherence penalizes phase-conflicting bins; and Cross-Adaptive gamma softens masks toward 0.5 when both sources are nearly identical.
How does mask smoothing eliminate 'musical noise'?
Abrupt mask jumps between adjacent bins create watery artifacts. The smoother applies a 2D median filter, transient-adaptive 2D Gaussian smoothing (reducing temporal blur on attacks), temporal crossfading, and vertical smoothing on linear or perceptual Mel / Bark scales with linear or cubic interpolation.
How is stereo width and center stability preserved?
Independent L/R masking can cause the stereo center to drift. Stereo Mask Coupling measures Interaural Coherence (IC) and gently pulls L/R masks toward their average on centered mono elements while keeping wide stereo elements independent.

Phase Reconstruction (13 Modes)

Which phase reconstruction algorithms are built in?
Spectrogram Merger includes 13 modes: fast Complex, Dominant, and Blend; locally weighted LWS; iterative FGLA (Nesterov-accelerated Fast Griffin-Lim), RTISI-LA, and RTISI-LA Hybrid; Bregman KL and Bregman IS divergence optimization; analytical Explicit Phase Relation (2D Poisson FFT), SPSI, and RTPGHI; plus the intelligent Adaptive engine.
How does Adaptive phase mode choose the right algorithm?
For every time-frequency bin it evaluates tonality, local SNR, coherence, harmonic/percussive ratio, spectral flux, local group delay (LGD) variance, and mask decisiveness. Softmax suitability weights are computed, weak candidates are pruned (Top-N / threshold), and surviving phases are blended. Harmonic and percussive layers can use separate method lists.
How does Coupled IPD protect the stereo phase?
In CoupledIPD mode, the left channel phase is reconstructed by the selected engine, and the right channel phase is locked to it via the true Interaural Phase Difference (IPD from the dominant source or mix), weighted by Interaural Coherence (IC). This prevents stereo collapse and phasey width artifacts.
What are Mask-Guided Phase Iteration and Magnitude-Constraint PR?
They are optional post-merge refinement passes. Mask-Guided Phase Iteration iteratively pulls the output phase toward the dominant source wherever mask confidence is high. Magnitude-Constraint PR aligns phase with a gently smoothed magnitude envelope to remove remaining high-frequency roughness.

Post-Processing, A/B & Export

What do Post-HPSS refinement and Envelope Transplantation do?
Post-HPSS splits the merged audio into harmonic and percussive layers (Median or NMF with KL/Frobenius divergence), smoothing harmonics in time and percussion in frequency across a configurable HF transition. Envelope Transplantation estimates the natural LF/MF spectral envelope via Levinson-Durbin LPC or Cepstrum and smoothly corrects the HF contour.
How are whistling resonances, harshness, and HF transient spikes removed?
Resonance Suppression detects high-Q, stable-LGD narrowband peaks and notches them dynamically. Sharpness Reduction measures Zwicker sharpness in acums and applies a gentle high shelf when needed. HF Vertical Artifact Suppression catches abnormal flux spikes (median + N·Std) and smooths them along frequency with envelope protection. MPEG-1 perceptual masking is also included.
What does EMD / EEMD / CEEMDAN do on high frequencies?
The high-frequency band (above 6 kHz by default) is decomposed in the time domain into Intrinsic Mode Functions (IMFs) via EMD, EEMD, or CEEMDAN. Target modes are selected by order, Hilbert instantaneous frequency, or entropy, then envelope-smoothed, attenuated, or removed — clearing digital grit while keeping natural air.
How does A/B auditioning work and what export formats are supported?
In the right panel you can test any segment (e.g. 8 seconds), inspect 12 spectrogram and intermediate mask views, and see Low/Mid/High source contribution percentages. One-click toggles switch Raw vs Final, Current vs Previous test, Loop, and a live Band-Pass filter (Hz) to solo any frequency band. Final export writes WAV 32-bit Float or PCM 32 / 24 / 16-bit with TPDF dithering and 1st-order noise shaping.