2022-01-23

#jamuary jam number 12. Inspired by lightbath’s video using the Mutable Instruments Tides as both an LFO and sound source. This jam uses 4 oscillators tuned to a single chord with some phasing of the repetition lengths of each note (and a dotted 1/8th delay) to create a sort of melody line.

I mapped the volume of each oscillator, the delay send amount and the envelope parameters for each oscillator to the knobs and sliders on my nanoKONTROL2. It was fun practicing and then recording a “take”. I’ve also worked out a fairly nice pattern now for shuffling the MIDI control data around the patch.

(
MIDIClient.init;
MIDIIn.connectAll;

~sliders = Array.fill(8, 0);
~knobs = Array.fill(8, 0);

~sliderBusses = Array.fill(8, { Bus.control(numChannels: 1) });
~knobBusses = Array.fill(8, { Bus.control(numChannels: 1) });
~fxBus = Bus.audio(numChannels: 1);

8.do({ |i|
	MIDIdef.cc("slider" ++ i, {|v, nn, chan, src|
		~sliders[nn] = v.linlin(0, 127, 0, 1);
		~sliderBusses[i].set(~sliders[nn]);
	}, i)
});

8.do({ |i|
	MIDIdef.cc("knob" ++ i, {|v, nn, chan, src|
		~knobs[nn-16] = v.linlin(0, 127, 0, 1);
		~knobBusses[nn-16].set(~knobs[nn-16]);
	}, i + 16)
});

4.do({ |i|
SynthDef(\tri++i, { |out, freq = 440, t_trig=1, attack = 0.1, release = 0.1, fx_send = 0, amp|
	var snd, env;
	env = EnvGen.ar(Env.perc(attack, release), gate: t_trig, doneAction: 2);

	snd = Mix.new([
		LFTri.ar(freq),
		PinkNoise.ar(0.2)
		]);
	snd = snd * env;

	Out.ar(out, Pan2.ar(snd * amp));
	Out.ar(~fxBus, snd * amp * fx_send);
}).add();
});

SynthDef(\fx, { |in, out=0|
	var snd = In.ar(in);
	snd = CombC.ar(snd, 1, 0.75, 3);
	Out.ar(out, Pan2.ar(snd));
}).add();

Synth.new(\fx, [\in, ~fxBus], addAction: 'addToTail');
)

(
Pdef(\c0, Pbind(
  \instrument, \tri0,
  \delta, 4,
  \trig, 1,
  \attack, ~knobBusses[0].asMap,
  \release, ~knobBusses[1].asMap,
  \scale, Scale.major(Tuning.just),
  \degree, Pseq([1], inf),
  \amp, ~sliderBusses[0].asMap,
  \fx_send, ~sliderBusses[4].asMap,
  \mtranspose, -7,
));

Pdef(\c1, Pbind(
  \instrument, \tri1,
  \delta, 3,
  \trig, 1,
  \attack, ~knobBusses[2].asMap,
  \release, ~knobBusses[3].asMap,
  \scale, Scale.major(Tuning.just),
  \degree, Pseq([3], inf),
  \amp, ~sliderBusses[1].asMap,
  \fx_send, ~sliderBusses[5].asMap,
  \mtranspose, -7,
));

Pdef(\c2, Pbind(
  \instrument, \tri1,
  \delta, 2,
  \trig, 1,
  \attack, ~knobBusses[4].asMap,
  \release, ~knobBusses[5].asMap,
  \scale, Scale.major(Tuning.just),
  \degree, Pseq([5], inf),
  \fx_send, ~sliderBusses[6].asMap,
  \amp, ~sliderBusses[2].asMap,
));

Pdef(\c3, Pbind(
  \instrument, \tri1,
  \delta, 1,
  \trig, 1,
  \attack, ~knobBusses[6].asMap,
  \release, ~knobBusses[7].asMap,
  \scale, Scale.major(Tuning.just),
  \degree, Pseq([7, 7, 9], inf),
  \fx_send, ~sliderBusses[7].asMap,
  \amp, ~sliderBusses[3].asMap,
));
)