Recording a hardware input (via MixerChannel)

Hi there,

I’m trying to record an external hardware synth’s audio via a MixerChannel (ddw Quark). In what’s probably a user error, the file is created but no audio is recorded. Ie: I get a full length silent file.

Because I’m monitoring the synth through my audio interface, I’m sending the MixerChannel’s output to a silent bus. However, in an earlier experiment, I sent the output to another main ‘2-bus’ MixerChannel, but it still recorded silence, so I don’t think that’s the problem.

I’m not sure what I’m doing wrong. MixerChannel is great, but has outdated documentation, so it’s easy to miss something. But my error could be anywhere really.

Here’s some code to hopefully illustrate…

(
// synthdef for routing mono input
SynthDef(\inputRouter, { |out|
	var sig = In.ar(\in.kr(0), 1);
	Out.ar(out, sig);
}).add;

// mixer channel for mono input (with silent out)
m = MixerChannel(\m, s, 1, 1, 1.0, outbus: 99)
)

(
// start synth (listening to HW input 2)
x = Synth(\inputRouter, [
	\in, 1,
	\out, m.inbus.index
]);
)

m.prepareRecord("~/Desktop/mx-test.wav".standardizePath, "wave", "float")

m.startRecord

// when done
m.stopRecord

(
// clean up
x.free;

MixerChannel.servers[s].values.do(_.free);
)

I’m prone to making silly user errors, so any help or guidance will be much appreciated. Thanks very much.

Jim

When using MixerChannel, synths should be set to the channel’s bus and live within either the mixer’s synthgroup or effectgroup. If you don’t put it in the right group, then order of execution is not guaranteed and you’ll run into problems like this.

MixerChannel has a method play that handles this for you (for SynthDef names and patterns) – in general it’s better to use this, rather than handling the plumbing by yourself. (Also playfx for effect inserts.)

Also I think bus number 1 is likely to be wrong. With default settings, you have two output channels (audio buses 0 and 1) and two input channels (buses 2 and 3). You could choose one of the following ways:

// Option A, using your SynthDef
a = m.play(\inputRouter, [in: s.options.numOutputBusChannels]);

// Option B:
SynthDef(\inputRouter, { |out|
	var sig = SoundIn.ar(\in.kr(0));
	Out.ar(out, sig);
}).add;

// now in = 0 means first input channel, 1 = second channel, so:

a = m.play(\inputRouter, [in: 0]);

hjh

1 Like

@jamshark70, thanks ever so much for the speedy reply!

As you suggested, my problem was indeed the input bus numbers. Using SoundIn.ar fixes that. Embarrassingly, I’d forgotten that SC bus numbers don’t equal the numbers printed on my audio interface.

I’d also forgotten to use MixerChannel’s .play method. In my normal working framework I use a lot of .playfx, but not the .play method, so my leaky OnePole brain had filtered it out. :wink:

It’s working now. Thanks again.
Jim

Glad it worked :grin: and I’m glad to hear that someone is using MixerChannel.

For posterity (in case anyone stumbles across this thread later), multichannel hardware in is different with SoundIn vs In:

In.ar(NumOutputBuses.ir, 2)

SoundIn.ar([0, 1])

Both of those produce the same result (but, not relevant for mono input).

hjh

1 Like

Just to say MixerChannel has become crucial to my workflow. Not just for ‘mixing’ and send FX routing, but also for very simple recording of ‘stems’ for further work in a DAW.

Thanks again for your help and also for the MixerChannel quark.

Jim