/usr/share/SuperCollider/HelpSource/Classes/PlayBuf.schelp is in supercollider-common 1:3.6.3~repack-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | class:: PlayBuf
summary:: Sample playback oscillator.
related:: Classes/RecordBuf, Classes/DiskIn, Classes/BufRd
categories:: UGens>Buffer
Description::
Plays back a sample resident in memory.
classmethods::
method::ar, kr
argument::numChannels
Number of channels that the buffer will be. This must be a fixed
integer. The architechture of the SynthDef cannot change after it
is compiled.
argument::bufnum
The index of the buffer to use.
warning::
If you supply a bufnum of a buffer with a differing number of channels
than the one specified in this PlayBuf, it will fail silently.
::
argument::rate
1.0 is the server's sample rate, 2.0 is one octave up, 0.5 is one
octave down -1.0 is backwards normal rateā¦ etc. Interpolation
is cubic.
argument::trigger
A trigger causes a jump to the startPos. A trigger occurs when a
signal changes from negative value to positive value.
argument::startPos
Sample frame to start playback.
argument::loop
1 means true, 0 means false. This is modulateable.
argument:: doneAction
an integer representing an action to be executed when the buffer is finished playing. This can be used to free the enclosing synth, etc. See link::Reference/UGen-doneActions:: for more detail. code::doneAction:: is only evaluated if loop is 0.
Examples::
code::
s.boot // Boot the server, if you need to
// read a whole sound into memory
// note: not *that* columbia, the first one
b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav"); // remember to free the buffer later.
SynthDef(\help_PlayBuf, {| out = 0, bufnum = 0 |
Out.ar(out,
PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), doneAction:2)
)
}).play(s, [\out, 0, \bufnum, b]);
::
In the above example, note how the code::doneAction:2:: causes the synth to free itself when the buffer reaches its end.
Note again that the number of channels must be fixed for the SynthDef. It cannot vary depending on which buffer you use.
code::
// loop is true
SynthDef(\help_PlayBuf, {| out = 0, bufnum = 0 |
Out.ar(out,
PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), loop: 1.0)
)
}).play(s, [\out, 0, \bufnum, b]);
// trigger one shot on each pulse
SynthDef(\help_PlayBuf, {| out = 0, bufnum = 0 |
var trig;
trig = Impulse.kr(2.0);
Out.ar(out,
PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), trig, 0, 0)
)
}).play(s, [\out, 0, \bufnum, b]);
// trigger one shot on each pulse
SynthDef(\help_PlayBuf, {| out = 0, bufnum = 0 |
var trig;
trig = Impulse.kr(XLine.kr(0.1, 100, 30));
Out.ar(out,
PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), trig, 5000, 0)
)
}).play(s, [\out, 0, \bufnum, b]);
// mouse control of trigger rate and startpos
SynthDef(\help_PlayBuf, { arg out=0, bufnum=0;
var trig;
trig = Impulse.kr(MouseY.kr(0.5, 200, 1));
Out.ar(out,
PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), trig, MouseX.kr(0, BufFrames.kr(bufnum)), 1)
)
}).play(s, [\out, 0, \bufnum, b]);
// accelerating pitch
SynthDef(\help_PlayBuf, {| out = 0, bufnum = 0 |
var rate;
rate = XLine.kr(0.1, 100, 60);
Out.ar(out,
PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum)*rate, 1.0, 0.0, 1.0)
)
}).play(s, [\out, 0, \bufnum, b]);
// sine wave control of playback rate. negative rate plays backwards
SynthDef(\help_PlayBuf, {| out = 0, bufnum = 0 |
var rate;
rate = FSinOsc.kr(XLine.kr(0.2, 8, 30), 0, 3, 0.6);
Out.ar(out,
PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum) * rate, 1, 0, 1)
)
}).play(s, [\out, 0, \bufnum, b]);
// zig zag around sound
SynthDef(\help_PlayBuf, {| out = 0, bufnum = 0 |
var rate;
rate = LFNoise2.kr(XLine.kr(1, 20, 60), 2);
Out.ar(out,
PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum) * rate, 1, 0, 1)
)
}).play(s, [\out, 0, \bufnum, b]);
b.free;
::
|