How can I play this SynthDef by sending a trigger with a pattern? I have a Dust Ugen doing what I want to hear. A clean ringing. Ive tried various things, but they didn’t work. Looked online for examples of sending a trigger into a SynthDef with a pattern, and found nothing. Thank you
(
SynthDef(\smrDynKlank, {
arg out=0, gate=1, t_trig=1, trigRate=10,
freq=440, rotate=0, spread=0.5, resonance=0.5,
morph=0, slew=0.1, masterLevel=0.5;
var input, sig, numBands=6;
var freqs, amps, decayTimes;
// Generate input based on trigger or continuous rate
input = Dust.ar(4);
// Reduce input amplitude
input = input * 0.1;
freqs = Array.fill(numBands, { |i|
var baseFreq = freq * (2 ** (i / 12));
var rotatedFreq = baseFreq * (2 ** (rotate / 12));
var spreadFreq = rotatedFreq * (1 + (i - (numBands/2)) * spread);
LFDNoise3.kr(morph).range(spreadFreq * 0.9, spreadFreq * 1.1).clip(20, 20000);
});
freqs = freqs.collect({ |freq| VarLag.kr(freq, slew) });
// Reduce amplitude range
amps = Array.fill(numBands, { LFNoise2.kr(0.1).range(0.1, 0.3) });
// Increase decay times for a smoother sound
decayTimes = Array.fill(numBands, { resonance.linexp(0, 1, 0.2, 3) });
sig = DynKlank.ar(`[freqs, amps, decayTimes], input);
// Apply master level and envelope
sig = sig * masterLevel * EnvGen.kr(Env.asr(0.01, 1, 0.1), gate, doneAction: 2);
// Apply limiter to prevent clipping
sig = Limiter.ar(sig, 0.9);
Out.ar(out, sig!2);
}).play;
)