SHARE
TWEET

Untitled

a guest Feb 3rd, 2018 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.   (
  3.   SynthDef(\help_playbuf, { | out=0, bufnum = 0, rate = 1, startPos = 0, amp = 0.1, sustain = 1, pan = 0, loop = 1|
  4.       var audio;
  5.       rate = rate * BufRateScale.kr(bufnum);
  6.       startPos = startPos * BufFrames.kr(bufnum);
  7.  
  8.       audio = BufRd.ar(1, bufnum, Phasor.ar(0, rate, startPos, BufFrames.ir(bufnum)), 1, 1);
  9.       audio = EnvGen.ar(Env.sine, 1, timeScale: sustain, doneAction: Done.freeSelf) * audio;
  10.       audio = Pan2.ar(audio, pan, amp);
  11.       OffsetOut.ar(out, audio);
  12.   }).add;
  13.  
  14.   a = Pproto({
  15.       ~newgroup = (type: \group).yield;
  16.       ~sf1 = (type: \allocRead, path: "/path/to/sample.wav").yield;
  17.   },
  18.       Pbind(*[
  19.           instrument:    \help_playbuf,
  20.           dur:        Pseg([0,0,0.25,0.5, 0.75, 1],10).linexp(0,1,0.01,2),
  21.           legato:        4,
  22.           startPos:    Pn(Pseg([0,1], 20), inf),
  23.           rate:        Pwhite(1, 1).midiratio,
  24.           loop:        0,
  25.           group:        Pkey(\newgroup),
  26.           bufnum:        Pkey(\sf1)
  27.       ])
  28.   );
  29.   a.play;
  30.   )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top