Hi,
I'm still experimenting with some "Virtual Analog" techniques.
Here is a small synth that combines two of my favourite tricks to model
filtered VCOs in a somewhat compact code (including anti aliasing) :D
I'm still experimenting with some "Virtual Analog" techniques.
Here is a small synth that combines two of my favourite tricks to model
filtered VCOs in a somewhat compact code (including anti aliasing) :D
Code:
desc:Smooth Lead 76
Author: T.Rochebois 09/2016
slider11:sl_A=-1.4<-3,0,0.001>Attack
slider12:sl_R=-0.5<-1,0.5,0.001>Release
// ___________________________________________________________________
@init
function makeUp(x)instance(x0 x1 x2)(
x2 = x1; x1 = x0; x0 = x;
3 * x1 - x0 - x2;
);
function I0(x)( x-=x|0; (6*x-6)*x+1 );
function I1(x)( x-=x|0; ((2*x-3)*x+1)*x );
function proc(dp)
instance(p p0 p1 y1 I1_1 I1_0)(
p += dp; // phase increment
p >= 16 ? (p -= 1; p0 -= 1;); // phase reset
p1 = p0; // previous phase
p0 = p - fenv * coef * y1; // <-- self modulated phase
I1_1 = I1_0; I1_0 = I1(p0); // pre integrated parabola
// Differentiator
y1 = p0 == p1 ? I0(p0) : (I1_0 - I1_1)/(p0 - p1);
);
// ___________________________________________________________________
@block
while (midirecv(offset, msg1, msg23)) (
msg2 = msg23 & 0x7F; msg3 = msg23 >> 8; status = msg1 & $xF0;
status == $x80 ? ( status = $x90; msg3 = 0; );
status == $x90 ? (
msg3 == 0 ? (msg2 == note ? gate = 0;)
: ( gate = sqrt(msg3 * (1/127)); note = msg2;
dp = (440/srate)*2^((note-69)*(1/12));
);
);
midisend(offset, msg1, msg23);
);
coef = note<82 ? 0.4:max(0,0.4-0.02*(note-82));
A = 1/(srate*10^sl_A);
fR = 1/(srate*10^sl_R);
R = 0.5*fR;
// ___________________________________________________________________
@sample
env += (env>gate ? R:A)*(gate-env);
fenv += gate ? A*(1-fenv): -fR*fenv;
out0 = osc0.proc(dp);
out1 = osc1.proc(dp*1.003);
out2 = osc2.proc(dp*0.995);
spl0 = spl1 = mu.makeUp(min(3,max(-3,0.33*env*(out0-out1+out2))));
JSFX synth. Smooth Lead 76
Aucun commentaire:
Enregistrer un commentaire