«How to Record Multichannel Output in SuperCollider» by Bruno Ruviaro

on 24 Jun'21 14:38 in multichannelmonorecording

This example shows how to record 4 output channels as separate mono files. Also shows how to pick a custom path and file name for the files. File type chosen is "wav" (instead of default "aiff").

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
// ==========================================
// How to Record Multichannel Output in SuperCollider
// ==========================================

// Example - recording 4 output channels *as separate mono files*. 
// Code below also picks a custom path and file name to save them (adjust accordingly to your machine)

// This code sets your SuperCollider Server to 4-channel output
s.options.numOutputBusChannels = 4;
s.reboot;

// You can see the 4 channels here:
s.meter;

// Create 4 recorders (needs to be done just once in a session):
~recs = Recorder.new(s).dup(4)

// START ALL MONO RECORDERS (chans 0, 1, 2, 3)
(
var basicPath = "/home/ruviaro/Desktop/"; // customize this

~recs.do({ arg thisRecorder, index;
	var fileName = "test" ++ index ++ ".wav";
	
	thisRecorder.record(
		path: basicPath ++ fileName,
		bus: index,
		numChannels: 1 // mono
	);
})
)

// Start making some sound (below, 4 channels of sound)
(
{
	var snd;
	snd = LFTri.ar(
		freq: [100, 204, 310, 405],
		mul: LFPulse.ar([1, 2, 3, 4])
	);
	// snd = Splay.ar(snd);
	Out.ar(0, snd * 0.2);
}.play;
)

// Stop all recorders
~recs.do({ arg thisRecorder; thisRecorder.stopRecording })

s.freeAll;

// =====================
// NOTE: if you don't care about recording each channel as a separate mono file, then the code is way simpler.

// Start recording (a single 4-channel file will be saved in the default recordings directory):
s.record(numChannels: 4);

// Stop recording
s.stopRecording;
raw 1523 chars (focus & ctrl+a+c to copy)
reception
comments