Skip to content

Commit

Permalink
Smooth the envelope with another envelope follower to nasty avoid wav…
Browse files Browse the repository at this point in the history
…eform distortion.
  • Loading branch information
djowel committed Aug 24, 2024
1 parent 82a59ff commit 5c7483d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions q_lib/include/q/fx/signal_conditioner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ namespace cycfi::q
highpass _hp;
dynamic_smoother _sm;
fast_envelope_follower _env;
peak_envelope_follower _env_lp;
float _post_env;
compressor _comp;
float _makeup_gain;
Expand All @@ -87,6 +88,7 @@ namespace cycfi::q
, _hp{lowest_freq, sps}
, _sm{lowest_freq + ((highest_freq - lowest_freq) / 2), sps}
, _env{lowest_freq.period()*0.6, sps}
, _env_lp{lowest_freq.period(), sps}
, _comp{conf.comp_threshold, conf.comp_slope}
, _makeup_gain{conf.comp_gain}
, _gate{
Expand All @@ -110,7 +112,7 @@ namespace cycfi::q
s = _sm(s);

// Signal envelope
auto env = _env(std::abs(s));
auto env = _env_lp(_env(std::abs(s)));

// Noise gate
auto gate = _gate(env);
Expand All @@ -137,7 +139,7 @@ namespace cycfi::q

inline float signal_conditioner::pre_env() const
{
return _env();
return _env_lp();
}

inline float signal_conditioner::signal_env() const
Expand Down
1 change: 1 addition & 0 deletions test/signal_conditioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ int main()
process("Hammer-Pull High E", high_e);
process("Bend-Slide G", g);
process("GStaccato", g);
process("GLines2", g);

return 0;
}

0 comments on commit 5c7483d

Please sign in to comment.