Audio recording: multiple channels to multiple files


#1

Hello,
I try for several days to record several channels, each channel in a different soundfile on disk, to process them independently in a third party software.

All the solutions I’ve found so far are in one file. It may be suitable for stereo, but not for multichannel… or I’m wrong?

How would you proceed?


#2

Maybe you have already done so, you’d have to set the number of outbus bus channels, e.g.

s.options.numOutputBusChannels = 8

then reboot.

After that recording (e.g. with the gui you get with s.makeGui) will produce an interleaved multichannel file. IMO it’s easiest to produce an interleaved file and split it with your DAW (e.g. in Reaper “explode multichannel audio” in the item/itemprocessing submenu)


#3

Thank you,
So I followed your advice and I now have 8 audio outputs on server.

// I then created a 3-channel Bus:
~busOut = Bus.audio(s,3);

// Then I created 3 very simple SynthDef:
(
SynthDef(\sin, {|amp=0.3, freq=440|
var env, sig;
env = EnvGen.ar(Env.perc(0.01, 1), doneAction:2);
sig = SinOsc.ar(freq)envamp;
Out.ar(~busOut, sig);
Out.ar(0, sig)
}).add;

SynthDef(\saw, {|amp=0.3, freq=440|
var env, sig;
env = EnvGen.ar(Env.perc(0.01, 1), doneAction:2);
sig = Saw.ar(freq)envamp;
Out.ar(~busOut, sig);
Out.ar(1, sig)
}).add;

SynthDef(\pul, {|amp=0.3, freq=440|
var env, sig;
env = EnvGen.ar(Env.perc(0.01, 1), doneAction:2);
sig = Pulse.ar(freq)envamp;
Out.ar(~busOut, sig);
Out.ar([0,1], sig)
}).add;
)

// …and start recording (s.record(path, bus, numChannels, node, duration):
s.record("~/Sin.aiff", ~busOut, numChannels:3);

//Then the Synths:
(
Synth(\sin);
Synth(\saw);
Synth(\pul);
)

s.stopRecording;

I checked the file in Audacity. There are actually 3 channels, but it seems that all sounds are on the first channel. What is missing to affect the synths to different channels of the sound file?

Thank you for your patience :slight_smile:


#4

You’re sending all three (mono) signals to the same subbus

(
SynthDef(\sin, {|amp=0.3, freq=440|
var env, sig;
env = EnvGen.ar(Env.perc(0.01, 1), doneAction:2);
sig = SinOsc.ar(freq) * env * amp;
Out.ar(~busOut.subBus(0), sig);
Out.ar(0, sig)
}).add;

SynthDef(\saw, {|amp=0.3, freq=440|
var env, sig;
env = EnvGen.ar(Env.perc(0.01, 1), doneAction:2);
sig = Saw.ar(freq) * env * amp;
Out.ar(~busOut.subBus(1), sig);
Out.ar(1, sig)
}).add;

SynthDef(\pul, {|amp=0.3, freq=440|
var env, sig;
env = EnvGen.ar(Env.perc(0.01, 1), doneAction:2);
sig = Pulse.ar(freq) * env * amp;
Out.ar(~busOut.subBus(2), sig);
Out.ar([0,1], sig)
}).add;
)

BTW If you’re doing it like this – via a dedicated recording bus – and you don’t need an additional multichannel output, then you don’t need to increase the number of output bus channels.


#5

Sorry to answer so late, but I did not have internet access for a week (weather accident).

Thank you, I would not have found it alone … and I also understood that I could record directly on the hard drive without going through a bus.

I did a little synthesis on the recording with or without bus, for those who, like me, have trouble finding information:

// +++ RECORDING THROUGH A BUS +++

// create a 3-channels Bus on default server (s):
~busOut = Bus.audio(s,3);

// Then create 3 very simple SynthDef to produce 3 synths to record:
(
SynthDef(\sin, {|amp=0.3, freq=220|
var env, sig;
env = EnvGen.ar(Env.perc(0.01, 1), doneAction:2);
sig = SinOsc.ar(freq)envamp;
Out.ar(~busOut.subBus(0), sig); //subBus(0): first channel of Bus ~busOut
}).add;

SynthDef(\saw, {|amp=0.3, freq=330|
var env, sig;
env = EnvGen.ar(Env.perc(0.01, 1), doneAction:2);
sig = Saw.ar(freq)envamp;
Out.ar(~busOut.subBus(1), sig); //subBus(1): seconde channel of Bus ~busOut
}).add;

SynthDef(\pul, {|amp=0.3, freq=440|
var env, sig;
env = EnvGen.ar(Env.perc(0.01, 1), doneAction:2);
sig = Pulse.ar(freq)envamp;
Out.ar(~busOut.subBus(2), sig);
}).add;
)

// …and start recording (s.record(path, bus, numChannels, node, duration):
s.record("~/3channels2.aiff", ~busOut, numChannels:3);

//Then play the Synths:
(
Synth(\sin);
Synth(\saw);
Synth(\pul);
)

// stop recording
s.stopRecording;

///////////////////////////////////////////////////
//+++ RECORDING DIRECTLY TO THE HARD DRIVE +++

// check number of output bus channels on the server:
s.options.numOutputBusChannels;
// change this number if necessary:
s.options.numOutputBusChannels = 3;

// Create 3 very simple SynthDef to produce 3 synths to record:
(
SynthDef(\sin, {|amp=0.3, freq=220|
var env, sig;
env = EnvGen.ar(Env.perc(0.01, 1), doneAction:2);
sig = SinOsc.ar(freq)envamp;
Out.ar(0, sig); //channel 0
}).add;

SynthDef(\saw, {|amp=0.3, freq=330|
var env, sig;
env = EnvGen.ar(Env.perc(0.01, 1), doneAction:2);
sig = Saw.ar(freq)envamp;
Out.ar(1, sig); //channel 1
}).add;

SynthDef(\pul, {|amp=0.3, freq=440|
var env, sig;
env = EnvGen.ar(Env.perc(0.01, 1), doneAction:2);
sig = Pulse.ar(freq)envamp;
Out.ar(2, sig); //channel 2
}).add;
)

// …and start recording (s.record(path, bus, numChannels, node, duration):
s.record("~/3channels3.aiff", 0, numChannels:3);

//Then play the Synths:
(
Synth(\sin);
Synth(\saw);
Synth(\pul);
)

// stop recording
s.stopRecording;

Thank you again for your help,