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
|
#Sing along with great jubilation and excitement!!
#globals
##keys to switch between. Don't think it will work with
##can work with other keys but transposition might be off
##Probably works best when keys are a fourth apart
keys = [:D4, :A3]
relative = [:minor, :major]
#works well with :mod_square, :mod_saw, etc
use_synth :mod_sine
in_thread do
# locals
idx = 0
deg = 1
rel = relative[0]
define :next_chord do |root|
#minor rules
if rel == relative[0]
if root == 1
return choose([2,3,4,6,7])
end
if root == 2
return 5
end
if root == 3
return choose ([4,6])
end
if root == 4
return choose ([2,5])
end
if root == 5
n=2
n=choose([1,2,6])
if n == 2
idx = 1
rel = relative[1]
return 5
end
return n
end
if root == 6
#also nice with 7 surprisingly!
return choose([4,7])
end
if root == 7
return 3
end
end
##major rules
if rel == relative[1]
if root == 1
n = choose([2,3,4,5,6])
return n
end
if root == 2
#technically iv is not normative,
#but this establishes the key better
#with the D major chord
#plus every progression must have some regression
#to make a convincing plot :)
return choose([4,5])
end
if root == 3
return choose ([4,6])
end
if root == 4
return choose ([1,2,5])
end
if root == 5
n=choose([1,2,6])
if n == 2
idx = 0
rel = relative[0]
return 5
end
return n
end
if root == 6
return 4
end
end
end
with_fx :compressor, amp: 0.7 do
live_loop :infinite_progression do
puts deg
puts keys[idx]
puts rel
4.times do
if deg == 5 and rel == relative[0]
2.times do
play (chord_degree deg, keys[idx], :harmonic_minor, 3), amp: 0.6, sustain: 0.1
sleep 0.5
end
else
play (chord_degree deg, keys[idx], rel, 3), amp: 0.6, sustain: 0.1
sleep 0.5
end
end
deg = next_chord deg
end
end
end
|