audioJS

@audio/measure-align

Status calibrated

npm1.0.2licenseMIT

Multi-mic phase/time alignment — signed cross-correlation delay + polarity (Auto-Align class)

Overview

Install
Updated
Family
measure, 7 packages under it
import align from '@audio/measure-align'

Signed cross-correlation peak between two channels gives the delay and polarity of b relative to a; pass apply: true to also get b shifted into alignment and polarity-corrected.

align(a, b, { fs })                       // { delay, seconds, polarity }
align(a, b, { fs, apply: true })           // + { aligned }
Param Default
a — reference channel (Float32Array)
b — channel to align (Float32Array)
fs 44100 sample rate
apply false when true, also return aligned: b shifted by delay and polarity-flipped

Returns:

Field
delay number samples b lags a (signed)
seconds number delay / fs
polarity 1 | -1 polarity of b relative to a
aligned? Float32Array present only when apply: true

Use when: multi-mic recordings (drum overheads, DI + amp blend, room + close mics) need per-channel delay and polarity correction before summing — comb-filtering from misaligned mics is inaudible per-track and destructive on sum.


Part of @audio/measure — the measure family umbrella.

MIT © audiojs