I remember seeing the code for a Highpass filter a few days back somewhere in the samples, however I can't find it anywhere now! Could someone remember me where the Highpass filter implementation code was?
Or better yet post the algorithm?
Thanks!
The total noise power at the output of a system directly depends on the system bandwidth. That's why we need a low-pass filter to limit the bandwidth to the maximum frequency needed by the application. This maximizes the resolution and dynamic range of the accelerometer.
High pass filters are most commonly used to remove low-frequency content that is not within an instrument's frequency range. As a general starting point, you should place a high pass filter on each channel and adjust it according to the lowest frequency the sound source can produce.
A high-pass filter (HPF) attenuates content below a cutoff frequency, allowing higher frequencies to pass through the filter. A low-pass filter (LPF) attenuates content above a cutoff frequency, allowing lower frequencies to pass through the filter.
A high pass filter is a simple, effective type of EQ curve, one that scoops out unwanted low frequencies from any audio source. They are fantastic when used correctly to clean up woofy signals and tighten up arrangements. When used incorrectly, they can cause more problems than they solve.
From the idevkit.com forums:
#define kFilteringFactor 0.1
static UIAccelerationValue rollingX=0, rollingY=0, rollingZ=0;
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
// Calculate low pass values
rollingX = (acceleration.x * kFilteringFactor) + (rollingX * (1.0 - kFilteringFactor));
rollingY = (acceleration.y * kFilteringFactor) + (rollingY * (1.0 - kFilteringFactor));
rollingZ = (acceleration.z * kFilteringFactor) + (rollingZ * (1.0 - kFilteringFactor));
// Subtract the low-pass value from the current value to get a simplified high-pass filter
float accelX = acceleration.x - rollingX;
float accelY = acceleration.y - rollingY;
float accelZ = acceleration.z - rollingZ;
// Use the acceleration data.
}
Just in case someone wants to know, the highpass filter can be found in the Accelerometer Graph sample.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With