Re: High Pass Filter example?
Re: High Pass Filter example?
- Subject: Re: High Pass Filter example?
- From: James McCartney <email@hidden>
- Date: Thu, 5 Jun 2003 07:06:59 -0700
On Wednesday, June 4, 2003, at 09:31 PM, email@hidden wrote:
Hi,
I'm looking for a basic single pole high pass filter. Does anyone
know the
high pass version of this low pass filter?
inline double LowPassFilter(double input, double inCutoff, double&
ioPrev)
{
ioPrev = (input * (1.0 - inCutoff)) + (ioPrev * inCutoff);
return ioPrev;
}
First of all let's make this one efficient. Here is the equivalent code
to the above, but with one less multiply. inCoef (inCutoff is a
misnomer really) should be (0..1)
inline double OnePoleLowpassFilter(double input, double inCoef, double&
ioPrev)
{
ioPrev = input + inCoef * (ioPrev - input);
return ioPrev;
}
Here's a hi pass version, inCoef (0..1) as above.
inline double OnePoleHipassFilter(double input, double inCoef, double&
ioPrev)
{
ioPrev = input - inCoef * (ioPrev + input);
return ioPrev;
}
Here's one where it is hipass for inCoef (-1..0), lowpass for inCoef
(0..1) :
inline double OnePoleFilter(double input, double inCoef, double& ioPrev)
{
ioPrev = input * (1.0 - fabs(inCoef)) + inCoef * ioPrev;
return ioPrev;
}
I suggest joining the music-dsp mailing list for this sort of question.
the music-dsp mailing list and website: subscription info, FAQ, source
code archive, list archive, book reviews, dsp links
http://shoko.calarts.edu/musicdsp/
http://ceait.calarts.edu/mailman/listinfo/music-dsp
--
--- james mccartney
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.