Anyway, the noise gate/expander snippet on the spinsemi knowledge base page is nice, but this code here totally cuts your signal off more drastically. The downside is the decay isn't as smooth, and at times can get a little glitchy. However, in my opinion, if I'm playing with high gain pedals, there's enough sustain that I cut the note off before it would decay naturally.
It's pretty simple, there's a "noise_redux" variable that is at 0 when the signal is above the threshold. If the signal is below the threshold, a counter starts, and once the counter gets to the release time, the noise_redux variable starts ramping up to 1. As the gain_redux ramps up, the gain applied to the signal ramps down, and once the gain_redux reaches 1, your output is silent. I have a build where the dacr is tied to an LED, so I had the gain_redux variable control the LED so I could confirm that it was working as expected, but those lines are commented out below.
So far I thought there was good success both before and after hi gain pedals with my single coil telecaster in all 3 positions (neck only and bridge only being the buzziest of course). Again, it's not perfect, and some more effort could be done to smooth out the decay. But, for now I'm satisfied and can throw it on one of my muli-effect FV-1 pedals, so that I don't feel compelled to build the Zuul anytime soon.
Feel free to leave any feedback about the code or the results.
Code: Select all
;Phil's Noise Gate
;pot0 - threshold
;pot1 - release time
equ thresh reg0
equ release reg1
equ gain reg2
equ count reg3
equ gain_redux reg4
equ tick reg5
equ decay_flag reg6
equ gain_fade reg7
skp run, ENDRUN
clr
OR %00000000_00000001_00000000 ;sets value of counter as 1/(2^15), or 1/32768.
wrax tick, 0
ENDRUN:
ldax pot0
mulx pot0 ;log taper
sof 0.098, 0.002 ;threshold range is 0.002 to 0.1
wrax thresh, 0
ldax pot1
sof 0.488, 0.012 ;release time is 0.012 to 0.500 (ms)
wrax release, 1
log -1, -0.5
exp 0.0078125, 0 ;1/X trick from spinsemi plus some math so the fade out time correlates to the release knob
wrax gain_fade, 0
ldax adcl
absa
rdax thresh, -1
skp neg, UNDER ;skip if signal is under threshold
OVER:
wrax count, 0 ;if signal over threshold, clear count
wrax decay_flag, 0 ;clear decay_flag
wrax gain_redux, 0 ;clear gain redux
skp zro, FINAL
UNDER:
ldax decay_flag
skp gez, FADE
ldax count
rdax tick, 1 ;add 1/32768
wrax count, 1
rdax release, -1
skp neg, FINAL ;tick counter has not reached release time, so hold with gain_redux = 0
sof 0, 0.99
wrax decay_flag, 0
FADE:
ldax gain_redux
rdax gain_fade, 1
wrax gain_redux, 1
;sof 0.3, 0.2 ;convert range 0-1 to LED brightness range 0.2 - 0.5 of my build
;wrax dacr, 0 ;this is for my build which has an led tied to dacr with a transistor buffer, lit when gated
FINAL:
ldax gain_redux
sof -1, 0.99
sof 1, 0.01
wrax gain, 0 ;gain = 1 - gain redux
ldax adcl
mulx gain
wrax dacl, 0