Scaling envelope input to pot input range?

Algorithm development and general DSP issues

Moderator: frank

Post Reply
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Scaling envelope input to pot input range?

Post by Digital Larry »

This question shows how little I actually know about the different number representations on the FV-1, but I'll overcome my shyness and ask anyway.

I have a resonant LPF (the 4-pole lowpass which came out of the "disco reverb") patch and it works pretty well connected to a POT with a scale/offset in the middle to restrict the frequency sweep to the range of taste.

Now I made an envelope follower, which is simple ABSA followed by some low pass filter (or fixed decay, don't recall) and replacing the POT output with the envelope output doesn't get the filter to budge hardly at all.

I'm pretty sure this is a number representation/scaling issue but I'm not so sure what to do about it. Suggestions?

Here's the filter adjusted via pot:

Code: Select all

;  Program: Render Block exported from SpinCAD Designer
; clear filter
SKP $80000000,5
CLR
WRAX 36,0.0
WRAX 35,0.0
WRAX 38,0.0
WRAX 37,0.0
;----- read pot 1 
RDAX 16,1.0
SOF 0.35,-0.35
EXP 1.0,0.0
WRAX 32,0.0
RDAX 16,1.0
SOF 1.0,-0.999
EXP 1.0,0.0
WRAX 34,0.0
; 4 pole filter
RDAX 36,1.0
MULX 32
RDAX 35,1.0
WRAX 35,-1.0
RDAX 36,-0.4
RDAX 20,0.25
MULX 32
RDAX 36,1.0
WRAX 36,0.0
RDAX 38,1.0
MULX 32
RDAX 37,1.0
Here's the filter adjusted by envelope follower:

Code: Select all

;  Program: Render Block exported from SpinCAD Designer
; read input
RDAX 20,1.0
; do envelope
ABSA
RDFX 33,0.01
WRAX 33,0.0
RDAX 34,1.0
SOF -0.01,0.0
RDAX 34,1.0
WRAX 32,0.0
RDAX 33,1.0
MAXX 32,1.0
WRAX 34,0.0
; clear filter
SKP $80000000,5
CLR
WRAX 39,0.0
WRAX 38,0.0
WRAX 41,0.0
WRAX 40,0.0
; get envelope value and adjust
RDAX 34,1.0
SOF 0.35,-0.35
EXP 1.0,0.0
WRAX 35,0.0
RDAX 34,1.0
SOF 1.0,-0.999
EXP 1.0,0.0
WRAX 37,0.0
; 4 pole filter
RDAX 39,1.0
MULX 35
RDAX 38,1.0
WRAX 38,-1.0
RDAX 39,-0.4
RDAX 20,0.25
MULX 35
RDAX 39,1.0
WRAX 39,0.0
RDAX 41,1.0
MULX 35
RDAX 40,1.0
WRAX 40,-1.0
RDAX 41,-0.4
RDAX 38,1.0
MULX 35
RDAX 41,1.0
WRAX 41,0.0
RDAX 41,1.0
WRAX 22,0.0
Thanks,

DL
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

You should handle the result of the envelope follower exactly the same as the POT, the code in the POT controlled version that manipulates the value of the POT is different than what you are doing to the envelope follower. Make them the same.
Frank Thomson
Experimental Noize
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

Hmmm... here's what I'm doing with the pot:

Code: Select all

;----- read pot 1 
RDAX 16,1.0 
SOF 0.35,-0.35 
EXP 1.0,0.0 
WRAX 32,0.0 
RDAX 16,1.0 
SOF 1.0,-0.999 
EXP 1.0,0.0 
WRAX 34,0.0 ; control value is in register 34
And here's what I'm doing with the envelope:

Code: Select all

; do envelope 
ABSA ; absolute value
RDFX 33,0.01 ; slow filter
WRAX 33,0.0 
RDAX 34,1.0 
SOF -0.01,0.0 
RDAX 34,1.0 
WRAX 32,0.0 
RDAX 33,1.0 
MAXX 32,1.0 
WRAX 34,0.0 ; write filtered envelope value to register 34
; clear filter 
; ... removed this part
; get envelope value from register 34 and adjust as before
RDAX 34,1.0 
SOF 0.35,-0.35 
EXP 1.0,0.0 
WRAX 35,0.0 
RDAX 34,1.0 
SOF 1.0,-0.999 
EXP 1.0,0.0 
WRAX 37,0.0 ; control value is in register 37
What part should I change?
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

I did find this auto-wah sample from the Guitar Amp application.

Code: Select all

;begin by getting control level into detector:

rdax	mono,1		;get input
absa			;absolute value
rdfx	avg,0.01		;average input level
wrax	avg,0		;write avg level, pass on
rdax	lavg,0.001
sof	-0.01,0	
rdax	lavg,1	
wrax	temp,0
rdax	avg,1
maxx	temp,1		;filter a long average
wrax	lavg,0

;now set up a means by which the sensitivity control can affect the filter frequency:

rdax	lavg,1
sof 	1,0.002		;never let lavg go to zero
log	1,0
wrax	temp,0
rdax	avg,1
log	1,0
rdax	temp,-1
mulx 	pot1
exp	1,0
rdfx	ffil,0.0005
wrax	ffil,1		
sof	0.7,0.02		;limit frequency range
wrax	wf,0
Looks somewhat similar although I am not sure where the MAXX came from. I'll review this more carefully to see what adjusts what.
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

Try:

Code: Select all

; do envelope
ABSA ; absolute value
RDFX 33,0.01 ; slow filter
WRAX 33,1.0
WRAX 34, 1.0 ; save to 34 as well for remainder of code to use
; clear filter
; ... removed this part
; get envelope value from register 34 and adjust as before
RDAX 34,1.0
SOF 0.35,-0.35
EXP 1.0,0.0
WRAX 35,0.0
RDAX 34,1.0
SOF 1.0,-0.999
EXP 1.0,0.0
WRAX 37,0.0 ; control value is in register 37 
Frank Thomson
Experimental Noize
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

Hi Frank,

Thanks for the tip. I'm getting somewhat greater clarity on the matter now.

So if you simply do an ABSA followed by a low pass, this is going to be "supposedly" a peak following envelope follower. But the attack rate is going to be the same as the decay rate, right?

I imagine that the use of the "MAXX" instruction might give us instantaneous attack (if rectified input > filter value, then use rectified input).

Also there is an RMS detector, which seems like it's probably more useful when doing dynamics processing, because we want to correlate input level changes in dB to output level changes also in dB.

But in the event that the signal envelope is used for something other than adjusting the level itself (like filter center freq, LFO, or delay line modulations), then the peak detector is just as good as anything else in that its output may need to be scaled and curved to suit the desired "musical" result.

I also think that it might be possible to run the peak detector output to a different filter chain depending on whether the signal was going up or decaying, so one could accomplish independent attack and decay characteristics. So much to consider!

Thanks,

DL

Update: I improved the envelope sensitivity by adding a couple of

SOF -2.0,0

after the ABSA.

I also improved the audio by using 0.001 instead of 0.01 for the filter parameter. With 0.01 I think the envelope passes low audio frequencies which gives a distorted sound out of the filter. Of course that might be useful in some circumstances!

Here's my resulting patch. One channel has a 4-pole low pass and sweeps down with increased input. The other channel has a 2-pole high pass which sweeps up with increased input.

There are no pot controls at this time.

Code: Select all

RDAX 20,1.0
ABSA
SOF -2.0,0.0
SOF -2.0,0.0
RDFX 33,0.001
WRAX 33,0.0
RDAX 33,1.0
SOF 0.3899999999999999,0.56
WRAX 35,0.0
SKP RUN ,3
CLR
WRAX 38,0.0
WRAX 39,0.0
RDAX 35,1.0
SOF 0.5,-0.5
EXP 1.0,0.0
WRAX 36,0.0
RDAX 35,1.0
SOF 1.0,-0.999
EXP 1.0,0.0
WRAX 37,0.0
RDAX 38,1.0
MULX 36
RDAX 39,1.0
WRAX 39,-1.0
RDAX 38,-0.2
RDAX 21,1.0
WRAX 40,1.0
MULX 36
RDAX 38,1.0
WRAX 38,0.0
RDAX 33,1.0
SOF -0.5800000000000001,0.91
WRAX 41,0.0
SKP RUN ,5
CLR
WRAX 45,0.0
WRAX 44,0.0
WRAX 47,0.0
WRAX 46,0.0
RDAX 41,1.0
SOF 0.35,-0.35
EXP 1.0,0.0
WRAX 42,0.0
RDAX 41,1.0
SOF 1.0,-0.999
EXP 1.0,0.0
WRAX 43,0.0
RDAX 45,1.0
MULX 42
RDAX 44,1.0
WRAX 44,-1.0
RDAX 45,-0.4
RDAX 21,0.25
MULX 42
RDAX 45,1.0
WRAX 45,0.0
RDAX 47,1.0
MULX 42
RDAX 46,1.0
WRAX 46,-1.0
RDAX 47,-0.4
RDAX 44,1.0
MULX 42
RDAX 47,1.0
WRAX 47,0.0
RDAX 40,1.0
WRAX 22,0.0
RDAX 47,1.0
WRAX 23,0.0
Post Reply