Skip to content

Commit 83dd062

Browse files
committed
sdfdsfds
1 parent 888ec88 commit 83dd062

File tree

1 file changed

+63
-15
lines changed

1 file changed

+63
-15
lines changed

dev/src/dsp-definitions/49-alchemist-prototype-3.ts

Lines changed: 63 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ bass_synth = tunePlayer(tune2) : synth;
2626
counter(trig) = upfront(trig) : + ~ _ with { upfront(x) = x > x'; };
2727
2828
lerp(a, b, x) = a + (b - a) * x;
29+
unlerp(a, b, x) = (x - a) / (b - a);
2930
30-
constantPowerPan(p, x) = x*gainLeft, x*gainRight
31+
constantPowerPan(p, x, y) = x*gainLeft, y*gainRight
3132
with {
3233
theta = ma.PI*p/2.;
33-
gainLeft = cos(theta)/sqrt(2.);
34-
gainRight = sin(theta)/sqrt(2.);
34+
gainLeft = cos(theta)/sqrt(2.)*2.;
35+
gainRight = sin(theta)/sqrt(2.)*2.;
3536
};
3637
3738
reject_noise(slack, move_time, x) = return with {
@@ -80,9 +81,6 @@ width_param = hslider("width[OWL:D]", 0., 0., 1., .001) : reject_noise(0.05, 1.0
8081
detune_on = button("detune_on[OWL:B1]") : ba.toggle;
8182
trem_on = button("trem_on[OWL:B2]") : ba.toggle;
8283
83-
// TODO sidechain
84-
// TODO width options
85-
8684
// fx
8785
wet_amount_detune = ba.if(detune_param < 2/3, ba.if(detune_param < 1/3, .1, .3), .5);
8886
wet_amount = ba.if(detune_on, wet_amount_detune, 1.);
@@ -100,7 +98,63 @@ gtr_trem_gain = lerp(1. - trem_depth, 1. + trem_depth, os.osc(trem_speed) * .5 +
10098
gtr_trem_l = *(gtr_trem_gain);
10199
gtr_trem = ba.bypass1(trem_on : ==(0), gtr_trem_l);
102100
103-
gtr = *(wet_amount) : gtr_trem <: gtr_detune : _,_;
101+
gtr_sidechain = ba.lin2LogGain(1. - sidechain_param);
102+
gtr_gain_amount = wet_amount * gtr_sidechain;
103+
gtr_gain = *(gtr_gain_amount);
104+
105+
// stereo-wide / stereo-narrow / mono-panned / mono-autopan / offset / pingpong
106+
107+
gtr_width(l,r) = return with {
108+
p(a,b,l,r) = return with {
109+
gain = (width_param >= a) & (width_param < b);
110+
return = l * gain,r * gain;
111+
};
112+
113+
p0 = 0.;
114+
p1 = .07;
115+
p2 = .13;
116+
p3 = .2;
117+
p4 = .4;
118+
p5 = .6;
119+
p6 = .8;
120+
p7 = 1.;
121+
122+
p55 = (p5 + p6) * .5;
123+
p65 = (p6 + p7) * .5;
124+
125+
pan_amount_static = unlerp(p2,p4,width_param);
126+
pan_amount_auto = os.osc(unlerp(p4,p5,width_param) : lerp(.01, .5)) * .5 + .5;
127+
pan_amount = ba.if(width_param < p4, pan_amount_static, pan_amount_auto);
128+
129+
del_max = ma.SR;
130+
131+
d(a,b,x) = return with {
132+
gain = (width_param >= a) & (width_param < b);
133+
return = x * gain;
134+
};
135+
136+
del_la = unlerp(p55,p6,width_param) : lerp(0.,del_max) : d(p55,p6);
137+
del_lb = unlerp(p6,p65,width_param) : lerp(del_max * .5, 0.) : d(p6,p65);
138+
del_lc = unlerp(p65,p7,width_param) : lerp(0.,del_max) : d(p65,p7);
139+
del_l = del_la + del_lb + del_lc;
140+
141+
del_ra = unlerp(p5,p55,width_param) : lerp(del_max, 0.) : d(p5,p55);
142+
del_rb = unlerp(p6,p65,width_param) : lerp(del_max, 0.) : d(p6,p65);
143+
del_rc = unlerp(p65,p7,width_param) : lerp(0., del_max * .5) : d(p65,p7);
144+
del_r = del_ra + del_rb + del_rc;
145+
146+
del_vol = ba.if(width_param < p6, 1., .5);
147+
148+
stereo = p(p0,p1);
149+
narrow(l,r) = l*.75+r*.25,r*.75+l*.25 : p(p1,p2);
150+
mono = _,! <: p(p2,p3);
151+
pan = constantPowerPan(pan_amount) : p(p3,p5);
152+
offset = de.delay(del_max,del_l),de.delay(del_max,del_r) : *(del_vol),*(del_vol) : p(p5,p7);
153+
154+
return = l,r <: stereo,narrow,mono,pan,offset :> _,_;
155+
};
156+
157+
gtr = gtr_gain : gtr_trem <: gtr_detune : gtr_width;
104158
105159
bass_gate = ef.gate_mono(-64., .005, 0., 1.);
106160
bass_comp = co.compressor_mono(32., -34., 0., .4);
@@ -131,16 +185,10 @@ export default dspDefinition;
131185
* trem = - depth 30%: rate .2Hz ... 10Hz
132186
* - depth 60%: rate .2Hz ... 10Hz
133187
* - depth 100%: rate .2Hz ... 10Hz
134-
* - ??? randomise depth?
135188
*
136-
* width = NOT IMPLEMENTED
137-
* - straight: mono ... stereo
138-
* - autopan: slow ... fast
139-
* - offset: 0ms ... 500ms
140-
* - ping pong: 0ms ... 500ms
189+
* width = various
141190
*
142-
* sidechain = NOT IMPLEMENTED
143-
* - volume decrease: 0 ... 100%
191+
* sidechain = - volume decrease: 0 ... 100%
144192
*
145193
* BUTTONS:
146194
*

0 commit comments

Comments
 (0)