Heyho
I want to do the following with:
- a single ~buffer variable with four buffers in an array
- a single synthdef accepting buffers as a parameter
- a single patter allocating the four samples correctly out of a single synthdef allocation
- changing the patter in real time while keep playing and keep everything sync listening to the music properly
looking forwards, kind regards
T.
// raster noton - mit Samples
(
s.waitForBoot {
var make_pat, pat;
var buffer1,buffer2;
~buffers=[
Buffer.read(s, "/media/tmm88/2ED5-246E/grischaL1.wav"),
Buffer.read(s, "/media/tmm88/2ED5-246E/grischaL2.wav"),
Buffer.read(s, "/media/tmm88/2ED5-246E/grischaL3.wav"),
Buffer.read(s, "/media/tmm88/2ED5-246E/grischaL4.wav")
];
SynthDef(\raster, {arg out = 0, amp = 1, bufnum;
var osc = PlayBuf.ar(2, bufnum, doneAction:2);
var env = EnvGen.kr(Env.perc, doneAction: Done.freeSelf);
Out.ar(out, Pan2.ar(osc+FreeVerb.ar(osc)) * env * amp);
}).add;
s.sync;
TempoClock.default.tempo = 164/60;
make_pat = {
| instr_name |
Pxrand([
Pbind(
\instrument, instr_name,
\dur, Pseq([0.75, 0.25, 0.25, 0.25, 0.5], 1),
\legato, Pseq([0.9, 0.3, 0.3, 0.3, 0.3], 1),
\amp, 1, \detune, 1.005
),
Pmono(instr_name,
\dur, Pseq([0.25, 0.25, 0.5], 1),
\amp, 1, \detune, 1.005
),
Pmono(instr_name,
\dur, Pseq([0.25, 0.25, 0.25, 0.75], 1),
\amp, 1, \detune, 1.005
),
Pmono(instr_name,
\dur, Pseq([0.25, 0.5, 0.25, 0.5], 1),
\amp, 1, \detune, 1.005
)
], inf)
};
pat = Ppar([
make_pat.(\raster, \bufnum, ~buffers[0]),
make_pat.(\raster, \bufnum, ~buffers[1]),
make_pat.(\raster, \bufnum, ~buffers[2]),
make_pat.(\raster, \bufnum, ~buffers[3])
], inf);
fork {
wait(thisThread.clock.elapsedBeats - thisThread.clock.beats); // needed if you create many and large patterns to avoid losing the first notes
~player = pat.play(quant:1);
};
}
)