Skip to content

Commit

Permalink
Add bonsai (#7030)
Browse files Browse the repository at this point in the history
Add the Bonsai effect authored by Morgan Holley with correct control layout and display and presets.
---------

Co-authored-by: Morgan Holly <[email protected]>
  • Loading branch information
baconpaul and morganholly authored May 24, 2023
1 parent ebe61d4 commit 11c9bbd
Show file tree
Hide file tree
Showing 18 changed files with 379 additions and 14 deletions.
2 changes: 1 addition & 1 deletion libs/sst/sst-effects
17 changes: 17 additions & 0 deletions resources/data/fx_presets/Bonsai/Burnt.srgfx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<single-fx streaming_version="22">
<snapshot name="Burnt"
type="28"
p0="2.81599"
p1="-3.61749"
p1_deform_type="0"
p2="3"
p3="1"
p4="3"
p5="0.820325"
p6="1"
p7="-9.16319"
p8="0.578637"
p9="-1.49117"
p10="1"
/>
</single-fx>
17 changes: 17 additions & 0 deletions resources/data/fx_presets/Bonsai/Deep Bass.srgfx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<single-fx streaming_version="22">
<snapshot name="Deep Bass"
type="28"
p0="0"
p1="4.99327"
p1_deform_type="0"
p2="1.18605"
p3="0"
p4="1"
p5="0.428345"
p6="0.650891"
p7="-15.3753"
p8="0.153296"
p9="0"
p10="1"
/>
</single-fx>
17 changes: 17 additions & 0 deletions resources/data/fx_presets/Bonsai/Excessive Bass.srgfx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<single-fx streaming_version="22">
<snapshot name="Excessive Bass"
type="28"
p0="0"
p1="12.345"
p1_deform_type="0"
p2="2.09601"
p3="0"
p4="2"
p5="0.426306"
p6="0.488318"
p7="-11.4364"
p8="0.111401"
p9="0"
p10="1"
/>
</single-fx>
17 changes: 17 additions & 0 deletions resources/data/fx_presets/Bonsai/Init.srgfx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<single-fx streaming_version="22">
<snapshot name="Init"
type="28"
p0="0"
p1="-6"
p1_deform_type="0"
p2="1"
p3="0"
p4="0"
p5="0.5"
p6="0.5"
p7="-6"
p8="0.25"
p9="0"
p10="1"
/>
</single-fx>
17 changes: 17 additions & 0 deletions resources/data/fx_presets/Bonsai/Soft.srgfx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<single-fx streaming_version="22">
<snapshot name="Soft"
type="28"
p0="0"
p1="-8.82829"
p1_deform_type="0"
p2="1.91063"
p3="1"
p4="0"
p5="0.465064"
p6="0.931946"
p7="-5.78382"
p8="0.367163"
p9="0"
p10="1"
/>
</single-fx>
17 changes: 17 additions & 0 deletions resources/data/fx_presets/Bonsai/Subtle.srgfx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<single-fx streaming_version="22">
<snapshot name="Subtle"
type="28"
p0="0"
p1="-7.95466"
p1_deform_type="0"
p2="0.851147"
p3="1"
p4="0"
p5="0.309436"
p6="0.931946"
p7="-12.8173"
p8="0.173377"
p9="0"
p10="1"
/>
</single-fx>
17 changes: 17 additions & 0 deletions resources/data/fx_presets/Bonsai/Subtler.srgfx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<single-fx streaming_version="22">
<snapshot name="Subtler"
type="28"
p0="0"
p1="-10.589"
p1_deform_type="1"
p2="0.50614"
p3="1"
p4="0"
p5="0.1979"
p6="1"
p7="-15.3582"
p8="0.0903321"
p9="0"
p10="1"
/>
</single-fx>
3 changes: 3 additions & 0 deletions resources/surge-shared/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
<snapshot name="Init" p0="-60" p0_deactivated="1" p1="70" p1_deactivated="1" p2="0" p3="0" p4="0" p5="-60" p6="70"
p7="0" p8="1"/>
</type>
<type i="28" name="Bonsai">
<snapshot name="Init" p0="0" p1="-6" p2="1" p3="0" p4="0" p5="0.5" p6="0.5" p7="-6" p8="0.25" p9="0" p10="1"/>
</type>
<sectionheader label="MANGLING"/>
<type i="21" name="Combulator">
<snapshot name="Init" p0="0" p1="-9" p2="0.25" p3="-0.25" p4="0.75" p5="0" p6="0.793701" p7="0.793701" p8="0.793701"
Expand Down
2 changes: 2 additions & 0 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ add_library(${PROJECT_NAME}
dsp/WavetableScriptEvaluator.h
dsp/effects/BBDEnsembleEffect.cpp
dsp/effects/BBDEnsembleEffect.h
dsp/effects/BonsaiEffect.cpp
dsp/effects/BonsaiEffect.h
dsp/effects/ChorusEffect.h
dsp/effects/ChorusEffectImpl.h
dsp/effects/CombulatorEffect.cpp
Expand Down
60 changes: 60 additions & 0 deletions src/common/Parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ bool Parameter::can_extend_range() const
case ct_twist_aux_mix:
case ct_countedset_percent_extendable:
case ct_dly_fb_clippingmodes:
case ct_bonsai_bass_boost:
case ct_bonsai_noise_gain:

// Extendable integers are really rare and special.
// If you add one, you may want to chat with us on Discord!
Expand Down Expand Up @@ -364,6 +366,7 @@ bool Parameter::has_deformoptions() const
case ct_dly_fb_clippingmodes:
case ct_noise_color:
case ct_amplitude_ringmod:
case ct_bonsai_bass_boost:
return true;
default:
break;
Expand Down Expand Up @@ -409,6 +412,8 @@ bool Parameter::is_bipolar() const
case ct_pitch4oct:
case ct_modern_trimix:
case ct_oscspread_bipolar:
case ct_bonsai_bass_boost:
case ct_bonsai_noise_gain:
res = true;
break;
case ct_lfoamplitude:
Expand Down Expand Up @@ -457,6 +462,9 @@ bool Parameter::is_discrete_selection() const
case ct_wstype:
case ct_mscodec:
case ct_reverbshape:
case ct_bonsai_sat_filter:
case ct_bonsai_sat_mode:
case ct_bonsai_noise_mode:
return true;
default:
break;
Expand Down Expand Up @@ -1293,6 +1301,48 @@ void Parameter::set_type(int ctrltype)
val_default.f = 0.5f;
break;

case ct_bonsai_bass_boost:
valtype = vt_float;
val_min.f = -24.0f;
val_max.f = 24.0f;
val_default.f = 0.f;
break;

case ct_bonsai_bass_distortion:
valtype = vt_float;
val_min.f = 0.0f;
val_max.f = 3.0f;
val_default.f = 1.0f;
break;

case ct_bonsai_sat_filter:
valtype = vt_int;
val_min.i = 0;
val_default.i = 0;
val_max.i = 1;
break;

case ct_bonsai_sat_mode:
valtype = vt_int;
val_min.i = 0;
val_default.i = 1;
val_max.i = 3;
break;

case ct_bonsai_noise_gain:
valtype = vt_float;
val_min.f = -24.0f;
val_max.f = 12.0f;
val_default.f = 0.f;
break;

case ct_bonsai_noise_mode:
valtype = vt_int;
val_min.i = 0;
val_default.i = 0;
val_max.i = 1;
break;

case ct_none:
default:
snprintf(dispname, NAMECHARS, "-");
Expand Down Expand Up @@ -1498,6 +1548,8 @@ void Parameter::set_type(int ctrltype)
case ct_decibel_deactivatable:
case ct_decibel_narrow_deactivatable:
case ct_decibel_extra_narrow_deactivatable:
case ct_bonsai_bass_boost:
case ct_bonsai_noise_gain:
displayType = LinearWithScale;
snprintf(displayInfo.unit, DISPLAYINFO_TXT_SIZE, "dB");
break;
Expand Down Expand Up @@ -1694,6 +1746,7 @@ void Parameter::bound_value(bool force_integer)
case ct_reson_res_extendable:
case ct_modern_trimix:
case ct_tape_drive:
case ct_bonsai_bass_distortion:
{
val.f = floor(val.f * 100) / 100.0;
break;
Expand Down Expand Up @@ -1784,6 +1837,8 @@ void Parameter::bound_value(bool force_integer)
case ct_decibel_deactivatable:
case ct_decibel_narrow_deactivatable:
case ct_decibel_extra_narrow_deactivatable:
case ct_bonsai_bass_boost:
case ct_bonsai_noise_gain:
{
val.f = floor(val.f);
break;
Expand Down Expand Up @@ -2163,6 +2218,8 @@ float Parameter::get_extended(float f) const
case ct_pitch_semi7bp_absolutable:
return 12.f * f;
case ct_decibel_extendable:
case ct_bonsai_bass_boost:
case ct_bonsai_noise_gain:
return 3.f * f;
case ct_decibel_narrow_extendable:
return 5.f * f;
Expand Down Expand Up @@ -4276,6 +4333,9 @@ bool Parameter::can_setvalue_from_string() const
case ct_tape_microns:
case ct_tape_speed:
case ct_spring_decay:
case ct_bonsai_bass_boost:
case ct_bonsai_bass_distortion:
case ct_bonsai_noise_gain:
{
return true;
}
Expand Down
6 changes: 6 additions & 0 deletions src/common/Parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ enum ctrltypes
ct_percent_bipolar_pan, // bipolar with special text strings at -100%, +100% and 0%
ct_spring_decay,
ct_amplitude_ringmod,
ct_bonsai_bass_boost,
ct_bonsai_bass_distortion,
ct_bonsai_sat_filter,
ct_bonsai_sat_mode,
ct_bonsai_noise_mode,
ct_bonsai_noise_gain,

num_ctrltypes,
};
Expand Down
26 changes: 14 additions & 12 deletions src/common/SurgeStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const int FIRoffsetI16 = FIRipolI16_N >> 1;
// 19 -> 20 (XT 1.1 release) added voice envelope mode, but super late so don't break 19
// 20 -> 21 (XT 1.2 nightlies) added absolutable mode for Combulator Offset 1/2 (to match the behavior of Center parameter)
// added oddsound_as_mts_main
// 21 -> 22 (XT 1.3 nighlies) added new ring modulator modes in the mixer
// 21 -> 22 (XT 1.3 nighlies) added new ring modulator modes in the mixer, add bonsai distortion effect
// clang-format on

const int ff_revision = 22;
Expand Down Expand Up @@ -383,6 +383,7 @@ enum fx_type
fxt_waveshaper,
fxt_mstool,
fxt_spring_reverb,
fxt_bonsai,

n_fx_types,
};
Expand Down Expand Up @@ -414,19 +415,20 @@ const char fx_type_names[n_fx_types][32] = {"Off",
"Treemonster",
"Waveshaper",
"Mid-Side Tool",
"Spring Reverb"};
"Spring Reverb",
"Bonsai"};

const char fx_type_shortnames[n_fx_types][16] = {
"Off", "Delay", "Reverb 1", "Phaser", "Rotary", "Distortion",
"EQ", "Freq Shift", "Conditioner", "Chorus", "Vocoder", "Reverb 2",
"Flanger", "Ring Mod", "Airwindows", "Neuron", "Graphic EQ", "Resonator",
"CHOW", "Exciter", "Ensemble", "Combulator", "Nimbus", "Tape",
"Treemonster", "Waveshaper", "Mid-Side Tool", "Spring Reverb"};

const char fx_type_acronyms[n_fx_types][8] = {"OFF", "DLY", "RV1", "PH", "ROT", "DIST", "EQ",
"FRQ", "DYN", "CH", "VOC", "RV2", "FL", "RM",
"AW", "NEU", "GEQ", "RES", "CHW", "XCT", "ENS",
"CMB", "NIM", "TAPE", "TM", "WS", "M-S", "SRV"};
"Off", "Delay", "Reverb 1", "Phaser", "Rotary", "Distortion",
"EQ", "Freq Shift", "Conditioner", "Chorus", "Vocoder", "Reverb 2",
"Flanger", "Ring Mod", "Airwindows", "Neuron", "Graphic EQ", "Resonator",
"CHOW", "Exciter", "Ensemble", "Combulator", "Nimbus", "Tape",
"Treemonster", "Waveshaper", "Mid-Side Tool", "Spring Reverb", "Bonsai"};

const char fx_type_acronyms[n_fx_types][8] = {
"OFF", "DLY", "RV1", "PH", "ROT", "DIST", "EQ", "FRQ", "DYN", "CH",
"VOC", "RV2", "FL", "RM", "AW", "NEU", "GEQ", "RES", "CHW", "XCT",
"ENS", "CMB", "NIM", "TAPE", "TM", "WS", "M-S", "SRV", "BON"};

enum fx_bypass
{
Expand Down
3 changes: 3 additions & 0 deletions src/common/dsp/Effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* https://github.com/surge-synthesizer/surge
*/
#include "BBDEnsembleEffect.h"
#include "BonsaiEffect.h"
#include "ChorusEffectImpl.h"
#include "CombulatorEffect.h"
#include "ConditionerEffect.h"
Expand Down Expand Up @@ -110,6 +111,8 @@ Effect *spawn_effect(int id, SurgeStorage *storage, FxStorage *fxdata, pdata *pd
return new MSToolEffect(storage, fxdata, pd);
case fxt_spring_reverb:
return new chowdsp::SpringReverbEffect(storage, fxdata, pd);
case fxt_bonsai:
return new BonsaiEffect(storage, fxdata, pd);
default:
return 0;
};
Expand Down
Loading

0 comments on commit 11c9bbd

Please sign in to comment.