I would do something like this. (This assumes the buffers have their own envelopes. It's not too hard to apply an EnvGen, though.)
SynthDef(\bufpool, { |out, bufsUsed = 1, minPause = 0.2, maxPause = 1.2|
// max 10 bufs, increase for more
// maximum number of buffers MUST be hardcoded
var bufnums = \bufnums.kr(0 ! 10),
trig = LocalIn.kr(1), // loop start
buf = Select.kr(TRand.kr(0, bufsUsed - 0.01, trig), bufnums),
sig = PlayBuf.ar(1, buf, /*rate, startPos,*/ trigger: trig, loop: 0),
bufDone = Done.kr(sig),
pause = TRand.kr(minPause, maxPause, bufDone);
LocalOut.kr(TDelay.kr(bufDone, pause)); // loop end
// sig = (other processing);
sig = sig * 0.1;
Out.ar(out, sig ! 2)
}).memStore;
b = "/Users/dewdrop/sounds/drums/606/*.aiff".pathMatch.collect { |path|
Buffer.readAndQuery(s, path);
};
a = Synth(\bufpool, [bufsUsed: b.size, bufnums: b]);
a.free;
hjh
On Jul 24, 2009, at 12:20 AM, Philip Galanter wrote:
Well, I think so.
Just to provide context, these are fixed position sounds in a virtual environment. I already have control for loudness and surround placement based on the position of a virtual observer. The observer position is sent to each synth via an OSC message. Each synth knows its (unchanging) position and the current observer position and calculates it's own loudness and surround angle.
If I went the pattern route, which might actually work now that I think about it a bit more, how would a new synth know the last OSC message? I wouldn't want every new synth to be in the wrong place until a new OSC message was received a fraction of a second later.
Phil
On Jul 23, 2009, at 11:06 PM, Josh Parmenter wrote:
Do you always want to play the entire sample?
josh
On Jul 23, 2009, at 8:57 PM, Philip Galanter wrote:
There is some other stuff going on now, and I have code that does the other things I need...but that code uses an oscillator synth rather than a sample based synth. I had thought as the final step I could simply replace the oscillator based synth with a synth that plays a series of random samples and I'd be done. If I can't do that then I have to change a number of other things as well.
Is there a way to use the sample end to trigger a delay, and then at the end of that delay trigger playBuf again?
Phil
On Jul 23, 2009, at 10:41 PM, Josh Parmenter wrote:
It is more difficult to envelope it off though.
Josh
On Jul 23, 2009, at 8:13 PM, Andrew C. Smith wrote:
Yeah, the basic advantage to triggering individual synths is just that
you have that extra downtime where the synth isn't eating your CPU.
Also, if you free the pattern (in case you later decide that you DO
want to fade things out) it won't click the synth off but rather will
just not instantiate a new one.
******************************************
/* Joshua D. Parmenter
“Every composer – at all times and in all cases – gives his own interpretation of how modern society is structured: whether actively or passively, consciously or unconsciously, he makes choices in this regard. He may be conservative or he may subject himself to continual renewal; or he may strive for a revolutionary, historical or social palingenesis." - Luigi Nono
*/
_______________________________________________
sc-users mailing list
_______________________________________________
sc-users mailing list
******************************************
/* Joshua D. Parmenter
“Every composer – at all times and in all cases – gives his own interpretation of how modern society is structured: whether actively or passively, consciously or unconsciously, he makes choices in this regard. He may be conservative or he may subject himself to continual renewal; or he may strive for a revolutionary, historical or social palingenesis." - Luigi Nono
*/
_______________________________________________
sc-users mailing list
_______________________________________________
sc-users mailing list