/** * Sample-rate conversion. * * The default is a windowed-sinc (Kaiser) interpolator — the same design SoX * and libsamplerate use. Cheaper alternatives are offered explicitly, because * the naive ones are the reason so much web audio sounds bad: * * - **Dropping or duplicating samples** (what a bare index-scale loop does) * aliases badly and adds audible grit. * - **Linear interpolation** is a poor low-pass: it rolls off the top octave and * still passes significant aliasing. Fine for a preview, wrong for a file * somebody keeps. * - **Windowed sinc** approximates the ideal reconstruction filter. It costs * more arithmetic and is worth it for anything that gets saved or shipped. * * Downsampling additionally needs the anti-alias cutoff moved *below* the new * Nyquist frequency before decimation. Skipping that step folds high frequencies * back down as inharmonic noise, which is the single most common resampling bug. */ export type ResampleQuality = 'fast' | 'good' | 'best'; export interface ResampleOptions { /** * `'best'` (default) windowed sinc, `'good'` cubic, `'fast'` linear. * * Use `'fast'` for realtime previews and waveform thumbnails; keep `'best'` * for anything the user will download. */ quality?: ResampleQuality; } /** Output frame count for a given conversion. */ export declare function resampledLength(inputFrames: number, fromRate: number, toRate: number): number; /** * Resamples one channel. * * @param input Source samples. * @param fromRate Source sample rate in Hz. * @param toRate Target sample rate in Hz. */ export declare function resampleChannel(input: Float32Array, fromRate: number, toRate: number, options?: ResampleOptions): Float32Array; /** Resamples every channel of a planar buffer. */ export declare function resamplePlanar(channels: readonly Float32Array[], fromRate: number, toRate: number, options?: ResampleOptions): Float32Array[];