Highpass filter with variable cutoff frequency

Algorithm development and general DSP issues

Moderator: frank

Post Reply
jakesteffes
Posts: 5
Joined: Thu May 09, 2013 8:21 am
Location: United States

Highpass filter with variable cutoff frequency

Post by jakesteffes »

Hey folks,

I'm trying to implement a high pass filter, where the cutoff frequency is controlled via a scaled pot input. This is what I'm trying, but it's giving me a low pass filter instead. ( ? )

Code: Select all

equ hp0 reg5    ;register for high-pass filter
equ khp reg14  ;register for cutoff frequency

;load and scale pot2, write to register
ldax	pot2
sof	-0.07884094,	0.082668548	;450Hz to 20Hz @ 32kHz
wrax	khp,	0.0

rdax	hp0,	-1.0         ; these three lines recreate
mulx	khp                 ; RDFX, but with a register coefficient
rdax	hp0,	1.0          ; instead of a fixed coefficient
wrhx	hp0,	-0.5    


Any help would be greatly appreciated. As I said earlier, when the pot as at 0, I get a *low pass* cutoff around 450 Hz, and when the pot is maxed, I get a *low pass* cutoff around 20 Hz (or something much lower than 450).

Thank you!
-Jake[/code]
slacker
Posts: 116
Joined: Tue Feb 01, 2011 1:13 pm

Post by slacker »

I think the answer is in the notes for the WRHX instruction http://www.spinsemi.com/knowledge_base/ ... .html#WRHX.

"The input signal will be in ACC, and during the execution of the first statement, that input signal will be transferred to PACC. During the second instruction, the written value is multiplied by a coefficient (which would be negative for a shelf), and added to PACC (the original input signal)."

Your version of RDFX will leave the result of the mulx instruction in PACC not the original input signal. I think you'll need to write your own version of WRHX as well.
jakesteffes
Posts: 5
Joined: Thu May 09, 2013 8:21 am
Location: United States

Post by jakesteffes »

Thanks slacker,

I think you're write - I ended up coding a single pole HP filter from the ground up, and it seems to be doing the trick. Thanks for the help!
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

There is a 2-pole variable frequency high pass in each of the algorithms I just posted under "interesting guitar patch". In one case it's controlled by a knob and in the other one a knob and envelope signal are mixed together to control the filter frequency.

The code should be commented in such a way that you can find it.
Post Reply