Line data Source code
1 : #pragma once
2 :
3 : // Noise gate that attenuates low-level input between notes.
4 : // An envelope follower tracks amplitude e[n]; when e[n] falls below threshold
5 : // T, gain approaches 0 with release smoothing, and when e[n]>=T it approaches
6 : // 1 with attack smoothing, preventing abrupt chopping.
7 :
8 : #include "audio/effects/effect.h"
9 : #include "audio/dsp/envelope_follower.h"
10 :
11 : namespace Amplitron {
12 :
13 5 : class NoiseGate : public Effect {
14 : public:
15 : NoiseGate();
16 : void process(float* buffer, int num_samples) override;
17 : void reset() override;
18 143 : const char* name() const override { return "Noise Gate"; }
19 3 : const char* type_id() const override { return "Noise Gate"; }
20 183 : std::vector<EffectParam>& params() override { return params_; }
21 :
22 : private:
23 : std::vector<EffectParam> params_;
24 : EnvelopeFollower env_;
25 : float gain_ = 0.0f;
26 : };
27 :
28 : } // namespace Amplitron
|