I'm working on a simple one pole filter, where the frequency is variable from a pot or other code. This is what I have right now:
Code: Select all
equ lpcoef reg10 ; frequency coefficient
equ lpstate reg11 ; filter state
rdax lpstate, -1.0 ; subtract lpstate from current value in accum
mulx lpcoef ; multiply by lpcoef
rdax lpstate, 1.0 ; add lpstate back to (input-lpstate)*lpcoef
wrax lpstate, 1.0 ; write filter output back to lpstate,
; while keeping value in the accumulator
Also, the coefficient is computed (in C code) as
Code: Select all
1.f-exp(-2.f*PI*cutoff/samplingRate);
Thanks,
Sean Costello