Simple low pass filter?
Moderator: frank
Simple low pass filter?
equ temp reg0 ;setup registry
ldax adcl ; read input
rdfx temp, 0.01 ;?
wrlx temp, 1 ;?
wrax dacl ; write output
ldax adcl ; read input
rdfx temp, 0.01 ;?
wrlx temp, 1 ;?
wrax dacl ; write output
What you have there is a single pole low pass, see http://www.spinsemi.com/knowledge_base/ ... le_filters for a description of the structure and equations to calculate the coefficient.
Frank Thomson
Experimental Noize
Experimental Noize
-
- Posts: 131
- Joined: Sun Nov 15, 2009 3:37 pm
- Location: New Orleans, LA US
It depends what you're trying to do with it. For example, if using a lowpass to detect an input envelope, you would want the coefficients set one way so that the cutoff was below audio frequencies. Here's what I have used as a one-pole lowpass, using a pot to vary frequency:
rdax adcr, 1
rdax lp_filt,-1.0
mulx pot2
rdax lp_filt,1.0
wrax lp_filt,1.0
rdax adcr, 1
rdax lp_filt,-1.0
mulx pot2
rdax lp_filt,1.0
wrax lp_filt,1.0
-
- Posts: 131
- Joined: Sun Nov 15, 2009 3:37 pm
- Location: New Orleans, LA US
If you don't understand how to calculate the coefficient after reading the article I linked to then you probably need to get a basic DSP book. Programming a DSP is not like programming a micro, you need to understand Z domain basics, basic FIR and IIR structures, etc.
Frank Thomson
Experimental Noize
Experimental Noize
I have read a DSP book. I am slowly getting the hang of it. I am very rusty at programming though, I had BASIC, but that was 30 years ago. I can calculate the coefficients, just didn't know where they go. Do the input and output have anti-aliasing filters? I am able to write the code for low pass filters now, thanks for the help.
Inputs do have filtering, always helps to add a little externally. No anti-aliasing filters on outputs, not necessary.
Frank Thomson
Experimental Noize
Experimental Noize
-
- Posts: 18
- Joined: Tue Jul 22, 2008 3:54 pm
- Location: Ottawa, Canada
- Contact:
Back to the OP's question, I just had to implement a 'simple' low-pass filter for the Dattorro Plate Reverb.
I didn't realize you couldn't do that with the 2-statement Low-pass... or can you?
To get a more pleasing result in the Dattorro Plate I had to implement the low pass discretely (just one extra instruction)...
I didn't realize you couldn't do that with the 2-statement Low-pass... or can you?
To get a more pleasing result in the Dattorro Plate I had to implement the low pass discretely (just one extra instruction)...
Code: Select all
; k1 for freqs:
equ k1_1kHz 0.82552
equ k1_2kHz 0.68148
equ k1_4kHz 0.46441
equ bandwidth 1-k1_2kHz ; coefficient for input low-pass
; input low-pass
rda predelay#,bandwidth
rdax lp_inp,1-bandwidth
wrax lp_inp,1
-mark
My blog: http://tubenexus.com
My blog: http://tubenexus.com