|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
play random samples with PbindHi list,
i'm trying to play random samples from a samplefolder on my computer, and adjust the playback rate, duration etcetera via Pbind. But my code doesn't seem to work properly, i'm getting samples with same settings after a while, so no changes/randomness whatsoever... What am i doing wrong, and is this the way to go? Thanks in advance! ( { y = "~/Desktop/samplefolder/*.wav".pathMatch.collect({ |path| var buf; buf = Buffer.read(s, path); s.sync; buf; }); "done".postln; }.fork; ) y.at(0).play; y.postln; ( SynthDef(\playsample, { |bufnum=0, rate=1, amp=1, pan=0;| var sig, env;
sig = PlayBuf.ar(1, bufnum * rate * BufRateScale.kr(bufnum), loop:0, doneAction:2); env = EnvGen.kr(Env([1, 0], [BufDur.kr(bufnum) * rate])); sig = sig * env; sig = Pan2.ar(sig, pan, amp); Out.ar(0, sig); }).store; ) ( Pbind(\instrument, \playsample, \bufnum, Pxrand(y, inf), \amp, Pxrand( [0.1, 0.5, 1.0], inf), \rate, Pxrand( [0.5, 1.0, 2.0], inf), \pan, Pxrand( [-1, -0.5, 0, 0.5, 1], inf) ).play; ) |
|
|
Re: play random samples with PbindI think the problem may be in your SynthDef because you are multiplying the bufnum by the rate and BufRateScale. I also might be misunderstanding the problem.
sw On Sat, Apr 18, 2009 at 2:01 PM, Jeroen van Rijzewijk <supercollidermailinglist@...> wrote:
-- Scott Worthington stwbass@... www.scottworthington.com |
|
|
Re: play random samples with Pbindscott is right about the problem. the only thing not changing was the rate, due the error in the synthdef. below works for me: ( { y = "/System/Library/Sounds/*.aiff".pathMatch.collect({ |path| var buf; buf = Buffer.read(s, path); s.sync; buf; }); "done".postln; }.fork; ) y.at(0).play; y.postln; ( SynthDef(\playsample, { |bufnum=0, rate=1.0, amp=1, pan=0| var sig; sig = PlayBuf.ar(1, bufnum, rate * BufRateScale.kr(bufnum), loop:0, doneAction:2); sig = sig; sig = Pan2.ar(sig, pan, amp); Out.ar(0, sig); }).memStore; ) ( Pbind(\instrument, \playsample, \bufnum, Pxrand(y, inf), \amp, Pxrand( [0.1, 0.5, 1.0], inf), \rate, Pwhite(0.1,8), \dur, Pxrand(Array.geom(13,0.02,1.2),inf), \pan, Pxrand( [-1, -0.5, 0, 0.5, 1], inf) ).play; ) // release all buffers y.do {|e| e.free } Am 18.04.2009 um 20:16 schrieb Scott Worthington: I think the problem may be in your SynthDef because you are multiplying the bufnum by the rate and BufRateScale. I also might be misunderstanding the problem. |
|
|
Re: play random samples with PbindYes you are right.
Thanks for pointing this out to me. Jroen On Apr 18, 2009, at 8:16 PM, Scott Worthington wrote: I think the problem may be in your SynthDef because you are multiplying the bufnum by the rate and BufRateScale. I also might be misunderstanding the problem. |
| Free embeddable forum powered by Nabble | Forum Help |