/** * Level control: gain, fades, and normalisation. */ /** Applies a linear gain to every channel. */ export declare function applyGain(channels: readonly Float32Array[], linear: number): Float32Array[]; /** Fade shapes. */ export type FadeCurve = /** Straight line in amplitude. Simple, but dips in perceived level mid-fade. */ 'linear' /** Straight line in decibels. Sounds like a hand moving a fader. */ | 'exponential' /** Constant-power sine/cosine. The right choice for crossfades. */ | 'equalPower'; export interface FadeOptions { /** Fade-in length in frames. */ inFrames?: number; /** Fade-out length in frames. */ outFrames?: number; /** Shape. Defaults to `'linear'`. */ curve?: FadeCurve; } /** Applies a fade-in and/or fade-out. */ export declare function applyFade(channels: readonly Float32Array[], options: FadeOptions): Float32Array[]; /** * Crossfades from `a` into `b` over `overlapFrames`. * * Uses equal-power curves by default. Linear crossfades sum to a level dip in * the middle for uncorrelated material — the classic "hole" in a DJ transition. */ export declare function crossfade(a: readonly Float32Array[], b: readonly Float32Array[], overlapFrames: number, curve?: FadeCurve): Float32Array[]; /** How a normalisation target is interpreted. */ export type NormalizeUnit = /** Highest sample value. Fast, but says nothing about perceived loudness. */ 'peak' /** Inter-sample peak. What "-1 dBTP" targets mean. */ | 'truePeak' /** Perceived loudness per ITU-R BS.1770. What streaming platforms use. */ | 'LUFS'; export interface NormalizeOptions { /** Target level in dB (dBFS for peak modes, LUFS for loudness). */ to?: number; /** Which measurement to hit. Defaults to `'peak'`. */ unit?: NormalizeUnit; /** * Ceiling in dBTP that the result must not exceed. Only meaningful with * `unit: 'LUFS'`, where hitting a loudness target can otherwise push peaks * into clipping. Defaults to -1 dBTP; pass `null` to disable. */ truePeakCeiling?: number | null; } export interface NormalizeResult { channels: Float32Array[]; /** Linear gain that was applied. */ gain: number; /** Measured level before the change, in dB or LUFS. */ measured: number; /** True when `truePeakCeiling` reduced the gain below the loudness target. */ limitedByPeak: boolean; } /** * Scales audio to hit a target level. * * With `unit: 'LUFS'` the gain needed for the loudness target can push peaks * past full scale, so the result is additionally held under `truePeakCeiling`. * Reporting `limitedByPeak` matters: it tells the caller the loudness target was * *not* met, rather than leaving them to wonder why two normalised files still * differ in level. */ export declare function normalize(channels: readonly Float32Array[], sampleRate: number, options?: NormalizeOptions): NormalizeResult;