UNPKG

2.87 kBTypeScriptView Raw
1import { ToneAudioNode, ToneAudioNodeOptions } from "../../core/context/ToneAudioNode.js";
2import { Cents, Frequency, GainFactor } from "../../core/type/Units.js";
3import { Param } from "../../core/context/Param.js";
4export interface BiquadFilterOptions extends ToneAudioNodeOptions {
5 frequency: Frequency;
6 detune: Cents;
7 Q: number;
8 type: BiquadFilterType;
9 gain: GainFactor;
10}
11/**
12 * Thin wrapper around the native Web Audio [BiquadFilterNode](https://webaudio.github.io/web-audio-api/#biquadfilternode).
13 * BiquadFilter is similar to {@link Filter} but doesn't have the option to set the "rolloff" value.
14 * @category Component
15 */
16export declare class BiquadFilter extends ToneAudioNode<BiquadFilterOptions> {
17 readonly name: string;
18 readonly input: BiquadFilterNode;
19 readonly output: BiquadFilterNode;
20 /**
21 * The frequency of the filter
22 */
23 readonly frequency: Param<"frequency">;
24 /**
25 * A detune value, in cents, for the frequency.
26 */
27 readonly detune: Param<"cents">;
28 /**
29 * The Q factor of the filter.
30 * For lowpass and highpass filters the Q value is interpreted to be in dB.
31 * For these filters the nominal range is [−𝑄𝑙𝑖𝑚,𝑄𝑙𝑖𝑚] where 𝑄𝑙𝑖𝑚 is the largest value for which 10𝑄/20 does not overflow. This is approximately 770.63678.
32 * For the bandpass, notch, allpass, and peaking filters, this value is a linear value.
33 * The value is related to the bandwidth of the filter and hence should be a positive value. The nominal range is
34 * [0,3.4028235𝑒38], the upper limit being the most-positive-single-float.
35 * This is not used for the lowshelf and highshelf filters.
36 */
37 readonly Q: Param<"number">;
38 /**
39 * The gain of the filter. Its value is in dB units. The gain is only used for lowshelf, highshelf, and peaking filters.
40 */
41 readonly gain: Param<"decibels">;
42 private readonly _filter;
43 /**
44 * @param frequency The cutoff frequency of the filter.
45 * @param type The type of filter.
46 */
47 constructor(frequency?: Frequency, type?: BiquadFilterType);
48 constructor(options?: Partial<BiquadFilterOptions>);
49 static getDefaults(): BiquadFilterOptions;
50 /**
51 * The type of this BiquadFilterNode. For a complete list of types and their attributes, see the
52 * [Web Audio API](https://webaudio.github.io/web-audio-api/#dom-biquadfiltertype-lowpass)
53 */
54 get type(): BiquadFilterType;
55 set type(type: BiquadFilterType);
56 /**
57 * Get the frequency response curve. This curve represents how the filter
58 * responses to frequencies between 20hz-20khz.
59 * @param len The number of values to return
60 * @return The frequency response curve between 20-20kHz
61 */
62 getFrequencyResponse(len?: number): Float32Array;
63 dispose(): this;
64}
65
\No newline at end of file