RedOverdub overdub recording
see also: RedLive RedTapeRecorder
*ar(buffer, in, gate, fb, atk, rel, rate)
*kr(buffer, in, gate, fb, atk, rel, rate)
buffer - which buffer to use.
in - sound to record. note that the number of channels must match the buffer's number of channels.
gate - 1 starts recording sound into the buffer. 0 stops.
fb - scales the previous sound in the buffer.
fb= 1 will just add the new sound to what is previously there.
fb= 0.5 will scale the previous sound down 50%.
fb= 0 will completely erase any sound previously recorded.
atk and rel sets the envelope of the recording.
rate controls the playbackrate.
//--
s.boot;
b= Buffer.alloc(s, 44100*3, 2);
//click button to overdub sound
a= {RedOverdub.ar(b, SoundIn.ar([0, 1]), MouseButton.kr)}.play;
a.free;
//setting feedback and rate - click mouse to overdub
a= {|fb= 1, rate= 1| RedOverdub.ar(b, SoundIn.ar([0, 1]), MouseButton.kr, fb, rate:rate)}.play;
a.set(\fb, 0.7) //leave 70% of the sound in the buffer
a.set(\fb, 0) //completely erase what is in the buffer
a.set(\rate, 0.9)
a.set(\rate, -0.8)
a.free
b.free
//also works in control rate
b= Buffer.alloc(s, 1000, 1);
a= {|fb= 1, rate= 1| SinOsc.ar(RedOverdub.kr(b, SinOsc.kr(0.1).exprange(100, 1000), MouseButton.kr, fb, rate:rate), 0, 0.2)!2}.play;
a.set(\fb, 0.8)
a.free
b.free