Legato Effect on Synth


#1

I’m trying to create a legato effect, using PMonoArctic, and it does one cycle, but I can’t figure out how to reset the cycle so it does the legato effect all over again. I’d appreciate any help. Here’s my code:

(
SynthDef.new(\synth, {
arg freq, gate=1, sus;
var sig1, filter, env;
sig1 = Pulse.ar(freq, 0.5, 0.5);
filter = LPF.ar(sig1, EnvGen.kr(Env([5000, 200], [10]), doneAction:0));
env = EnvGen.kr(Env.asr(0.01, sus, 1), gate, doneAction:2);
Out.ar(0, env*filter.dup);
}).add;
)

(
b = PmonoArtic(
\synth,
\freq, Pseq([220, 329.63, 440, 523.25, 587.33], inf),
\stretch,1.0,
\sus, 1.0,
\legato, 1.01,
\dur, 1/4,
).play;
)


#2

Set legato to something less than 1 to spawn a new synth. This example will reset the cycle every 20th note:

(
b = PmonoArtic(
	\synth,
	\freq, Pseq([220, 329.63, 440, 523.25, 587.33], inf),
	\stretch,1.0,
	\sus, 1.0,
	\legato, Pseq([Pn(1.01, 19), 0.99], inf),
	\dur, 1/4,
).play;
)