Im sorry here is the full code including the SynthDef:

```
(
t = TempoClock.new(60/60).permanent_(true);
SynthDef(\fm, {
arg out=0, pan=0, amp=0.25, freq=111,
mInd1=0.5, mInd2=0.5, mInd3=0.5, mInd4=0.5, mInd5=0.5, mInd6=0.5;
var sig, cascade_0, cascade_1;
//Buchla LPG
var lpgoffset=0, lpgfilterscale=0.4, vcaness=0.75;
//amp envelope
var gainEnv = \gainEnv.kr(Env.newClear(8).asArray);
gainEnv = EnvGen.kr(gainEnv, doneAction:2);
cascade_0 = SinOsc.ar(freq, SinOsc.ar(freq * \ratio3.kr(1), pi * 0.5).range(0, mInd3) ) * \amp_3.kr(0.5);
cascade_0 = SinOsc.ar(freq, SinOsc.ar(freq * \ratio2.kr(1), pi * 0.5).range(0, mInd2) + cascade_0.range(0,mInd2)) * \amp_2.kr(0.5);
cascade_0 = SinOsc.ar(freq, SinOsc.ar(freq * \ratio1.kr(1), pi * 0.5).range(0, mInd1) + cascade_0.range(0,mInd1)) * \amp_1.kr(0.5);
cascade_1 = SinOsc.ar(freq, SinOsc.ar(freq * \ratio6.kr(1), pi * 0.5).range(0, mInd6) + LocalIn.ar(1).range(0, mInd6)) * \amp_6.kr(0.5);
cascade_1 = SinOsc.ar(freq, SinOsc.ar(freq * \ratio5.kr(1), pi * 0.5).range(0, mInd5) + cascade_1.range(0,mInd5)) * \amp_5.kr(0.5);
cascade_1 = SinOsc.ar(freq, SinOsc.ar(freq * \ratio4.kr(1), pi * 0.5).range(0, mInd4) + cascade_1.range(0,mInd4)) * \amp_4.kr(0.5);
LocalOut.ar(cascade_1 * \fb.kr(0.9));
sig = Mix([cascade_0, cascade_1]);
sig = LeakDC.ar(sig);
sig = sig * gainEnv;
sig = LPG.ar(
input: sig,
controlinput: gainEnv,
controloffset: lpgoffset,
controlscale: lpgfilterscale,
vca: vcaness,
resonance: \res.kr(1.1),
lowpassmode:1,
linearity:1
);
sig = SoftClipAmp8.ar(sig, 0.5);
sig = Pan2.ar(sig, pan, amp);
sig = sig + NHHall.ar(sig, 0.4);
Out.ar(out, sig)
}).add;
)
(
~getRandomSet = {
arg set;
var numSteps = rrand(10,30);
set = set ? ();
set.putAll((
durations: {exprand(0.1,2)}!numSteps,
repetitions: {5.rand}!numSteps,
notes: {rrand(-24,24)}!numSteps,
// added motif here
motif: {rrand(-12,12)}!5
));
};
)
(
~seed = 1403411654;
//~seed = 1403251255;
thisThread.randSeed = ~seed;
a = ~getRandomSet.();
Pdef(\fm,
Pn(
Pfindur(6,
Pseed(Pn(Plazy({~seed}),inf),
Pbind(
\instrument, \fm,
\legato, Pfunc({rrand(0.01,1.0)}),
\atk, 0.02,
\gainEnv, Pfunc{|e|
var rel = (1 - e.atk);
Env.perc(e.atk, rel);
},
\durMul, 0.5, //multiply duration
\dur, Pkey(\durMul) * (Pn(Plazy{ Pstutter(Pseq(a.repetitions,1), Pseq(a.durations,1)) },inf)),
\octave, Pstutter(3, Pseq([3,4,5], inf)),
\scale, Scale.minor(\just),
\degree, Pn(Plazy{ Prout {
a.notes.do{
arg note,i;
var repetitions = a.repetitions.wrapAt(i);
repetitions.do {
arg j;
(note + a.motif.wrapAt(j)).yield};
}
}}, inf,
),
//Buchla LPG Parameters
\lpgoffset, Pfunc({LFSaw.kr(0.1).range(0.0,0.1)}),
\lpgfilterscale, Pfunc({LFNoise2.kr(0.1).range(0.4,0.95)}),
\vcaness, Pfunc({LFNoise2.kr(1).unipolar}),
\res, 1.1,
//FM Parameters
\ratio3, 0,
\ratio2, 0,
\ratio1, 0,
\ratio6, 0.251,
\ratio5, 0,
\ratio4, 0,
\mInd3, 1.462,
\mInd2, 1.938,
\mInd1, 2.873,
\mInd6, 1.065,
\mInd5, 1.793,
\mInd4, 3.283,
\amp3, 0.629,
\amp2, 0.241,
\amp1, 0.288,
\amp6, 0.780,
\amp5, 0.034,
\amp4, 0.433,
\fb, 0.9,
\amp, 0.75,
\pan, Pwhite(-0.75,0.75,inf),
\out, 0,
),
),
), inf
),
).play(t, quant:1);
)
```