-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsalsa.rb
179 lines (146 loc) · 2.69 KB
/
salsa.rb
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
use_bpm 165
open_conga = "~/Desktop/samples/other/open_conga.wav"
heel_conga = "~/Desktop/samples/other/heel_conga.wav"
slap_conga = "~/Desktop/samples/slap_conga.wav"
tip_conga = "~/Desktop/samples/other/tip_conga.wav"
conga_pattern = "htsthtoohtsthtot"
conga_samples = {
"o" => open_conga,
"s" => slap_conga,
"t" => tip_conga,
"h" => heel_conga,
}
# [0,1,2]
# [3] =/> nil
# [3] => 0
define :tumbao do
hits = conga_pattern.each_char.map{ |c| conga_samples[c] }.ring
sample hits.tick, amp: 1
sleep 0.5
end
define :clave do
sleep 1
[1, 2, 1.5, 1.5, 1].each do |d|
with_fx :reverb, room: 0.9 do
sample :perc_snap, rate: 0.4, amp: 1
sleep d
end
end
end
define :closed_cowbell do
2.times do
sample :drum_cowbell, rate: 1.0
sleep 2
sample :drum_cowbell, rate: 1.0
sleep 2
end
end
define :montuno_chords do
use_synth :sine
chords = [[:D3, :minor7], [:G3, "7"], [:C3, :major7], [:C3, :major7]]
.map { |c| chord(c.first, c.last) }
chords.each do |c|
play c, release: 4, amp: 2.5
sleep 4
end
end
# montuno by carlos campos
define :montuno_melody do
use_synth :sine
amp = 1
play [:C4, :C5, :C6], amp: amp
sleep 1
play [:F4, :A4, :F5, :A5], amp: amp
sleep 0.5
play [:C4, :C5, :C6], amp: amp
sleep 1
play [:C4, :C5, :C6], amp: amp
sleep 1
play [:B3, :B4, :B5], amp: amp
sleep 1
play [:F4, :A4, :F5, :A5], amp: amp
sleep 1
play [:B3, :B4, :B5], amp: amp
sleep 1
play [:F4, :A4, :F5, :A5], amp: amp
sleep 1
play [:B3, :B4,:B5], amp: amp
sleep 0.5
play [:B3, :B4,:B5], amp: amp
sleep 1
play [:E4, :G4,:E5, :G5], amp: amp
sleep 0.5
play [:B3, :B4,:B5], amp: amp
sleep 1
play [:B3, :B4,:B5], amp: amp
sleep 1
play [:A3, :A4,:A5], amp: amp
sleep 1
play [:E4, :G4, :E5,:G5], amp: amp
sleep 1
play [:A3, :A4,:A5], amp: amp
sleep 1
play [:B3, :B4,:B5], amp: amp
sleep 1
play [:C4,:C5,:C6], amp: amp
sleep 0.5
end
define :timbales do
[1, 0.5, 1, 1, 0.5, 1, 1, 0.5, 1, 0.5].each do |s|
sample :perc_impact2, rate: 3, amp: 0.5
sleep s
end
end
def sleep_for(n)
sleep n * 8
end
@first_time = true
live_loop :heartbeat do
8.times do
sample :bd_haus, amp: 1 if @first_time
sleep 1
end
@first_time = false
cue :one
end
in_thread do
sync :one
loop do
clave
end
end
in_thread do
sync :one
sleep_for(2)
loop do
tumbao
end
end
in_thread do
sync :one
sleep_for(4)
loop do
closed_cowbell
end
end
in_thread do
sync :one
sleep_for(4)
loop do
timbales
end
end
in_thread do
sync :one
sleep_for(0)
loop do
montuno_chords
end
end
in_thread do
sync :one
sleep_for(6)
loop do
montuno_melody
end
end