Skip to content

Commit 801da27

Browse files
committed
fixed soft distortion
1 parent c58203d commit 801da27

21 files changed

+174
-98
lines changed

AdditionalSourceCode/nodes/Reverb.h

+12-12
Original file line numberDiff line numberDiff line change
@@ -291,24 +291,24 @@ template <int NV> struct instance: public Reverb_impl::Reverb_t_<NV>
291291
0x5C29, 0x3FCF, 0x0000, 0x3F80, 0xD70A, 0x3C23, 0x0C5B, 0x0000,
292292
0x4D00, 0x7869, 0x0000, 0x0000, 0x0000, 0x8000, 0x003F, 0x8000,
293293
0x003F, 0x8000, 0x003F, 0x0000, 0x5B00, 0x000D, 0x0000, 0x7270,
294-
0x4465, 0x6C65, 0x7961, 0x0000, 0x0000, 0x0000, 0xFA00, 0xCD44,
295-
0x9E8C, 0x0043, 0x0000, 0xCD3F, 0xCCCC, 0x5B3D, 0x000E, 0x0000,
294+
0x4465, 0x6C65, 0x7961, 0x0000, 0x0000, 0x0000, 0xFA00, 0x0044,
295+
0x0000, 0x0000, 0x0000, 0xCD3F, 0xCCCC, 0x5B3D, 0x000E, 0x0000,
296296
0x6546, 0x6465, 0x6162, 0x6B63, 0x0000, 0x0000, 0x0000, 0x8000,
297-
0x533F, 0x2432, 0x003F, 0x8000, 0x003F, 0x0000, 0x5B00, 0x000F,
297+
0x003F, 0x0000, 0x0000, 0x8000, 0x003F, 0x0000, 0x5B00, 0x000F,
298298
0x0000, 0x6D53, 0x6F6F, 0x6874, 0x6E69, 0x0067, 0x0000, 0x0000,
299299
0x0000, 0x3F80, 0x0000, 0x0000, 0x0000, 0x3F80, 0x0000, 0x0000,
300300
0x105B, 0x0000, 0x4400, 0x6C65, 0x7961, 0x694D, 0x0078, 0x0000,
301-
0x0000, 0x0000, 0x3F80, 0x8237, 0x3EFB, 0x0000, 0x3F80, 0x0000,
301+
0x0000, 0x0000, 0x3F80, 0x0000, 0x3F80, 0x0000, 0x3F80, 0x0000,
302302
0x0000, 0x115B, 0x0000, 0x4400, 0x6C65, 0x7961, 0x7355, 0x5465,
303303
0x6D65, 0x6F70, 0x0000, 0x0000, 0x0000, 0x8000, 0x003F, 0x0000,
304304
0x0000, 0x8000, 0x003F, 0x8000, 0x5B3F, 0x0012, 0x0000, 0x6544,
305305
0x616C, 0x5479, 0x6D65, 0x6F70, 0x0000, 0x0000, 0x0000, 0x9000,
306306
0x0041, 0xC000, 0x0040, 0x8000, 0x003F, 0x8000, 0x5B3F, 0x0013,
307307
0x0000, 0x6544, 0x616C, 0x4879, 0x6769, 0x7068, 0x7361, 0x0073,
308-
0x0000, 0x41A0, 0x4000, 0x469C, 0x4000, 0x469C, 0x6C1A, 0x3E6B,
308+
0x0000, 0x41A0, 0x4000, 0x469C, 0x0000, 0x41A0, 0x6C1A, 0x3E6B,
309309
0x0000, 0x0000, 0x145B, 0x0000, 0x4400, 0x6C65, 0x7961, 0x6F4C,
310-
0x7077, 0x7361, 0x0073, 0x0000, 0x41A0, 0x4000, 0x469C, 0x0000,
311-
0x41A0, 0x6C1A, 0x3E6B, 0x0000, 0x0000, 0x0000
310+
0x7077, 0x7361, 0x0073, 0x0000, 0x41A0, 0x4000, 0x469C, 0x4000,
311+
0x469C, 0x6C1A, 0x3E6B, 0x0000, 0x0000, 0x0000
312312
};
313313
};
314314

@@ -506,14 +506,14 @@ template <int NV> struct instance: public Reverb_impl::Reverb_t_<NV>
506506
this->setParameterT(10, 0.406359);
507507
this->setParameterT(11, 1.62);
508508
this->setParameterT(12, 1.);
509-
this->setParameterT(13, 317.1);
510-
this->setParameterT(14, 0.641393);
509+
this->setParameterT(13, 0.);
510+
this->setParameterT(14, 0.);
511511
this->setParameterT(15, 0.);
512-
this->setParameterT(16, 0.491228);
512+
this->setParameterT(16, 1.);
513513
this->setParameterT(17, 0.);
514514
this->setParameterT(18, 6.);
515-
this->setParameterT(19, 20000.);
516-
this->setParameterT(20, 20.);
515+
this->setParameterT(19, 20.);
516+
this->setParameterT(20, 20000.);
517517
this->setExternalData({}, -1);
518518
}
519519
~instance() override

AdditionalSourceCode/nodes/Waveshaper.h

+67-34
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ using minmax_t = control::minmax<NV,
4646
template <int NV>
4747
using minmax1_t = control::minmax<NV,
4848
parameter::plain<project::Distortion<NV>, 0>>;
49+
50+
template <int NV> using minmax2_t = minmax_t<NV>;
51+
52+
template <int NV>
53+
using smoothed_parameter_unscaled_mod = parameter::chain<ranges::Identity,
54+
parameter::plain<minmax_t<NV>, 0>,
55+
parameter::plain<minmax1_t<NV>, 0>,
56+
parameter::plain<minmax2_t<NV>, 0>>;
57+
58+
template <int NV>
59+
using smoothed_parameter_unscaled_t = wrap::mod<smoothed_parameter_unscaled_mod<NV>,
60+
control::smoothed_parameter_unscaled<NV, smoothers::linear_ramp<NV>>>;
4961
template <int NumVoices> struct snex_softsat
5062
{
5163
SNEX_NODE(snex_softsat);
@@ -122,7 +134,8 @@ using snex_shaper_t = wrap::no_data<core::snex_shaper<snex_softsat<NV>>>;
122134
template <int NV>
123135
using chain_t = container::chain<parameter::empty,
124136
wrap::fix<2, core::gain<NV>>,
125-
snex_shaper_t<NV>>;
137+
snex_shaper_t<NV>,
138+
core::gain<NV>>;
126139
template <int NV>
127140
using branch_t = container::branch<parameter::empty,
128141
wrap::fix<2, chain_t<NV>>,
@@ -132,7 +145,9 @@ template <int NV>
132145
using wet_path_t = container::chain<parameter::empty,
133146
wrap::fix<2, filters::one_pole<NV>>,
134147
filters::one_pole<NV>,
148+
smoothed_parameter_unscaled_t<NV>,
135149
minmax_t<NV>,
150+
minmax2_t<NV>,
136151
minmax1_t<NV>,
137152
branch_t<NV>,
138153
filters::one_pole<NV>,
@@ -152,16 +167,14 @@ namespace Waveshaper_t_parameters
152167
{
153168
// Parameter list for Waveshaper_impl::Waveshaper_t ------------------------------------------------
154169

155-
template <int NV>
156-
using Amount = parameter::chain<ranges::Identity,
157-
parameter::plain<Waveshaper_impl::minmax_t<NV>, 0>,
158-
parameter::plain<Waveshaper_impl::minmax1_t<NV>, 0>>;
159-
160170
using Distort = parameter::empty;
161171
template <int NV>
162172
using Mix = parameter::plain<Waveshaper_impl::dry_wet1_t<NV>,
163173
0>;
164174
template <int NV>
175+
using Amount = parameter::plain<Waveshaper_impl::smoothed_parameter_unscaled_t<NV>,
176+
0>;
177+
template <int NV>
165178
using Gain = parameter::plain<project::Distortion<NV>,
166179
1>;
167180
template <int NV>
@@ -210,9 +223,9 @@ template <int NV> struct instance: public Waveshaper_impl::Waveshaper_t_<NV>
210223
0x5B00, 0x0001, 0x0000, 0x694D, 0x0078, 0x0000, 0x0000, 0x0000,
211224
0x3F80, 0x0000, 0x3F80, 0x0000, 0x3F80, 0x0000, 0x0000, 0x025B,
212225
0x0000, 0x4100, 0x6F6D, 0x6E75, 0x0074, 0x0000, 0x0000, 0x0000,
213-
0x3F80, 0xDC7F, 0x3EA1, 0x0000, 0x3F80, 0x0000, 0x0000, 0x035B,
226+
0x3F80, 0xF705, 0x3F0E, 0x0000, 0x3F80, 0x0000, 0x0000, 0x035B,
214227
0x0000, 0x4700, 0x6961, 0x006E, 0x0000, 0xC2C0, 0x0000, 0x4040,
215-
0x0000, 0x3F80, 0x0000, 0x3F80, 0xCCCD, 0x3DCC, 0x045B, 0x0000,
228+
0x0000, 0x35C0, 0x0000, 0x3F80, 0xCCCD, 0x3DCC, 0x045B, 0x0000,
216229
0x6C00, 0x0070, 0x0000, 0x41A0, 0x4000, 0x469C, 0x1C08, 0x45A1,
217230
0x6C1A, 0x3E6B, 0x0000, 0x0000, 0x055B, 0x0000, 0x6800, 0x0070,
218231
0x0000, 0x41A0, 0x4000, 0x469C, 0xD49A, 0x4318, 0x6C1A, 0x3E6B,
@@ -221,7 +234,7 @@ template <int NV> struct instance: public Waveshaper_impl::Waveshaper_t_<NV>
221234
0x0000, 0x0000, 0x075B, 0x0000, 0x7000, 0x736F, 0x6874, 0x0070,
222235
0x0000, 0x41A0, 0x4000, 0x469C, 0xF1BE, 0x4234, 0x6C1A, 0x3E6B,
223236
0x0000, 0x0000, 0x085B, 0x0000, 0x4D00, 0x646F, 0x0065, 0x0000,
224-
0x0000, 0x0000, 0x3F80, 0x0000, 0x3F80, 0x0000, 0x3F80, 0x0000,
237+
0x0000, 0x0000, 0x3F80, 0x0000, 0x0000, 0x0000, 0x3F80, 0x0000,
225238
0x3F80, 0x0000
226239
};
227240
};
@@ -237,26 +250,27 @@ template <int NV> struct instance: public Waveshaper_impl::Waveshaper_t_<NV>
237250
auto& wet_path = this->getT(0).getT(1); // Waveshaper_impl::wet_path_t<NV>
238251
auto& one_pole = this->getT(0).getT(1).getT(0); // filters::one_pole<NV>
239252
auto& one_pole1 = this->getT(0).getT(1).getT(1); // filters::one_pole<NV>
240-
auto& minmax = this->getT(0).getT(1).getT(2); // Waveshaper_impl::minmax_t<NV>
241-
auto& minmax1 = this->getT(0).getT(1).getT(3); // Waveshaper_impl::minmax1_t<NV>
242-
auto& branch = this->getT(0).getT(1).getT(4); // Waveshaper_impl::branch_t<NV>
243-
auto& chain = this->getT(0).getT(1).getT(4).getT(0); // Waveshaper_impl::chain_t<NV>
244-
auto& gain = this->getT(0).getT(1).getT(4).getT(0).getT(0); // core::gain<NV>
245-
auto& snex_shaper = this->getT(0).getT(1).getT(4).getT(0).getT(1); // Waveshaper_impl::snex_shaper_t<NV>
246-
auto& faust = this->getT(0).getT(1).getT(4).getT(1); // project::Distortion<NV>
247-
auto& one_pole2 = this->getT(0).getT(1).getT(5); // filters::one_pole<NV>
248-
auto& one_pole3 = this->getT(0).getT(1).getT(6); // filters::one_pole<NV>
249-
auto& wet_gain = this->getT(0).getT(1).getT(7); // core::gain<NV>
253+
auto& smoothed_parameter_unscaled = this->getT(0).getT(1).getT(2); // Waveshaper_impl::smoothed_parameter_unscaled_t<NV>
254+
auto& minmax = this->getT(0).getT(1).getT(3); // Waveshaper_impl::minmax_t<NV>
255+
auto& minmax2 = this->getT(0).getT(1).getT(4); // Waveshaper_impl::minmax2_t<NV>
256+
auto& minmax1 = this->getT(0).getT(1).getT(5); // Waveshaper_impl::minmax1_t<NV>
257+
auto& branch = this->getT(0).getT(1).getT(6); // Waveshaper_impl::branch_t<NV>
258+
auto& chain = this->getT(0).getT(1).getT(6).getT(0); // Waveshaper_impl::chain_t<NV>
259+
auto& gain = this->getT(0).getT(1).getT(6).getT(0).getT(0); // core::gain<NV>
260+
auto& snex_shaper = this->getT(0).getT(1).getT(6).getT(0).getT(1); // Waveshaper_impl::snex_shaper_t<NV>
261+
auto& gain1 = this->getT(0).getT(1).getT(6).getT(0).getT(2); // core::gain<NV>
262+
auto& faust = this->getT(0).getT(1).getT(6).getT(1); // project::Distortion<NV>
263+
auto& one_pole2 = this->getT(0).getT(1).getT(7); // filters::one_pole<NV>
264+
auto& one_pole3 = this->getT(0).getT(1).getT(8); // filters::one_pole<NV>
265+
auto& wet_gain = this->getT(0).getT(1).getT(9); // core::gain<NV>
250266

251267
// Parameter Connections -------------------------------------------------------------------
252268

253269
dry_wet1.getParameterT(0).connectT(0, dry_wet_mixer); // DryWet -> dry_wet_mixer::Value
254270

255271
this->getParameterT(1).connectT(0, dry_wet1); // Mix -> dry_wet1::DryWet
256272

257-
auto& Amount_p = this->getParameterT(2);
258-
Amount_p.connectT(0, minmax); // Amount -> minmax::Value
259-
Amount_p.connectT(1, minmax1); // Amount -> minmax1::Value
273+
this->getParameterT(2).connectT(0, smoothed_parameter_unscaled); // Amount -> smoothed_parameter_unscaled::Value
260274

261275
this->getParameterT(3).connectT(0, faust); // Gain -> faust::gain
262276

@@ -273,10 +287,14 @@ template <int NV> struct instance: public Waveshaper_impl::Waveshaper_t_<NV>
273287
// Modulation Connections ------------------------------------------------------------------
274288

275289
auto& dry_wet_mixer_p = dry_wet_mixer.getWrappedObject().getParameter();
276-
dry_wet_mixer_p.getParameterT(0).connectT(0, dry_gain); // dry_wet_mixer -> dry_gain::Gain
277-
dry_wet_mixer_p.getParameterT(1).connectT(0, wet_gain); // dry_wet_mixer -> wet_gain::Gain
278-
minmax.getWrappedObject().getParameter().connectT(0, gain); // minmax -> gain::Gain
279-
minmax1.getWrappedObject().getParameter().connectT(0, faust); // minmax1 -> faust::distortion
290+
dry_wet_mixer_p.getParameterT(0).connectT(0, dry_gain); // dry_wet_mixer -> dry_gain::Gain
291+
dry_wet_mixer_p.getParameterT(1).connectT(0, wet_gain); // dry_wet_mixer -> wet_gain::Gain
292+
minmax.getWrappedObject().getParameter().connectT(0, gain); // minmax -> gain::Gain
293+
minmax1.getWrappedObject().getParameter().connectT(0, faust); // minmax1 -> faust::distortion
294+
minmax2.getWrappedObject().getParameter().connectT(0, gain1); // minmax2 -> gain1::Gain
295+
smoothed_parameter_unscaled.getParameter().connectT(0, minmax); // smoothed_parameter_unscaled -> minmax::Value
296+
smoothed_parameter_unscaled.getParameter().connectT(1, minmax1); // smoothed_parameter_unscaled -> minmax1::Value
297+
smoothed_parameter_unscaled.getParameter().connectT(2, minmax2); // smoothed_parameter_unscaled -> minmax2::Value
280298

281299
// Default Values --------------------------------------------------------------------------
282300

@@ -302,13 +320,24 @@ template <int NV> struct instance: public Waveshaper_impl::Waveshaper_t_<NV>
302320
one_pole1.setParameterT(4, 1.); // filters::one_pole::Mode
303321
one_pole1.setParameterT(5, 1.); // filters::one_pole::Enabled
304322

323+
; // smoothed_parameter_unscaled::Value is automated
324+
smoothed_parameter_unscaled.setParameterT(1, 100.); // control::smoothed_parameter_unscaled::SmoothingTime
325+
smoothed_parameter_unscaled.setParameterT(2, 1.); // control::smoothed_parameter_unscaled::Enabled
326+
305327
; // minmax::Value is automated
306328
minmax.setParameterT(1, 0.); // control::minmax::Minimum
307-
minmax.setParameterT(2, 21.5); // control::minmax::Maximum
329+
minmax.setParameterT(2, 30.5); // control::minmax::Maximum
308330
minmax.setParameterT(3, 0.492949); // control::minmax::Skew
309331
minmax.setParameterT(4, 0.1); // control::minmax::Step
310332
minmax.setParameterT(5, 0.); // control::minmax::Polarity
311333

334+
; // minmax2::Value is automated
335+
minmax2.setParameterT(1, -9.39724); // control::minmax::Minimum
336+
minmax2.setParameterT(2, 0.); // control::minmax::Maximum
337+
minmax2.setParameterT(3, 5.73463); // control::minmax::Skew
338+
minmax2.setParameterT(4, 0.); // control::minmax::Step
339+
minmax2.setParameterT(5, 1.); // control::minmax::Polarity
340+
312341
; // minmax1::Value is automated
313342
minmax1.setParameterT(1, 0.); // control::minmax::Minimum
314343
minmax1.setParameterT(2, 50.); // control::minmax::Maximum
@@ -318,9 +347,13 @@ template <int NV> struct instance: public Waveshaper_impl::Waveshaper_t_<NV>
318347

319348
; // branch::Index is automated
320349

321-
; // gain::Gain is automated
322-
gain.setParameterT(1, 20.); // core::gain::Smoothing
323-
gain.setParameterT(2, 0.); // core::gain::ResetValue
350+
; // gain::Gain is automated
351+
gain.setParameterT(1, 96.2); // core::gain::Smoothing
352+
gain.setParameterT(2, 0.); // core::gain::ResetValue
353+
354+
; // gain1::Gain is automated
355+
gain1.setParameterT(1, 100.6); // core::gain::Smoothing
356+
gain1.setParameterT(2, 0.); // core::gain::ResetValue
324357

325358
; // faust::distortion is automated
326359
; // faust::gain is automated
@@ -345,13 +378,13 @@ template <int NV> struct instance: public Waveshaper_impl::Waveshaper_t_<NV>
345378

346379
this->setParameterT(0, 1.);
347380
this->setParameterT(1, 1.);
348-
this->setParameterT(2, 0.316135);
349-
this->setParameterT(3, 1.);
381+
this->setParameterT(2, 0.558457);
382+
this->setParameterT(3, 1.43051e-06);
350383
this->setParameterT(4, 5155.5);
351384
this->setParameterT(5, 152.83);
352385
this->setParameterT(6, 7118.38);
353386
this->setParameterT(7, 45.2361);
354-
this->setParameterT(8, 1.);
387+
this->setParameterT(8, 0.);
355388
this->setExternalData({}, -1);
356389
}
357390
~instance() override
@@ -371,7 +404,7 @@ template <int NV> struct instance: public Waveshaper_impl::Waveshaper_t_<NV>
371404
{
372405
// External Data Connections ---------------------------------------------------------------
373406

374-
this->getT(0).getT(1).getT(4).getT(0).getT(1).setExternalData(b, index); // Waveshaper_impl::snex_shaper_t<NV>
407+
this->getT(0).getT(1).getT(6).getT(0).getT(1).setExternalData(b, index); // Waveshaper_impl::snex_shaper_t<NV>
375408
}
376409
};
377410
}

DspNetworks/Networks/Reverb.xml

+7-7
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
<Parameter MinValue="0.0" MaxValue="1.0" ID="Feedback" Automated="1"/>
157157
</Parameters>
158158
</Node>
159-
<Node ID="faust2" FactoryPath="core.faust" Bypassed="0" Folded="1">
159+
<Node ID="faust2" FactoryPath="core.faust" Bypassed="0">
160160
<Properties>
161161
<Property ID="ClassId" Value="Delay2"/>
162162
<Property ID="NumParameters" Value="0"/>
@@ -409,13 +409,13 @@
409409
<Connection NodeId="dry_wet2" ParameterId="DryWet"/>
410410
</Connections>
411411
</Parameter>
412-
<Parameter ID="preDelay" MinValue="0.0" MaxValue="2000.0" Value="317.1000047251582"
413-
StepSize="0.1000000014901161" SkewFactor="0.5">
412+
<Parameter ID="preDelay" MinValue="0.0" MaxValue="2000.0" Value="0.0" StepSize="0.1000000014901161"
413+
SkewFactor="0.5">
414414
<Connections>
415415
<Connection NodeId="tempo_sync" ParameterId="UnsyncedTime"/>
416416
</Connections>
417417
</Parameter>
418-
<Parameter ID="Feedback" MinValue="0.0" MaxValue="1.0" Value="0.6413928833007813">
418+
<Parameter ID="Feedback" MinValue="0.0" MaxValue="1.0" Value="0.0">
419419
<Connections>
420420
<Connection NodeId="receive" ParameterId="Feedback"/>
421421
</Connections>
@@ -425,7 +425,7 @@
425425
<Connection NodeId="bipolar" ParameterId="Value"/>
426426
</Connections>
427427
</Parameter>
428-
<Parameter ID="DelayMix" MinValue="0.0" MaxValue="1.0" Value="0.4912278442382813">
428+
<Parameter ID="DelayMix" MinValue="0.0" MaxValue="1.0" Value="1.0">
429429
<Connections>
430430
<Connection NodeId="dry_wet3" ParameterId="DryWet"/>
431431
</Connections>
@@ -443,13 +443,13 @@
443443
</Connections>
444444
</Parameter>
445445
<Parameter ID="DelayHighpass" MinValue="20.0" MaxValue="20000.0" SkewFactor="0.2299045622348785"
446-
Value="20000.0">
446+
Value="20.0">
447447
<Connections>
448448
<Connection NodeId="biquad" ParameterId="Frequency"/>
449449
</Connections>
450450
</Parameter>
451451
<Parameter ID="DelayLowpass" MinValue="20.0" MaxValue="20000.0" SkewFactor="0.2299045622348785"
452-
Value="20.0">
452+
Value="20000.0">
453453
<Connections>
454454
<Connection NodeId="moog" ParameterId="Frequency"/>
455455
</Connections>

0 commit comments

Comments
 (0)