Simple LP not assembling

Algorithm development and general DSP issues

Moderator: frank

Post Reply
livingston
Posts: 131
Joined: Sun Nov 15, 2009 3:37 pm
Location: New Orleans, LA US

Simple LP not assembling

Post by livingston »

I'm trying to put a simple 1-pole LP filter at the beginning of an effect. I have this code:

Code: Select all

equ	filtr	reg7	;lowpass filtered input
equ	ksh	1.0	;shelf for lowpass
equ	klp	reg10	;frequency for lowpass
equ	blerg	reg11	;register for filter
equ	potf2	reg12	;pot filter for filter

;setup pot1 to control filter

rdax 	pot1,	1.0			; Read in pot 1 x1
sof 	1,	0			; POT1 in ACC, 0 to 1
rdfx 	potf2,	0.02			; Smooth the result to avoid jumping
wrax 	potf2,	1.0
wrax 	klp,	0			; Write to low pass frequency register

;filter input:

rdax	adcr,	1			;read input
rdfx	blerg,	klp			;frequency
wrlx	blerg,	ksh			;shelf
wrax	filtr,	0			;write filtered input to filtr
Plus of course some other stuff not pointing to any of these registers. The assembler tells me that the line

Code: Select all

rdfx	blerg,	klp			;frequency
gives me the error "coefficient out of range".

If I just change "klp" to 1 or .5 or similar, it works. But I want to have pot control over filter frequency. What am I doing wrong here?
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Re: Simple LP not assembling

Post by frank »

livingston wrote:The assembler tells me that the line

Code: Select all

rdfx	blerg,	klp			;frequency
gives me the error "coefficient out of range".

If I just change "klp" to 1 or .5 or similar, it works. But I want to have pot control over filter frequency. What am I doing wrong here?
rdfx expects an actual coefficient as the second parameter, not a register address. If you want pot control over the LP you can't use rdfx, you'll need to code it differently.
Frank Thomson
Experimental Noize
livingston
Posts: 131
Joined: Sun Nov 15, 2009 3:37 pm
Location: New Orleans, LA US

Post by livingston »

So how can I code a 1-pole filter with pot control? I know about the 2- and 4-pole filters, but I need something less extreme in this case.
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

A simple example on left channel

Code: Select all

lp_filt	equ	reg0

skp	run,start
clr
wrax	lp_filt,0
start:

rdax	adcl,1.0  ; Read ADC left
rdax	lp_filt,-1.0 ; ADCL - lp_filt
mulx	pot0 ; * C (POT0 in this case)
rdax	lp_filt,1.0 ; +lp_filt
wrax	lp_filt,1.0; write result to lp_filt
wrax	dacl,0 ; write to DAC left
Frank Thomson
Experimental Noize
Alex MAK
Posts: 89
Joined: Fri Nov 05, 2010 1:00 pm

Post by Alex MAK »

Hi Frank! I have a question. I want to work HFILTR POT0 (0-0.5) and to LFILTR worked POT0 (0.5 - 1). Is there a code for this part of the program? Thank you!
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

Alex MAK wrote:Hi Frank! I have a question. I want to work HFILTR POT0 (0-0.5) and to LFILTR worked POT0 (0.5 - 1). Is there a code for this part of the program? Thank you!
Sorry, I do not understand your question, there is nothing in the above code called HFILTR or LFILTR. Please restate the question.
Frank Thomson
Experimental Noize
Alex MAK
Posts: 89
Joined: Fri Nov 05, 2010 1:00 pm

Post by Alex MAK »

rdax pot0,-1
wrax kd,0

rdax dout,fbk
rda iap0#,0.5
wrap iap0,-0.5
wrax temp,1
rdfx efilh,0.2
wrhx efilh,-1
mulx kd
rdfx efill,0.2
wrlx efill,-1
mulx kd
rdax temp,1
mulx pot2
rdax mono,1
wra edel,0

I want to divide into 2 parts POT0 (0-0.5 and 0.5-1) and control one part of the high-pass filter, the other part of the low-pass filter. I do not know how I can POT0 divided into 2 parts. Thank you! Sincerely, Alex
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

Please start new questions in a new thread, not an old thread that is not really related to the question.

To get POT0 to range 0 to 0.5:

rdax pot0, 0.5


To range 0.5 to 1

rdax pot0, 0.5
sof 1.0, 0.5
Frank Thomson
Experimental Noize
Alex MAK
Posts: 89
Joined: Fri Nov 05, 2010 1:00 pm

Post by Alex MAK »

Thank you Frank!
Post Reply