Help with WRLX instruction

daeg

Well-known member
FV-1 Instructions - WRLX

What I know:
  • The WRLX instruction is used after a RDFX to turn your LPF into a deeper filter
  • The coefficient needs to be negative
  • -1 is an infinite shelf which drops off vertically
  • I can produce the coefficients I need using the block in SpinCad Designer

What I don't know:
  • How to calculate the coefficient
  • Whether it saves to the register for you
    • When using RDFX you need to follow it with a WRAX to write to a register
    • Does WRLX take care of this for you?
  • What would happen if you used a positive coefficient?
 

daeg

Well-known member
Here is my code:

Code:
; Shelving LPF
; Calculate frequency coefficient k in python using:
;   round(1 - math.exp(-2 * math.pi * freq / rate),7)
;     where freq = desired corner frequency (-3db point)
;     and rate = current sample rate (usually 32768)
; Calculate attenuation coefficient k using:
; ???

equ k_1000hz 0.1744847965 ;coefficient for 1khz filter
equ k_06db -0.4988127664  ;first-order filter equivalent
equ k_12db -0.7488113568  ;second-order filter equivalent
equ k_18db -0.8741074588  ;third-order filter equivalent
equ k___db -1             ;infinite shelf

rdax adcl, 1
rdfx reg0, k_1000hz
wrlx reg0, k_06db
wrax dacl, 0
 

Digital Larry

New member
WRLX and WRHX are only needed if you want your filter to be "shelving".

RDFX followed by WRAX is just a 6 dB/octave low pass filter.

I'm pretty sure the corner frequency is the same regardless of using WRAX, WRHX or WRLX after RDFX.

I wrote an article about it behind my paywall but because I'm such a generous non self promoting type of person (cough) here's a quick way to get the corner frequency of a filter, say if the fs is 32768 Hz and coefficient is 0.01.

 

Digital Larry

New member
-1 is an infinite shelf which drops off vertically
A regular 1-pole filter rolls off at -6 dB/octave, which is rather gentle. Not exactly "vertical". The idea behind making it "shelving" is to set the point at which it stops going down, and rather flattens off again.
The WRLX instruction is used after a RDFX to turn your LPF into a deeper filter
If anything, it makes the filter "shallower" and more subtle than one which just rolls off "forever".


shelving filter.png
 
Top