slow gear

Algorithm development and general DSP issues

Moderator: frank

Post Reply
Mel
Posts: 4
Joined: Sat Mar 06, 2010 12:32 pm

slow gear

Post by Mel »

Hey, Just got into programming the FV-1 and I'm looking for advice
on how to implement a swell/slow gear effect

the general idea is to trigger a ramp envelope when a certain
input threshold is reached?

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

Post by livingston »

If you search the forum for envelope detection (or check out the Knowledge Base on the main site) you'll see some code examples to find the input envelope. Once you have that you can use something like SOF 1.9,-1 to make the envelope go from -1 to 1, then use SKP NEG to find when the input goes above zero. Within the skipped area, you can initialize the ramp and then MULX your input signal with the ramp.

Or, one thing I thought about but haven't tried is to just take the input envelope, SOF -1,.999 so that you have backwards envelope and just MULX your input signal with the backwards envelope. This way, when you play hard, the output envelope is brought to zero, and as your guitar note fades it rises in volume.
B.C.
Posts: 38
Joined: Sat Mar 06, 2010 5:28 pm

Post by B.C. »

I can get a pretty good slow gear impression by using a regular reverb with increasing tap coeff. :)
Mel
Posts: 4
Joined: Sat Mar 06, 2010 12:32 pm

not easy being a newbie

Post by Mel »

So, I tried something like this but I'm pretty stuck at this point since
It really does nothing:
______________________________

fil equ reg0
inverse equ reg1


rdax adcl,1.0
ABSA
RDFX fil,1
WRLX fil,1
SOF -1,0.999
wrax inverse ,0


rdax adcl,1.0 ; Read ADC left
mulx inverse
wrax dacl,0 ; write to DAC left
livingston
Posts: 131
Joined: Sun Nov 15, 2009 3:37 pm
Location: New Orleans, LA US

Re: not easy being a newbie

Post by livingston »

Mel wrote:So, I tried something like this but I'm pretty stuck at this point since
It really does nothing:
______________________________

fil equ reg0
inverse equ reg1


rdax adcl,1.0
ABSA
RDFX fil,1
WRLX fil,1

SOF -1,0.999
wrax inverse ,0


rdax adcl,1.0 ; Read ADC left
mulx inverse
wrax dacl,0 ; write to DAC left
The lines in red are a problem. The coefficients are wrong. The RDFX is way too big and the WRLX needs a negative number in my experience. I have used this as an envelope detector with success:

rdax adcr,1
absa
RDFX envfil,0.001 ;use LPF opcode for filtering
WRLX envfil,-1 ;infinite shelf LPF (could have used WRAX avgfil,1)
wrax env,0

Try those numbers in your program and see what happens. If it doesn't work, describe what exactly happens, like whether you just get your regular instrument sound out of the output or if no sound appears at the output.
donstavely
Posts: 53
Joined: Thu Jan 07, 2010 2:29 pm
Location: Windsor, Colorado

Post by donstavely »

Here is a different approach you could consider. I have been working on a note detector triggering a ramp generator for another project. Just using a pot to adjust the ramp rate, and then multiplying the input signal by this ramp gives you a slow note attack.

This code may be useful for many kinds of projects. I offer it to the forum hoping that others will use it, improve on it, and post post it back.

Code: Select all

; 
equ	in	reg0
equ	lopass	reg1
equ	envlop	reg2
equ	peak	reg3
equ	trig	reg4
equ  	timer	reg5
equ 	ramp	reg6
;
delayd 	mem 256 	; Short delay to match the note detect delay
;
; Read A/D's, save input, and put in delay memory
;
rdax	adcl, 0.5		; read and scale left A/D
rdax	adcr, 0.5		; read and scale right A/D
wrax	in, 1		; save input for later, leave in ACC
wra 	delayd, 1 	; put in delay memory, leave in ACC
;
; Note trigger and timer ramp
;
maxx 	envlop, 0.9999	; full-wave rectify w/ long decay
wrax 	envlop, 1		; envelope filter, leave in ACC
;
rdfx	peak, 0.002	; high-pass filter to get peaks 
wrhx	peak, -1		; no shelf
;
skp	gez, 1		; only positive peaks for note-on
    	clr		; neg transients set to zero
;
rdfx	lopass, 0.002	; smooth out ripple
wrlx	lopass, -1	; no shelf
;	
log	1.999, 0.5	; convert to dB for wide range
wrax	trig, 0		; save it 
;
; Reset timer on leading edge of trigger
;
sof	0, -0.99		; close to -1
rdax	timer, 1		; add timer
skp 	neg, NoTrig	; is timer expired?
	sof	0, 0.4		; yes, get trigger threshold
    	rdax	trig, 1		; compare to trigger
    	skp	neg, NoTrig	; is trigger above it?
        		clr		; yes
        		wrax    	timer, 0	; clear timer once
		wrax	ramp, 0	; clear ramp a well
NoTrig:
sof	0, 0.001		; small increment
sof	0.157, 0		; makes ramp take 200mS
rdax	timer, 1		; add it to timer
wrax	timer, 0		; save it, clear ACC
;
; Generate attack ramp
;
rdax	pot1, -.001	; pot1 is attack speed
sof	.99, .001	; turning up means smaller 
rdax	ramp, 1		; integrate from 0 to 1
wrax	ramp, 0
;
; Use timer to modulate delayed signal
;
rda	delayd+100, 1	; get delayed input to miss transient	
mulx	ramp		; multiply by ramp
mulx 	ramp		; twice to get nonlinear volume
;
; Write D/A's with final mixed output
;
wrax 	dacr, 0		; write output to right side
;
rdax	ramp, 0.9	; write ramp to left side for debug
wrax 	dacl, 0
Don Stavely
Mel
Posts: 4
Joined: Sat Mar 06, 2010 12:32 pm

Post by Mel »

thnx guys(!!!),

livingston, tried using your coefficients but as far as can Tell what
i get is the regular instrument sound

donstavely, im afraid your code is beyond my level of understanding right now so sadly i plan to keep on struggling with something simpler :cry:
livingston
Posts: 131
Joined: Sun Nov 15, 2009 3:37 pm
Location: New Orleans, LA US

Post by livingston »

Hmm, if I get a chance I'll try the code above and see what I can make of it. As I said, I hadn't ever tried that concept, but I think it should work if we can get the code together.

One thing you might try is amplifying your instrument, either in analog before the FV-1, or by putting several "SOF -2,0" statements in a row (always use an even number of these). The problem could be that your instrument isn't loud enough to create a big enough envelope. Also try playing with the WRLX coef.
patb
Posts: 7
Joined: Tue Apr 13, 2010 5:28 am
Location: plymouth uk

Post by patb »

Great slow gear program, nice one
never could get mine to work properly !
Try this though:-

; Note trigger and timer ramp
maxx envlop,0.9995
wrax envlop,1 ; envelope filter, leave in ACC
rdfx peak,0.002 ; high-pass filter to differentiate
wrhx peak, -1 ; no shelf
rdfx peak,0.002
wrhx peak, -1
rdfx peak,0.002
wrhx peak, -1
rdfx peak,0.002
wrhx peak, -1
;
skp gez,1
clr
log 1.999,0.5
wrax trig,0
Alex MAK
Posts: 89
Joined: Fri Nov 05, 2010 1:00 pm

Post by Alex MAK »

Hello! I need help and advice in creating a slow attack. Got any ideas?
Alex MAK
Posts: 89
Joined: Fri Nov 05, 2010 1:00 pm

Post by Alex MAK »

Guys, this code works. But it needs some work. I hope for your help! Tell me how you can change the speed of response? How to turn potentiometer. How better to do sensitivity? Thank you! Best regards, Alex!

Code: Select all

 
;equ	mono	reg0
equ	peak	reg1
equ	lev	reg2
equ	strike	reg3

rdax	adcl,1
absa
wrax	peak,0.8
rdax	lev,-1
skp	neg,nostrike
clr
wrax	strike,0
nostrike:
clr
rdax	peak,1
maxx	lev,0.999
wrax	lev,0

or	%00000000_00000001_00000000
rdax	strike,1		;ramp strike if not a peak 

signal
wrax	strike,0 


rdax adcl,1.0 ; Read ADC left 
mulx	strike
wrax dacl,0 ; write to DAC left
 
patb
Posts: 7
Joined: Tue Apr 13, 2010 5:28 am
Location: plymouth uk

more slow gear

Post by patb »

Had another go at this one, all thanks to Don Stavely for the original coding.

;slow attack
;Pot0 = attack rate
equ in reg1
equ envlop reg2
equ peak reg4
equ trig reg5
equ ramp reg6
equ attack reg8
equ slope reg10
mem delay 256 ; Short delay to match the note detect delay
;
;sum inputs to mono:
rdax adcr,1
wra delay,1
wrax in,1
;
; Note trigger and timer ramp
maxx envlop,0.9999 ; full-wave rectify w/ long decay
wrax envlop,1 ; envelope filter, leave in ACC
rdfx peak,0.0001 ; high-pass filter, differentiate attack transient
wrhx peak, -1 ; no shelf

skp gez,1 ; only positive peaks for note-on
clr ; neg transients set to zero
log 1.999,0.5 ; 0.5 convert to dB for wide range
wrax trig,0 ; save it
;
; Reset timer on leading edge of trigger
sof 0,0.4 ; get trigger threshold
rdax trig,1 ; compare to trigger
skp neg,NoTrig ; is trigger above it?
clr ; yes
wrax ramp,0 ; clear ramp as well
wrax envlop,0 ; clear envlop in case of new attack
;wrax peak,0

rdax attack,1
wrax slope,0 ;
NoTrig:
;
; attack time
rdax pot0,1
log -1,0
sof 1,0.01
sof 0.003,0
wrax attack,0
;
clr
rdax slope,1
rdax ramp,1 ; integrate from 0 to 1
skp gez,1 ; if ramp is <0, set to zero
clr
wrax ramp,0
;
; Use timer to modulate delayed signal
rda delay+20,1 ;
mulx ramp ; multiply by ramp
mulx ramp ; twice to get nonlinear volume

wrax dacr,1 ; write output to right side
wrax dacl,0
;
Post Reply