export interface EnvelopeResult { path: string; envelope: Float64Array; /** Total file duration in seconds. */ durationSec: number; } export interface EnvelopeSyncOptions { /** Search window in seconds. Larger = finds bigger drifts but slower. Default 10. */ maxLagSec?: number; signal?: AbortSignal; } export interface EnvelopeSyncResult { reference: string; results: Array<{ path: string; /** Positive = file starts later than reference. */ offsetSec: number; /** 0..1 normalised correlation strength at the chosen lag. */ confidence: number; }>; /** Set when ANY pair correlated below 0.3 (low-confidence alignment). */ warning?: string; } /** * Extract a mono 16kHz RMS energy envelope. One value every 100ms. */ export declare function extractEnvelope(inputPath: string, opts?: { signal?: AbortSignal; }): Promise; /** * Find the lag (in blocks) at which envelope `a` best aligns with envelope `b`. * Searches ±maxLagBlocks. Returns peak lag and normalised Pearson correlation. * * Convention: maximises sum(a[i - lag] * b[i]). So: * - Positive lag = `a` LEADS `b` (a's peaks happen at smaller indices than b's) * - Negative lag = `a` TRAILS `b` (a's peaks happen at larger indices) * * Callers convert this to a wall-clock offset: * offsetSec = -lagBlocks * blockSec * (positive offset = `a` started later than `b`). */ export declare function correlateEnvelopes(a: Float64Array, b: Float64Array, maxLagBlocks: number): { lagBlocks: number; correlation: number; }; /** * Align 2+ inputs using envelope correlation. Reference is the first input. * For each non-reference input, compute the correlation lag and report the * offset in seconds. */ export declare function envelopeSync(inputPaths: string[], opts?: EnvelopeSyncOptions): Promise; //# sourceMappingURL=envelope-sync.d.ts.map