2022-01-27

#jamuary jam number 16. A variation of jam 10. Mostly I realised that I had an off-by-one error in my understanding of how degree works. Degree 0 is C in a C major scale, not degree 1 as I thought. So this sounds more major-y. I pitched up the bass and added some delay to make a melody of sorts.

(
var fxBus = Bus.audio(s, 1);

SynthDef(\tri, { |out, freq = 440, gate=1, amp = 0.2, pos=0, dis = 0.1|
  var snd, env;
  env = EnvGen.ar(Env.asr(3, 0.9, 3), gate: gate, doneAction: 2);

  snd = Mix.new([
	LFTri.ar(freq),
	LFTri.ar(freq*(3/2)*1.005),
	BrownNoise.ar(0.2)
  ]);
  snd = CrossoverDistortion.ar(snd, dis);
  snd = LPF.ar(snd, IRand.new(3000,5000));
  snd = snd * env;
  Out.ar(out, Pan2.ar(snd, pos: pos, level: amp));
  Out.ar(fxBus, snd * 0.2);
}).add();

SynthDef(\bass, { |out, midinote=60, t_trig=1, amp=0.2|
	var snd, env;

	snd = MiPlaits.ar(pitch: midinote, engine: 2, harm: 0.1, timbre: 0.5, morph: 0, trigger: t_trig);
	snd = CombC.ar(snd, 1, 0.66, 3);
	Out.ar(out, Pan2.ar(snd, level: amp));
}).add();

SynthDef(\fx, {
	var in = In.ar(fxBus);
	var dens = LFNoise1.kr(0.3).range(0.3, 0.45);
	var size = LFNoise1.kr(2).range(0.2, 0.6);

	var snd = MiClouds.ar(in, 12, 0, size, dens, 0.5, drywet: 0.3, mode: 0, rvb: 0.5);
	Out.ar(0, snd);
}).add();
)

a = Synth.new(\fx, addAction: 'addToTail');

(
Pdef(\c1, Pbind(
  \instrument, \tri,
  \dur, Pseq([8, 8, 8], inf),
  \scale, Scale.major,
  \degree, Pseq([0, 2, 8], inf),
  \legato, 1.1,
  \out, 0,
  \ctranspose, -12,
  \pos, -0.5,
));

Pdef(\c2, Pbind(
  \instrument, \tri,
  \dur, Pseq([4, 3, 2], inf),
  \scale, Scale.major,
  \degree, Pseq([0, \, 2, \, 4], inf),
  \legato, 1.1,
  \out, 0,
  \pos, 0.5,
  \dis, 0.5,
));

Pdef(\bass, Pmono(
	\bass,
	\delta, Pbjorklund(7, 11) ,
	\trig, 1,
	\scale, Scale.major,
	\degree, Pseq([0, 2, 4, 6], inf),
	\out, 0,
	\amp, 0.15,
));
)