You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
scd/wavetables/wtable_vosc_dual_clean.scd

56 lines
1.3 KiB
Plaintext

(
SynthDef(\wtable_vosc_dual_clean, { |freq = 440, vel = 1, gate = 1, amp = 0.5, driveDB = 0, fmod = 0, res = 0.6, fltRange = 6000, direct = 1|
var env, sig, wtbufnum, wtbufnMod, osc, modOsc, fenv;
var wtbufnumRange = [ ~wtbufnums.minItem, ~wtbufnums.maxItem ];
// Standard ADSR Envelope
env = EnvGen.kr(
Env.adsr(0.1, 0.5, 0.6, 1, peakLevel:1.0, curve:-1.0, bias:0.0),
gate,
doneAction: 2
) * vel;
// Select a wavetable buffer in range
wtbufnum = \bufn.kr(wtbufnumRange[0]);
// Optional modulation oscillator (wavetable-based)
modOsc = VOsc.ar(
\wtmodbufn.kr(wtbufnumRange[0]),
\wtmodfreq.kr(2),
\modPhase.kr(0),
\wtmodamp.kr(1)
);
// Main oscillator using VOsc
osc = VOsc.ar(
wtbufnum,
freq
);
// Optional filtered modulation of the filter cutoff
fenv = VOsc.ar(
\fmodbufn.kr(wtbufnumRange[0]),
\fmodFreq.kr(0)
).range(0.5, 1.5);
// Apply envelope and optional distortion/filtering
sig = osc * env;
sig = RLPF.ar(
sig * driveDB.dbamp,
(freq * fenv).clip(40, fltRange),
res
);
sig = Resonz.ar(sig, Line.kr(200, 840), bwr:Line.kr(0.5, 0.1), mul:1.0, add:0.0);
sig = CombL.ar(sig, maxdelaytime:0.8, delaytime:0.5, decaytime:0.5, mul:1.0, add:0.0);
// Final level and output
sig = sig * amp * direct;
Out.ar(0, sig.dup);
}).add;
)