Superdirt audio 'in' - number of input channels

[mod - split from this topic: Multisampled Instruments]
Quite interesting, is there a way to specify the input you want, i.e. is it possible to have multi-channels inputs at the same time ?

I would hope in:0 etc., but I am not sure.

In my default installation, Supercollider has two input ports (shown as in_1, in_2 in qjackctrl) but it seems that they'll be treated as one (stereo) entity.

I guess the number (and names?) of ports is configurable, https://github.com/musikinformatik/SuperDirt/blob/develop/superdirt_startup.scd#L16 http://doc.sccode.org/Classes/ServerOptions.html#-numInputBusChannels

[EDIT] when I put s.options.numInputBusChannels = 4 in startup.scd (and restart sc), there are indeed 4 input ports, but I cannot address in_3, in_4 from Tidal.

Unfortunately the SynthDef "in" doesn't work that way because it is defined under default-synths.scd with sound = SoundIn.ar([0, 1]); in superdirt.
This means that SuperCollider automatically listens on the first two input ports and always considers both, even if only one port has an input signal.
But you can copy the SynthDef definition and adjust the SoundIn. To do so, you can enter a fixed value in SoundIn and rename the synthdef or/and you can define a parameter (e.g. in=0) which you can use in tidalcycles once it is defined like

input = pI "in"

The modified synthef could look like this in SuperCollider:

(
SynthDef(\in2, { |out, sustain = 1, pan, inputFadeTime = 0.03, in = 0|
	var env, sound;
	env = Env.linen(inputFadeTime, sustain - (2 * inputFadeTime), inputFadeTime).kr;
	sound = SoundIn.ar(in); // mono in
	sound = sound * env;
	Out.ar(out,
		DirtPan.ar(sound, ~dirt.numChannels, pan)
	)
}).add
);

In TidalCycles you can then use patterns to control which input ports should be used, i.e.

d1 $ s "in2" # input "<0 1 2 3>"

6 Likes

AMAZING! Thank you this is exactly what I was looking for!! I'll give it a try this weekend.

1 Like

@mrreason amazing info! @yaxu could you perhaps move this information to a separate thread with a better heading (e.g., "extra audio input channels"). I guess it's my fault, I added this topic mid-flight.

Sure, done!

I've added a new parameter to the in synth, called soundin, so you can select the bus offet for audio in. And also an instrument in1, which is mono.

But yes, the idea is that you can simply add your own SynthDefs for any number of channels etc.

(I called the parameter soundin because I want to keep in for potential internal routing between busses)

5 Likes

I couldn't get soundin to work, ie:
d1 $ s "in" # soundin "4"

I updated my quark package to 1.1.4 and used this code (because I was getting an error before running this): let soundin = pF "soundin"

Am I missing something @julian?

I created a SynthDef for stereo inputs with sound = SoundIn.ar([4, 5]) and that works btw.
Let me know thanks.

I've pushed it to develop, so 1.1.4 won't have it.

Yes, these kind of hacks are really also the way to go, you should be able to change most things on the fly.

But because it seemed generally useful, I've added it to default.

Ah okay. So this is planned for 1.1.5?

Thanks.

yes, but you could also just try and checkout the develop branch if you like.

1 Like