I’m a little confused what i am doing wrong here. I have two synths, one will play (very short parts of) samples, the other is a temporary synth (here just playing sine tones to test sequencing). no matter what i do only the sample player plays. am i using pseq incorrectly here? I can get what I want working with a Tdef (at the bottom) but I would like to be able to algorithmically generate phrases of x number of synths and doing this with Patterns. Below are the synths, further down the not working Pseq version, and below that the Tdef version. What am I doing wrong with Patterns here?
P.S. the busses (for amplitude and duration of synth playback) are in a different file and left out here.
//Same for both
s.boot;
~monologue = Buffer.read(s, "FILEPATH" );
(
SynthDef(\slicePlayer, { |ampControl=0, gate=1, out=0, bufnum=0, start=0, len=0.3|
var sig, env, amp;
amp = In.kr(ampControl, 1);
env = EnvGen.kr(Env.perc(0.005, len*0.9), gate, doneAction:2);
sig = PlayBuf.ar(1, bufnum, 1.0, startPos:start, loop:0);
Out.ar(out, sig * amp * env);
}).add;
SynthDef(\sineTest, { |ampControl=0, gate=1, out=0, dur=0.2, freq=440|
var sig, env, amp;
amp = In.kr(ampControl, 1);
env = EnvGen.kr(Env.perc(0.005, dur*0.9), gate, doneAction:2);
sig = SinOsc.ar(freq) * amp * env;
Out.ar(out, sig);
}).add;
);
Patterns (not working, only first synth plays)
(
Pdef(\gesture, Pseq([
// Slice
Pbind(
\instrument, \slicePlayer,
\bufnum, ~monologue,
\ampControl, ~twisterBusses[0],
\maxLenBus, ~twisterBusses[4],
\len, Pfunc({ |ev|
var knob = ev[\maxLenBus].getSynchronous ?? 0.5;
rrand(0.22, 0.8 + (knob * 5.0));
}),
\delta, Pfunc({ |ev| ev[\len] + 0.18 }),
\start, Pfunc({ |ev|
var safe = ~monologue.numFrames - (ev[\len] * ~monologue.sampleRate * 1.2);
rrand(0, safe.asInteger.max(0));
})
),
// Sine
Pbind(
\instrument, \sineTest,
\ampControl, ~twisterBusses[1],
\freq, Pwhite(120, 1400, inf),
\dur, Pwhite(0.25, 0.9, inf),
\delta, Pkey(\dur) + 0.25
)
], inf)
);
)
Pdef(\gesture).play;
Pdef(\gesture).stop;
Tdef
(
Tdef(\gesture, {
var sliceDur, sineDur;
loop {
sliceDur = rrand(0.22, 0.8 + (~twisterBusses[4].getSynchronous ?? 0.5 * 5.0));
sineDur = rrand(0.2, 0.6 + (~twisterBusses[5].getSynchronous ?? 0.5 * 4.0));
// Slice
Synth(\slicePlayer, [
\ampControl, ~twisterBusses[0],
\bufnum, ~monologue,
\start, rrand(0, (~monologue.numFrames * 0.8).asInteger),
\len, sliceDur,
\gate, 1
]);
sliceDur.wait;
// Sine
Synth(\sineTest, [
\ampControl, ~twisterBusses[1],
\freq, rrand(120, 1400),
\dur, sineDur,
\gate, 1
]);
sineDur.wait;
}
}).play;
)
// Stop
Tdef(\gesture).stop;