UNPKG

octave-bands

Version:

Frequency limits for fractional Octave Bands

35 lines (34 loc) 1.38 kB
export declare type Options = { /** * Center frequency of the band to use as a starting point (default `1000` Hz) */ center?: number; /** * The audio spectrum for center frequencies (default `[15, 21000]`) */ spectrum?: [number, number]; }; /** * Lower, center and higher frequencies bounds of a band */ export declare type Band = [number, number, number]; /** * Calculates and returns the frequency limits for octave bands. * @param fraction (default `1`) octave bands fraction * @param options (optional) bands limit options * @returns an array of bands, where each band is a tuple of `[lower, center, higher]` frequencies */ export declare const octaves: (fraction?: number, options?: Options) => Band[]; /** * Calculates the fractional bandwidth per given octave band: * `BW = (f_high - f_low) / f_center` * @param fraction (default `1`) octave band fraction */ export declare const bandwidth: (fraction?: number) => number; /** * Calculates the frequency bounds for a given spectrum and number of bands * @param bands number of bands * @param spectrum the audio spectrum for bands' center frequencies (default `[15, 21000]`) * @returns an array of bands, where each band is a tuple of `[lower, center, higher]` frequencies */ export declare const equalizer: (bands: number, options?: Pick<Options, 'spectrum'>) => Band[];