slow gear
Moderator: frank
-
- Posts: 131
- Joined: Sun Nov 15, 2009 3:37 pm
- Location: New Orleans, LA US
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.
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.
not easy being a newbie
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
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
-
- Posts: 131
- Joined: Sun Nov 15, 2009 3:37 pm
- Location: New Orleans, LA US
Re: not easy being a newbie
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: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
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.
-
- Posts: 53
- Joined: Thu Jan 07, 2010 2:29 pm
- Location: Windsor, Colorado
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.
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
-
- Posts: 131
- Joined: Sun Nov 15, 2009 3:37 pm
- Location: New Orleans, LA US
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.
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.
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
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
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
more slow gear
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
;
;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
;