Skip to content

Commit

Permalink
Add HP for S channel to Conditioner (#5195)
Browse files Browse the repository at this point in the history
- A deactivatable Highpass Filter for the Side Channel in Conditioner
  (named "Side Low Cut" for consistency)
  to roll off low frequencies in the stereo width.
- set threshold to-6dB in init preset to avoid level jump

This was a test in preparation for the ms tool.
I thought I'd ask before I throw it away...
It is patch compatible with 1.9
(but not compatible with old user-fx-presets)

Adresses #3596
  • Loading branch information
mynameismuhl authored Oct 2, 2021
1 parent 2c961ab commit ea4576f
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 19 deletions.
2 changes: 1 addition & 1 deletion resources/data/fx_presets/Conditioner/Limiter 1.srgfx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<single-fx streaming_version="15">
<snapshot type="8" name="Limiter 1" p0="0.000000" p1="0.000000" p2="1.000000" p3="0.000000" p4="-17.742889" p5="-0.085714" p6="0.000000" p7="-9.257149" />
<snapshot type="8" name="Limiter 1" p0="0.000000" p1="0.000000" p2="1.000000" p3="0.000000" p4="-17.742889" p5="-0.085714" p6="0.000000" p7="-9.257149" p8="-60" p8_deactivated="1" />
</single-fx>
2 changes: 1 addition & 1 deletion resources/data/fx_presets/Conditioner/Limiter 2.srgfx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<single-fx streaming_version="15">
<snapshot type="8" name="Limiter 2" p0="0" p1="0" p2="0" p3="0" p4="-6" p5="0" p6="0.01" p7="0" />
<snapshot type="8" name="Limiter 2" p0="0" p1="0" p2="0" p3="0" p4="-6" p5="0" p6="0.01" p7="0" p8="-60" p8_deactivated="1" />
</single-fx>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<single-fx streaming_version="15">
<snapshot type="8" name="Peak Suppressor" p0="0.000000" p1="0.000000" p2="1.000000" p3="0.000000" p4="-12.728600" p5="0.316072" p6="0.760714" p7="-7.328576" />
<snapshot type="8" name="Peak Suppressor" p0="0.000000" p1="0.000000" p2="1.000000" p3="0.000000" p4="-12.728600" p5="0.316072" p6="0.760714" p7="-7.328576" p8="-60" p8_deactivated="1" />
</single-fx>
2 changes: 1 addition & 1 deletion resources/data/fx_presets/Conditioner/Sit Tight.srgfx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<single-fx streaming_version="15">
<snapshot type="8" name="Sit Tight" p0="-7.24292" p1="-0.300003" p2="1" p3="0" p4="-20.1857" p5="0.285714" p6="0.214284" p7="-4.02853" />
<snapshot type="8" name="Sit Tight" p0="-7.24292" p1="-0.300003" p2="1" p3="0" p4="-20.1857" p5="0.285714" p6="0.214284" p7="-4.02853" p8="-60" p8_deactivated="1" />
</single-fx>
4 changes: 2 additions & 2 deletions resources/surge-shared/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@
<snapshot name="Init" p0="46" p1="1.000000" p2="0.000000" p3="1.000000"/>
</type>
<type i="8" name="Conditioner">
<snapshot name="Init" p0="0.000000" p1="0.000000" p2="1.000000" p3="0.000000" p4="-17.014269" p5="0.000000"
p6="0.000000" p7="0.000000"/>
<snapshot name="Init" p0="0.000000" p1="0.000000" p2="1.000000" p3="0.000000" p4="-6" p5="0.000000"
p6="0.000000" p7="0.000000" p8="-60" p8_deactivated="1"/>
</type>
<type i="26" name="Mid-Side Tool">
<snapshot name="Init" p0="0" p1="-60" p1_deactivated="1" p2="0" p2_deactivated="1" p3="-6.63049" p4="70"
Expand Down
57 changes: 46 additions & 11 deletions src/common/dsp/effects/ConditionerEffect.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
** Surge Synthesizer is Free and Open Source Software
**
** Surge is made available under the Gnu General Public License, v3.0
** https://www.gnu.org/licenses/gpl-3.0.en.html
**
** Copyright 2004-2021 by various individuals as described by the Git transaction log
**
** All source at: https://github.com/surge-synthesizer/surge.git
**
** Surge was a commercial product from 2004-2018, with Copyright and ownership
** in that period held by Claes Johanson at Vember Audio. Claes made Surge
** open source in September 2018.
*/

#include "ConditionerEffect.h"
#include <vembertech/basic_dsp.h>
#include "SurgeParamConfig.h"
Expand All @@ -7,7 +22,7 @@ using namespace std;
using namespace vt_dsp;

ConditionerEffect::ConditionerEffect(SurgeStorage *storage, FxStorage *fxdata, pdata *pd)
: Effect(storage, fxdata, pd), band1(storage), band2(storage)
: Effect(storage, fxdata, pd), band1(storage), band2(storage), hp(storage)
{
bufpos = 0;

Expand Down Expand Up @@ -43,6 +58,7 @@ void ConditionerEffect::setvars(bool init)
{
band1.coeff_peakEQ(band1.calc_omega(-2.5), 2, *f[cond_bass]);
band2.coeff_peakEQ(band2.calc_omega(4.75), 2, *f[cond_treble]);
hp.coeff_HP(hp.calc_omega(*f[cond_hpwidth] / 12.0), 0.4);

if (init)
{
Expand Down Expand Up @@ -110,6 +126,12 @@ void ConditionerEffect::process(float *dataL, float *dataR)

float M alignas(16)[BLOCK_SIZE], S alignas(16)[BLOCK_SIZE];
encodeMS(dataL, dataR, M, S, BLOCK_SIZE_QUAD);

if (!fxdata->p[cond_hpwidth].deactivated)
{
hp.process_block(S);
}

width.multiply_block(S, BLOCK_SIZE_QUAD);
decodeMS(M, S, dataL, dataR, BLOCK_SIZE_QUAD);
ampL.multiply_block(dataL, BLOCK_SIZE_QUAD);
Expand Down Expand Up @@ -182,14 +204,15 @@ int ConditionerEffect::vu_ypos(int id)
switch (id)
{
case 0:
return 15;
case 1:
return 17;
case 2:
case 1:
return 19;
case 2:
return 21;
}
return 0;
}

const char *ConditionerEffect::group_label(int id)
{
switch (id)
Expand All @@ -205,6 +228,7 @@ const char *ConditionerEffect::group_label(int id)
}
return 0;
}

int ConditionerEffect::group_label_ypos(int id)
{
switch (id)
Expand All @@ -214,9 +238,9 @@ int ConditionerEffect::group_label_ypos(int id)
case 1:
return 7;
case 2:
return 13;
return 15;
case 3:
return 27;
return 29;
}
return 0;
}
Expand All @@ -234,6 +258,8 @@ void ConditionerEffect::init_ctrltypes()

fxdata->p[cond_width].set_name("Width");
fxdata->p[cond_width].set_type(ct_percent_bipolar);
fxdata->p[cond_hpwidth].set_name("Side Low Cut");
fxdata->p[cond_hpwidth].set_type(ct_freq_audible_deactivatable_hp);
fxdata->p[cond_balance].set_name("Balance");
fxdata->p[cond_balance].set_type(ct_percent_bipolar);

Expand All @@ -250,18 +276,21 @@ void ConditionerEffect::init_ctrltypes()
fxdata->p[cond_treble].posy_offset = 1;

fxdata->p[cond_width].posy_offset = 3;
fxdata->p[cond_balance].posy_offset = 3;
fxdata->p[cond_hpwidth].posy_offset = -7;
fxdata->p[cond_balance].posy_offset = 5;

fxdata->p[cond_threshold].posy_offset = 11;
fxdata->p[cond_attack].posy_offset = 11;
fxdata->p[cond_release].posy_offset = 11;
fxdata->p[cond_gain].posy_offset = 13;
fxdata->p[cond_threshold].posy_offset = 13;
fxdata->p[cond_attack].posy_offset = 13;
fxdata->p[cond_release].posy_offset = 13;
fxdata->p[cond_gain].posy_offset = 15;
}

void ConditionerEffect::init_default_values()
{
fxdata->p[cond_bass].deactivated = false;
fxdata->p[cond_treble].deactivated = false;
fxdata->p[cond_hpwidth].val.f = -60;
fxdata->p[cond_hpwidth].deactivated = true;
}

void ConditionerEffect::handleStreamingMismatches(int streamingRevision,
Expand All @@ -272,4 +301,10 @@ void ConditionerEffect::handleStreamingMismatches(int streamingRevision,
fxdata->p[cond_bass].deactivated = false;
fxdata->p[cond_treble].deactivated = false;
}

if (streamingRevision <= 16)
{
fxdata->p[cond_hpwidth].val.f = -60;
fxdata->p[cond_hpwidth].deactivated = true;
}
}
5 changes: 3 additions & 2 deletions src/common/dsp/effects/ConditionerEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
** Surge is made available under the Gnu General Public License, v3.0
** https://www.gnu.org/licenses/gpl-3.0.en.html
**
** Copyright 2004-2020 by various individuals as described by the Git transaction log
** Copyright 2004-2021 by various individuals as described by the Git transaction log
**
** All source at: https://github.com/surge-synthesizer/surge.git
**
Expand Down Expand Up @@ -58,10 +58,11 @@ class ConditionerEffect : public Effect
cond_attack,
cond_release,
cond_gain,
cond_hpwidth,
};

private:
BiquadFilter band1, band2;
BiquadFilter band1, band2, hp;
float ef;
lipol<float, true> a_rate, r_rate;
float lamax[lookahead << 1];
Expand Down

0 comments on commit ea4576f

Please sign in to comment.