

(
// synthdefs

SynthDef(\x44y, {
	arg out=0, gate=1, amp=0.9;
	var snd, env;
	env = Linen.kr(gate, releaseTime: 0.001, doneAction:2);
	snd = Pulse.ar([1234,2345,3456,4567,5678,8912,11023] * LFNoise0.ar(freq:Array.fill(7, {rrand(1,10)})).range(0.8,1.2), mul:0.2).sum;
	snd = snd + WhiteNoise.ar(0.2);
	snd = HPF.ar(snd, 8000);
	//snd = snd * LFSaw.kr(0.5,iphase:1).exprange(0.00001,1);
	snd = snd * amp * env;
	snd = snd.dup;
	Out.ar(out, snd);
}).add;


SynthDef(\h991, {
	arg out=0, freq=90, gate=1, amp;
	var snd, env, cfof;

	env = Linen.kr(gate, doneAction:2);

	freq = freq * XLine.ar(1,0.4, 5);
	snd = SinOsc.ar(freq);
	snd = BHiPass4.ar(snd, 40);
	snd = snd + LPF.ar(Pulse.ar([freq, freq*1.01], 0.01, mul:0.4), freq * 32);
	snd = snd + (LFTri.ar([freq*1.01,freq]) + SinOsc.ar(freq, mul:10).max(-0.5).min(0.5)).clip2(0.5);
	snd = snd + Pulse.ar(freq, mul:0.2);
	snd = snd + Impulse.ar(freq, mul:2);
	//cfof = Demand.kr(Impulse.kr(2), 0, Dseq([1,2,3,4,6,8]));
	cfof = Demand.kr(Impulse.kr(2), 0, Dxrand([1,2,4,6,8,16],inf));
	snd = BLowPass4.ar(snd, SinOsc.kr(cfof).range(300,LFNoise1.kr(1).range(1000,10000)), rq:0.9);

	snd = snd * -9.dbamp;
	snd = snd * env * amp;
	snd = Splay.ar(snd);
	Out.ar(out,snd);
}).add;

)

// play

(
Pbindef(\h991p, *[
	instrument: \h991,
	dur: 4,
	octave: 3,
	legato: 0.89,
	amp: 1
])
)
Pdef(\h991p).quant = 4;
Pdef(\h991p).play;

(
Pbindef(\x44yp,	* [
	instrument: \x44y,
	dur: 1/8,
	legato: Pseq([Pn(0.1, 2), 0.5, Pn(0.1, 4), 0.5],inf),
	amp: 1,
])
)
Pdef(\x44yp).quant = 4;
Pdef(\x44yp).play;

(
Pdef(\h991p).stop;
Pdef(\x44yp).stop;
)


