SuperCollider

From Noah.org
Jump to navigationJump to search


Record Microphone into a buffer for later processing

// IXI tutorial #4
// Record into an 8 second mono buffer.
b = Buffer.alloc(s, 44100 * 8.0, 1);
(
SynthDef(\recBuf,{ arg out=0, bufnum=0;
	var in;
	in = AudioIn.ar(1);
	RecordBuf.ar(in, bufnum);
}).load(s);
)

// record into the buffer
x = Synth(\recBuf, [\out, 0, \bufnum, b.bufnum]);
x.free;

// play it back using the playBuf synthdef created above
z = Synth(\playBuf, [\bufnum, b.bufnum])
z.free;

// save buffer to disk as an AIFF soundfile.
b.write("myBufRecording.aif", "AIFF", 'int16');