2 summary:: Buffer reading oscillator.
3 related:: Classes/BufWr
4 categories:: UGens>Buffer
9 Read the content of a buffer at an index.
11 In comparison to link::Classes/PlayBuf:: :
12 PlayBuf plays through the buffer by itself, BufRd only moves its read point by the phase input and
13 therefore has no pitch input. BufRd has variable interpolation.
20 Number of channels that the buffer will be. This must be a fixed
21 integer. The architechture of the SynthDef cannot change after it
24 If you supply a code::bufnum:: of a buffer that has a
25 different code::numChannels:: then you have specified to
26 the BufRd, it will fail silently.
30 The index of the buffer to use.
33 Audio rate modulateable index into the buffer.
34 Warning:: The phase argument only offers precision for addressing 2**24 samples (about 6.3 minutes at 44100Hz). ::
37 1 means true, 0 means false. This is modulateable.
40 argument::interpolation
41 1 means no interpolation, 2 is linear, 4 is cubic interpolation.
44 private:: init, argNamesInputsOffset, checkInputs
51 // read a whole sound into memory
53 // note: not *that* columbia, the first one
54 b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
57 //use any AUDIO rate ugen as an index generator
59 { BufRd.ar(1, b, SinOsc.ar(0.1) * BufFrames.ir(b)) }.play;
60 { BufRd.ar(1, b, LFNoise1.ar(1) * BufFrames.ir(b)) }.play;
61 { BufRd.ar(1, b, LFNoise1.ar(10) * BufFrames.ir(b)) }.play;
62 { BufRd.ar(1, b, LFTri.ar(0.1) + LFTri.ar(0.23) * BufFrames.ir(b)) }.play;
64 { BufRd.ar(1, b, LFSaw.ar(BufDur.ir(b).reciprocal).range(0, BufFrames.ir(b)) ) }.play;
67 //use a phasor index into the file
69 { BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;
72 //change rate and interpolation
74 x = { arg rate=1, inter=2;
75 BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b) * rate, 0, BufFrames.kr(b)), 1, inter)
85 //write into the buffer with a BufWr
89 in = SinOsc.ar(LFNoise1.kr(2, 300, 400), 0, 0.1);
90 BufWr.ar(in, b, Phasor.ar(0, BufRateScale.kr(b) * rate, 0, BufFrames.kr(b)));
95 //read it with a BufRd
98 BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b) * rate, 0, BufFrames.kr(b)))
105 y.set(\rate, 2.0.rand);