wallace
2014-10-08 19:45:52 UTC
Hi,
I am working on building a simple sampler that plays a samples with a
random starting point.
here is my SynthDef:
SynthDef(\randomSample, { |out = 0, bufnum, start = 0, time = 1, amp = 1|
var sig = PlayBuf.ar(1, bufnum, startPos: (start *
BufDur.kr(bufnum)).poll, loop: 0),
env = EnvGen.kr(Env.linen(0.01, time, 0.05, level: amp),
doneAction: 2);
Out.ar(out, (sig * env) ! 2)
}).add;
and here how i play it:
Synth(\oneLoop, [\bufnum, b, \time, 0.2, \start, rrand(0.0,1.0)];
The number I poll makes but the sample has always been played from the
beginning.
Can anyone explain me why?
Best,
Marcello
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
I am working on building a simple sampler that plays a samples with a
random starting point.
here is my SynthDef:
SynthDef(\randomSample, { |out = 0, bufnum, start = 0, time = 1, amp = 1|
var sig = PlayBuf.ar(1, bufnum, startPos: (start *
BufDur.kr(bufnum)).poll, loop: 0),
env = EnvGen.kr(Env.linen(0.01, time, 0.05, level: amp),
doneAction: 2);
Out.ar(out, (sig * env) ! 2)
}).add;
and here how i play it:
Synth(\oneLoop, [\bufnum, b, \time, 0.2, \start, rrand(0.0,1.0)];
The number I poll makes but the sample has always been played from the
beginning.
Can anyone explain me why?
Best,
Marcello
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/