Advertisement
Conure

SamplePlayer

Jan 29th, 2020
2,745
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (
  2. Buffer.freeAll;
  3. s.waitForBoot({
  4.     //buffers
  5.     b = Dictionary.new;
  6.     PathName(PathName(thisProcess.nowExecutingPath).pathOnly+/+"buffers").entries.do{
  7.         arg subfolder;
  8.         b.add(
  9.             subfolder.folderName.asSymbol ->
  10.             Array.fill(
  11.                 subfolder.entries.size,
  12.                 {
  13.                     arg i;
  14.                     Buffer.read(s, subfolder.entries[i].fullPath);
  15.                 }
  16.             )
  17.         );
  18.     };
  19.  
  20.     //SynthDefs
  21.  
  22.     SynthDef(\playmono,{
  23.         arg atk=0.001, sus=0.2, rel=0.06, c1=1, c2=(-1),
  24.         buf=0, rate=1, spos=0, amp=1, pan=(-1), out=0;
  25.         var sig, env;
  26.         env = Env([0,1,1,0],[atk,sus,rel],[c1,0,c2]).kr(2);
  27.         sig = PlayBuf.ar(1, buf, rate, startPos:spos);
  28.         sig = sig*env;
  29.         sig = Pan2.ar(sig, pan, amp);
  30.         Out.ar(out, sig);
  31.     }).add;
  32. })
  33. )
  34.  
  35. (
  36. a = Pbind(*[
  37.     instrument: \playmono,
  38.     buf: Pseq(b[\shakers] [(1..6)],inf),
  39.     pan: Pwhite(-1.0,1.0),
  40.     dur: Pkey(\buf).collect(_.duration)+1,
  41.     amp: Pwhite(0.01,0.5),
  42.     out: 0
  43.  
  44. ]).play;
  45. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement