SuperCollider

From Noah.org
Revision as of 12:46, 1 July 2016 by Root (talk | contribs) (Created page with "Category: Engineering Category: Audio == Record into a buffer for later processing == <pre> // IXI tutorial #4 // Record into an 8 second mono buffer. b = Buffer.allo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Record 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');