Cheap Highpass Filter? (just add/subtract and bitshifts)
Moderator: Moderators
Cheap Highpass Filter? (just add/subtract and bitshifts)
I remember reading about a really cheap Highpass/DC cancellation filter that used only addition/subtraction and bit shifts. But I can't remember what the formula was, or where I heard about it from. I think emulators used this formula. Does anyone know it?
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Re: Cheap Highpass Filter? (just add/subtract and bitshifts)
All digital filter design is relative to the sample rate, so I'd need more details before I could construct something similar to whatever you're thinking of...
Re: Cheap Highpass Filter? (just add/subtract and bitshifts)
Audio, like 44 or 48KHz.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Re: Cheap Highpass Filter? (just add/subtract and bitshifts)
You could do a really lazy first-order IIR highpass with something like
out[n] = out[n-1]*(1024-1) + in[n]/1024 that's a lowpass, one second while I do more math
Oh, man, it's been waaaay too long since I last remembered this.
Simple IIR highpass:
out[n] = out[n-1]*(1024-1)/1024 + in[n] - in[n-1]
End up with a corner frequency of [sample rate ÷ 1024]
out[n] = out[n-1]*(1024-1) + in[n]/1024
Oh, man, it's been waaaay too long since I last remembered this.
Simple IIR highpass:
out[n] = out[n-1]*(1024-1)/1024 + in[n] - in[n-1]
End up with a corner frequency of [sample rate ÷ 1024]
Re: Cheap Highpass Filter? (just add/subtract and bitshifts)
Can the constant 1024 be doubled to cut the corner frequency in half?
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Re: Cheap Highpass Filter? (just add/subtract and bitshifts)
Do you see how the example's constant translates to a shift Dwedit?
out[n-1]*(1024-1)/1024
Is the same as:
out[n-1]-(out[n-1] >> 10)
Doubling the constant to 2048 would turn into:
out[n-1]*(2048-1)/2048
out[n-1]-(out[n-1] >> 11)
out[n-1]*(1024-1)/1024
Is the same as:
out[n-1]-(out[n-1] >> 10)
Doubling the constant to 2048 would turn into:
out[n-1]*(2048-1)/2048
out[n-1]-(out[n-1] >> 11)