«monzos + sloth patch» by eli.rosenkim

on 20 Apr'22 19:37 in just intonationmonzosloth canonfractals

fun patch using sloth canons to control places of a monzo

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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
(
SynthDef.new(\gauss, {
	arg freq = 500, dev = 0, svfFreq = 1000, decay = 0.1, attack = 0.01, k = 0.4, semRatio = 1;
	var sig, env, sigM, sigS;
	freq = freq.lag2(0.01);
	sig = [GaussTrig.ar(freq, dev), GaussTrig.ar(freq, dev)]*10;
	sigM = (sig[0]+sig[1])/2;
	sigS = (sig[0]-sig[1])/2;
	sig = [(sigM+sigS), (sigM-sigS)];
	sigM = VASEM12.ar(sig, svfFreq*semRatio, 1, 0.5);
	sigS = 100.do {sigS = FOS.ar(sigS, k.neg, 1, k);}; //allpass disperser
	sig = SVF.ar(sig, svfFreq, 0.1);
	env = EnvGen.ar(Env.perc(attack, decay), 1, doneAction: 2);
	sig = sig*env/2;
	sig = LeakDC.ar(sig);
	Out.ar(0, sig);
}).add;
)
x = Synth.new(\gauss, [\freq, 1000, \dev, 0, \svfFreq, 1500])
x = Synth.new(\gauss, [\freq, 1000, \dev, 1, \svfFreq, 1500])

(//function that takes a collection representing a monzo as an argument, and outputs the ratio it encodes
~zo = {
	arg exponentCollection;
	var ratio = 1;
	exponentCollection.do({arg item, i; ratio = ratio * (i.nthPrime).pow(item);});
	ratio;
};
)

//pattern
(
s.latency = 0.5;
~func2 = {
	var seed = #[-1,0,1], i=0, temp, temp2 = List[], out;
	temp = seed;
    loop {
		out = temp[((i/3).floor)%temp.size] + seed[i%seed.size];
		out.yield;
		//("o: " ++ out).postln;
		i = i+1;
		temp2.add(out);
		if((i+1) > (temp.size**2), {temp = temp2});
    }
};

~func3 = {
	var seed = #[1,0,-1, 0], i=0, temp, temp2 = List[], out;
	temp = seed;
    loop {
		out = temp[((i/3).floor)%temp.size] + seed[i%seed.size];
		out.yield;
		//("o: " ++ out).postln;
		i = i+1;
		temp2.add(out);
		if((i+1) > (temp.size**2), {temp = temp2});
    }
};

~mutro = {
	var  i = 0, deltas, randos, out, maxStep;
	deltas = List[0.17, 0.17, 0.17, 0.17]; //starting deltas for each beat
	randos = List[0, 0, 0, 0]; //random values for each beat, first bar plays straight as randos are all 0
	maxStep = deltas[0]/10;
	loop{
		out = ((deltas[i] - randos[(i-1)%(deltas.size)] + randos[i]).abs); //if the first beat is pushed back by 0.2s, the second beat is moved forward 0.2s to keep it in roughly the same position before rando is added
		out.yield;
		i = (i+1)%(deltas.size);
		if(i%(deltas.size) == 0, //adds random value to each term of random array on beat one of each bar after bar 1
			{randos = randos.collect({arg item, i; item+(rrand(-1* maxStep, maxStep))})}
			//{"test".postln}
		);
	};
};

~root = 45*4;
w = Pbind(
	\instrument, \gauss,
	\freq,  (~root*~zo.([Prout(~func2), Prout(~func3)])),
	\svfFreq, 999 + Pgauss(0, 55),
	\dev, Prout(~mutro)/4 + Pgauss(0, 0.05),
	\dur, Prout(~mutro)*2,
	\decay, Prout(~mutro)*2 + Pgauss(0, 0.05),
	\attack, Pgauss(0.01, 0.02).max(0.01),
	\k, Prout(~func2).max(0).min(1),
	\semRatio, (Prout(~func2)/Prout(~func3)).abs
).play;

x = Pbind(
	\instrument, \gauss,
	\freq,  (~root*~zo.([Prout(~func3), Prout(~func2)])),
	\svfFreq, 888 + Pgauss(0, 55),
	\dev, Prout(~mutro)/3 + Pgauss(0, 0.05),
	\dur, 3*Prout(~mutro),
	\decay, 3*Prout(~mutro) + Pgauss(0, 0.05),
	\attack, Pgauss(0.01, 0.02).max(0.01),
	\k, Prout(~func2).max(0).min(1),
	\semRatio, (Prout(~func3)/Prout(~func2)).abs
).play;

y = Pbind(
	\instrument, \gauss,
	\freq,  (~root*~zo.([Prout(~func2), Prout(~func3)])),
	\svfFreq, 777 + Pgauss(0, 55),
	\dev, Prout(~mutro)/2 + Pgauss(0, 0.05),
	\dur, 2*Prout(~mutro),
	\decay, 0.5*Prout(~mutro) + Pgauss(0, 0.05),
	\attack, Pgauss(0.01, 0.02).max(0.01),
	\k, Prout(~func2).max(0).min(1),
	\semRatio, (Prout(~func2)/Prout(~func3)).abs
).play;

z = Pbind(
	\instrument, \gauss,
	\freq,  (~root*(4/3)*~zo.([Prout(~func2), Prout(~func3)])),
	\svfFreq, 555 + Pgauss(0, 55),
	\dev, Prout(~mutro) + Pgauss(0, 0.05),
	\dur, 2*Prout(~mutro),
	\decay, Prout(~mutro) + Pgauss(0, 0.05),
	\attack, Pgauss(0.01, 0.02).max(0.01),
	\k, Prout(~func2).max(0).min(1),
	\semRatio, (Prout(~func3)/Prout(~func2)).abs
).play;

{[GaussTrig.ar(freq: 45, dev: 0.1), GaussTrig.ar(freq: 45, dev: 0.1)]/50}.play;
)

s.scope;
raw 3976 chars (focus & ctrl+a+c to copy)
reception
comments