I got those two panning functions for a PanX inside a SynthDef which consists of five summed signals:
~dur = 5;
~panFunc1 = { SinOsc.kr(Env([0.1, 15], ~dur, 4).kr(2)).range(0.0, 1.0).poll(label: "a") };
~panFunc2 = { SinOsc.kr(LFNoise2.kr(5).range(0.1, 0.25), [ 8pi * 1/5, 8pi * 2/5, 8pi * 3/5, 8pi * 4/5, 8pi * 5/5]).range(0.0, 1.0).poll(label: "b") };
How can I pass the first one, then the second one after ~dur
into the pos
argument of PanX.ar?
Here is the Synth:
(
~dur = 29;
~dur2 = 32;
~env = Env([0, 1, 0], [0.5, 0.5], ['wel', 'wel']);
~grainEnv = Buffer.sendCollection(s, ~env.discretize, 1);
SynthDef(\section1_5, {
var env, trigger, sig;
env = Env([0, 1, 1, 0], [0.01, ~dur + ~dur2, 1.0], ['wel']).kr(2);
trigger = Impulse.ar(
Env([0.1, 51.91], [~dur], 9).kr(0) * LFNoise2.kr(20).range(Env([0.01, 1], ~dur, 7).kr(0), Env([5.0, 1.0], ~dur, -7).kr(0))
);
sig = GrainBuf.ar(
numChannels: 1,
trigger: trigger,
dur: 0.03,
sndbuf: [~b_1, ~b_2, ~b_3, ~b_4, ~b5],
rate: 1,
pos: Env([0.0, 0.1, 1.0], [~dur, ~dur2], ['wel']).ar(0),
interp: 4,
pan: 1,
envbufnum: ~grainEnv,
maxGrains: 512
);
sig = PanX.ar(2, sig * env, pos: 0.5, -6.dbamp).sum;
Out.ar(0, sig);
}).play;
)
I unsuccessfully tried to recreate the panning functions with demand rates.
I also wrote it as a Routine
and Task
like this
(
r = Routine({
~panFunc1.play;
~dur.wait;
~panFunc2.play;
});
)
(
t = Task({
~panFunc1.play;
~dur.wait;
~panFunc2.play;
});
)
which I then tried to pass with a 1.do({ r.play; })
or 1.do({ t.play; })
it won’t work either.
Thank you all