Diffuse interstellar bands

Some generative ambient noise

Here is an extract of the code (with unmet dependencies sorry :confused: ):

(
SynthDef(\ploux, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;
	var sig;
	var dust;
	dust = Dust.ar(\dustfreq.kr(2));
	dust = Decay.ar(dust, \dustdecay.kr(0.7));
	sig = SinOsc.ar(freq * ( SinOsc.ar(\fmfreq.kr(100) * dust) * 1 + 1 ));
	sig = sig * EnvGen.kr(\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);
	sig = Pan2.ar(sig, pan, amp);
	Out.ar(out, sig);
}).add;
);




(
	~crossfade = { arg val, argname=\freq, crossarg=\cross;
		Pfunc({ arg ev; val * ev[crossarg] + ( ev[argname] * ( 1-ev[crossarg] ) ) })
	};
	ProtoDef(\rdn).play;
Pdef(\part, Pdef(\ploux, 
	Ppar([
		Pspawner({ arg sp;
			~startCrossfade = false;
			sp.par(
				Psched(16*2 +8,Pbind(
					\play, {
						"startCrossfade".debug;
						topEnvironment[\startCrossfade] = true;
					},
					\dur, Pn(1,1),
				)),
			);
			20.do {
				sp.par(
					Pseq([
						Pwhile({ "waiting".debug(~startCrossfade); ~startCrossfade.not }, Pfindur(1,Pbind() )),
						//Pfindur(4,Pbind()),
						Pbind(
							\cross, Pseg(Pseq([0,Pn(1,inf)],inf),4),
							\freq, ~crossfade.(100, \freq),
							\dur, ~crossfade.(4, \dur),
						),
					],inf) <>
					Pbind(
						\out, BusDef(\sendbus1, \audio),
						\instrument, \ploux,
						\dustfreq, Pseg(Pseq([0,Pn(0,5),11,11],inf),4),
						\dustdecay, Pseg(Pseq([0,Pn(0,5),11,11],inf),5),
						\fmdecay, Pseg(Pseq({ rrand(40,400) }.dup(5),inf),5),
						\freq, exprand(60,13000),
						\legato, rrand(0.1,0.9),
						\dur, exprand(1/16,4),
						\amp, 0.1,
					),
				);
				sp.wait(4.0.rand);
			}
		})
	])
)).play;
);
1 Like

waow that’s awesome, thanks for sharing