Hi everyone,
I have to do a simple thing, but unfortunately, I don’t know in which way would be “better”.
I would love to use a SynthDef and a Routine for sequencing.
I need to:
-
Play an audio buffer for a specific amount of time, for example “1/8 - 1/16 - 1-32” the file could be longer or shorter.
-
I would like to been able to playing it once or n times.
-
I would like to play the audio file from the beginning, or to set a specific cue.
What do u suggest?
The structures it could be something like that.
b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
SynthDef(\playThatBuf, {
var snd, windowSize;
snd = // the Buffer player with windowSize
Out.ar(\out.kr(0), snd);
}).add;
(
var s, bpm, beat;
s = Server.default;
bpm = 160;
beat = 60 / bpm;
Routine({
loop {
var subdivisions;
subdivisions = [2, 4, 8, 16].choose;
subdivisions.do { |i|
s.bind { Synth(\playThatBuf, [ windowSize: (beat / subdivisions) ]) };
(beat / subdivisions).wait;
};
};
}).play;
or is it better to have a sampler on the server and to work with .set ?
Routine({
loop {
s.bind { playThatBuf.set() };
};
}).play;
Thanks in advance,
best!