«magic sparkly rainbow!!!!!!<3» by daisystomper

on 13 Aug'21 22:56 in scales sparkly

some scale stuff by a novice-SC lovable unicorn

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
(
s.newBusAllocators;
s.options.numOutputBusChannels = 2;
~reverbBus = Bus.audio(s,2);

s.waitForBoot({

	Buffer.freeAll;
	~scale1 = Buffer.loadCollection(
		s,Scale.new(#[0,7,15.93,5,9.7,12,17.5,13.1],12));

	SynthDef(\rainbow,{
		arg buf, samp=0.2,root=37,atk=0.1,decay=10, amp=0.3;
		var sig, index, tonic, freq, env;
		index = LFSaw.kr(samp).range(\bottom.ir(4),\top.ir(9));
		index = index*BufFrames.kr(buf);
		tonic = DegreeToKey.kr(buf,index)+root;
		freq = tonic.midicps;
		env = EnvGen.ar(Env.perc(atk,decay,0.7,-2),doneAction:2);
		sig = SyncSaw.ar(root.midicps,freq, mul:0.5)*env;
		sig = BPF.ar(sig, \cfreq.kr(1000),\rq.ir(0.3))*amp;
		sig = Pan2.ar(
			sig,
			SinOsc.kr(
				\rate.kr(0.05).range(-0.9,0.9)+{Rand(-0.6,0.6)}),
			\level.kr(1),
		);
		Out.ar(\out.ir(~reverbBus),sig);
	}).add;

	SynthDef(\reverb, {
		arg in=0, out=0, revdecay=5;
		var wet,dry, sig;
		wet = In.ar(~reverbBus,2);
		dry = In.ar(~reverbBus,2);
		wet = CombL.ar(
			wet,
			0.1,
			SinOsc.kr(0.01).range(0.04,0.1),
			revdecay,
			0.7);
		wet = LPF.ar(wet,\lpf.kr(4800));
		sig = XFade2.ar(wet,dry,\mix.kr(0.2),\amp.kr(0.3));
		Out.ar(out,sig);
	}).add;
});

Synth(\reverb,[\mix,-0.5],addAction:'addToTail');

~rainbow = Pbind(
	\instrument, \rainbow,
	\dur, Prand([0.2,1.3],inf),
	\buf, ~scale1,
	\root, Prand([23,30,35,37],inf),
	\amp, Pwhite(0.15,0.5,inf),
	\bottom, Prand([2,5],inf),
	\top, Pwhite(7.0,9.1,inf),
	\samp, Pexprand(0.07,0.5,inf),
	\rate, Pexprand(0.1,3,inf),
	\cfreq, Pseq([
		Pseries(120,30,76),
		Pseries(2400,-30,76),
	],inf),
	\rq, Pkey(\samp)+Pwhite(0.1,0.15,inf).asStream,
	\atk, Pexprand(0.04,0.3,inf),
	\decay, Pexprand(6,15,inf),
	\level, Env(#[0,1,0],#[100,110],'lin'),
	\out, ~reverbBus,
);
~rainbow.play;
)
raw 1797 chars (focus & ctrl+a+c to copy)
reception
comments