这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。
BiquadFilterNode()
构造函数创建一个新的BiquadFilterNode
对象, 这个对象通过AudioContext.createBiquadFilter()方法创建,表示一个简单的低阶滤波器.
语法
var biquadFilterNode = new BiquadFilterNode(context, options)
参数
- context
AudioContext
的一个引用.- options可选
- 可选配置项如下:
type
: 值为其中之一"lowpass
", "highpass
", "bandpass
", "lowshelf
", "highshelf
", "peaking
", "notch
", "allpass
". 其他选项的含义取决于此选项的值.
低通滤波器
: 允许低于截止频率的频率通过, and attenuates frequencies above the cutoff. This is a standard second-order resonant lowpass filter with 12dB/octave rolloff.Q
: Controls how peaked the response will be at the cutoff frequency. A large value makes the response more peaked. Please note that for this filter type, this value is not a traditional Q, but is a resonance value in decibels.frequency
: The cutoff frequency.gain
: Not used.
-
highpass
: A highpass filter is the opposite of a lowpass filter. Frequencies above the cutoff frequency are passed through, but frequencies below the cutoff are attenuated. It implements a standard second-order resonant highpass filter with 12dB/octave rolloff.Q
: Controls how peaked the response will be at the cutoff frequency. A large value makes the response more peaked. Please note that for this filter type, this value is not a traditional Q, but is a resonance value in decibels.frequency
: The cutoff frequency.gain
: Not used.
-
bandpass
: A bandpass filter allows a range of frequencies to pass through and attenuates the frequencies below and above this frequency range. It implements a second-order bandpass filter.Q
: Controls the width of the band. The width becomes narrower as the Q value increases.frequency
: The center of the frequency band.gain
: Not used.
-
lowshelf
: The lowshelf filter allows all frequencies through, but adds a boost (or attenuation) to the lower frequencies. It implements a second-order lowshelf filter.Q
: Not used.frequency
: The upper limit of the frequences where the boost, or attenuation, is applied.gain
: The boost, in dB, to be applied. If the value is negative, the frequencies are attenuated.
-
highshelf
: The highshelf filter is the opposite of the lowshelf filter and allows all frequencies through, but adds a boost to the higher frequencies. It implements a second-order highshelf filter.Q
: Not used.frequency
: The lower limit of the frequences where the boost, or attenuation, is applied.gain
: The boost, in dB, to be applied. If the value is negative, the frequencies are attenuated.
-
peaking
: The peaking filter allows all frequencies through, adding a boost, or attenuation, to a range of frequencies.Q
: The width of the band of frequencies that are boosted. A large value implies a narrow width.frequency
: The center frequency of the boost range.gain
: The boost, in dB, to be applied. If the value is negative, the frequencies are attenuated.
-
notch
: The notch filter (also known as a band-stop, or band-rejection filter) is the opposite of a bandpass filter. It allows all frequencies through, except for a set of frequencies.Q
: The width of the band of frequencies that are attenuated. A large value implies a narrow width.frequency
: The center frequency of the attenuation range.gain
: Not used.
-
allpass
: An allpass filter allows all frequencies through, but changes the phase relationship between the various frequencies. It implements a second-order allpass filter.Q
: The sharpness of the phase transition at the center frequency. A larger value implies a sharper transition and a larger group delay.frequency
: The frequency where the center of the phase transition occurs. Viewed another way, this is the frequency with maximal group delay.gain
: Not used.
Specifications
Specification | Status | Comment |
---|---|---|
Web Audio API BiquadFilterNode() |
Working Draft | Initial definition. |
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 55.0 | ? | ? | 42 | ? |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | 未实现 | 55.0 | ? | ? | ? | 42 | ? | 55.0 |