/** * Silence detection and DC-offset removal. */ export interface SilenceOptions { /** * Level below which audio counts as silent, in dBFS. Defaults to -60. * * A literal zero threshold almost never works: real recordings carry a noise * floor from the preamp and converter, so "silence" is quiet, not absent. */ threshold?: number; /** * Window in milliseconds over which level is measured. Defaults to 10. * * Measuring per sample would treat every zero crossing of a loud waveform as * silence, cutting holes through the middle of a note. */ windowMs?: number; } /** A detected span of silence, in frames. */ export interface SilentRange { start: number; end: number; } /** Finds every silent span. */ export declare function detectSilence(channels: readonly Float32Array[], sampleRate: number, options?: SilenceOptions): SilentRange[]; export interface TrimSilenceOptions extends SilenceOptions { /** Trim leading silence. Defaults to `true`. */ start?: boolean; /** Trim trailing silence. Defaults to `true`. */ end?: boolean; /** * Silence to leave in place, in milliseconds. Defaults to 0. * * Trimming hard to the first audible sample clips the attack of the first * note and sounds abrupt; a few milliseconds of lead-in usually sounds right. */ paddingMs?: number; } /** Removes silence from the start and/or end. */ export declare function trimSilence(channels: readonly Float32Array[], sampleRate: number, options?: TrimSilenceOptions): Float32Array[]; /** * Removes DC offset by subtracting each channel's mean. * * A DC offset eats headroom asymmetrically and can produce a click at the start * and end of playback. It usually comes from a poorly-biased ADC or an analogue * input stage, and shows up as a waveform that is not centred on zero. */ export declare function removeDcOffset(channels: readonly Float32Array[]): Float32Array[];