- From: Chris Rogers <crogers@google.com>
- Date: Thu, 9 Jun 2011 12:06:19 -0700
- To: public-audio@w3.org
- Message-ID: <BANLkTi=XhsTnQmd__Lpv2ci961J34T0p5g@mail.gmail.com>
I describe "efficient biquad filters for lowpass, highpass, and other common
filter" in my specification proposal here:
http://chromium.googlecode.com/svn/trunk/samples/audio/specification/specification.html#Features-section
Up to this point there have been undocumented LowPass2FilterNode
and HighPass2FilterNode AudioNodes which
are created with these two AudioContext methods:
interface AudioContext {
.
.
LowPass2FilterNode createLowPass2Filter();
HighPass2FilterNode createHighPass2Filter();
.
.
.
}
Since I believe this approach doesn't scale well to the larger family of
filter types, a BiquadFilterNode seems better:
I discuss the possibility of BiquadFilterNode in my specification proposal
in the API Overview section:
http://chromium.googlecode.com/svn/trunk/samples/audio/specification/specification.html#APIOverview-section
I've had a go at implementing this with a new createBiquadFilter() method
and three parametric BiquadFilterNode AudioParams: frequency, Q, gain
interface AudioContext {
.
.
BiquadFilterNode createBiquadFilter();
.
.
.
}
BiquadFilterNode : AudioNode {
// Filter type.
const unsigned short LOWPASS = 0;
const unsigned short HIGHPASS = 1;
const unsigned short BANDPASS = 2;
const unsigned short LOWSHELF = 3;
const unsigned short HIGHSHELF = 4;
const unsigned short PEAKING = 5;
const unsigned short NOTCH = 6;
const unsigned short ALLPASS = 7;
attribute unsigned short type;
readonly attribute AudioParam frequency; // in Hertz
readonly attribute AudioParam Q; // Quality factor
readonly attribute AudioParam gain; // in Decibels
};
An implementation of this is available in the latest Chrome canary builds.
I hope to update the specification proposal soon with this IDL as well as
some more detailed background.
Chris
Received on Thursday, 9 June 2011 19:06:44 UTC