At simplest, a hard thresholding would be something like:
if (abs(signal) < threshold) {
signal = 0
}
Features to be considered, if they cannot be implemented with the help of other units:
Hysteresis
Attack / Release i.e. transitions from gate on to gate off
Hold: how long to keep the gate open after signal drops below threshold
Ability to side-chain it: e.g. the input to noise gate is a signal before reverb; gate has hold, and then the gate is applied after the reverb. This prevents a very long tail from the reverb.
It would be nice to have a thresholding / noise gate unit. https://en.wikipedia.org/wiki/Noise_gate
At simplest, a hard thresholding would be something like:
Features to be considered, if they cannot be implemented with the help of other units: