-
Notifications
You must be signed in to change notification settings - Fork 1
/
p.spi.spi
142 lines (122 loc) · 2.68 KB
/
p.spi.spi
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
use_bpm 127.0
# c minor
# C, D, E♭, F, G, A♭, and B♭.
#fin...
# Lots more to do there, progression on the chords required!
def octave(n, oct)
if n
note = SonicPi::Note.new(n)
"#{note.pitch_class}#{oct}"
else
n
end
end
def harp(*args)
params, opts = split_params_and_merge_opts_array(args)
opts = current_midi_defaults.merge(opts)
n, vel = *params
if n
midi n,vel, *(args << {channel: 1})
end
end
def dragon(*args)
params, opts = split_params_and_merge_opts_array(args)
opts = current_midi_defaults.merge(opts)
n, vel = *params
if n
midi n,vel, *(args << {channel: 2})
end
end
live_loop :start do
tick
if spread(1,32).rot(-6).look
# midi :cs3, 65, channel: 6
end
if spread(15,16).look
# midi :c3, (ing 78 62 68 61).look, channel: 6
end
mscore = (ing
# [:c3 :eb4 :G3 :as4]
[:c3 :eb4 :G3 :Bb4]
[:f3 :ab4 :c4]
[:Ab3 :C5 :eb4]
[:ab3 :Bb5 :eb4]
[:c3 :eb4 :G3 :Bb4]
[:f3 :ab4 :c4]
[:Ab3 :D5 :eb4]
[:ab3 :c5 :eb4]
)
#tick_reset_all
score = mscore.look
if spread(1,8).look
midi octave(score[0],3), channel: 3, sus: 4*4
end
puts score
at{
midi score[-1],100, channel: 5, sus: 4
sleep 1/2.0
with_transpose 0{
midi_cc 50, (ing 0 0 127 0).look, channel: 5 #odd...
midi score[-2], channel: 5, sus: 2 #odd...
}
sleep 2.5
midi score[-3], channel: 5, sus: 1
}
at{
sleep 2
midi score[1], 85, channel: 4, sus: 1
sleep 1
midi score[0], 95, channel: 4, sus: 1
}
#end
harp score[0], 100, sus: 3.5
sleep 1
sleep 1
score2 = (ing
[:c2 :C3].choose
[:f4 :c4].choose
[:Ab3 :G4].choose
_).look
if score2 == _
puts :HIT
midi_cc 52, 1.0, channel: 2 #filter
midi [:c5, :eb5, :g5].choose,100, channel: 1, sus: 4+2
else
midi_cc 52, 0.1, channel: 2 #filter
end
with_transpose 12*1{
midi_cc 50, (line 0.9, 1.0, 128).look*127.0, channel: 2
dragon score2, (ing 100 80 70).look, sus: 2.5+2
}
with_transpose 12{
midi mscore.look(offset: 1)[-1], 75, channel: 4, sus: 2
}
sleep 1/2.0
with_transpose 12{
midi mscore.look(offset: 1)[1], 85, channel: 4, sus: 2
}
if spread(1,2).look
# midi :c3, 60, channel: 6
end
sleep 1/2.0
if spread(7,11).look
midi :d3, 75+rand*2.0, channel: 6
else
at{
sleep 1/2.0
midi :e3, 75, channel: 6
}
end
if spread(1,4).look
with_transpose 12{
midi mscore.look(offset: 1)[0], 95, channel: 4, sus: 5
}
end
sleep 1
end
live_loop :control, sync: :start do
tick
midi_cc 51, ((line 0, 1.0, 128).look+(line 1.0, 0.0, 128).look)*127.0, channel: 2 #pulse
midi_cc 52, 0.7, channel: 2 #filter
sleep 1/2.0
end