-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomposition.rb
81 lines (67 loc) · 1.61 KB
/
composition.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
define :initTrackStates do |n|
array = [0]
(n - 1).times do
array += [0]
end
return array
end
define :random_choice do |n, states|
indexes = []
(0..states.length).each do |index|
if states[index] == n
indexes.push(index)
end
end
target = indexes.shuffle[0]
return target
end
TRACK_NUM = 3
states = initTrackStates(TRACK_NUM)
choices = (0..states.length-1).to_a.shuffle
n = 0
bds = [:bd_ada, :bd_boom, :bd_fat, :bd_gas, :bd_haus, :bd_klub, :bd_mehackit, :bd_pure, :bd_sone, :bd_tek, :bd_zome, :bd_zum]
sds = [:drum_snare_hard, :drum_snare_soft, :elec_filt_snare, :elec_hi_snare, :elec_lo_snare, :elec_mid_snare, :elec_snare, :perc_snap, :perc_snap2, :sn_dolf, :sn_dub, :sn_generic, :sn_zome]
hhs = [:hh, :drum_cymbal_closed, :hhchirp, :hh909]
nums = [0,0,0]
be = 0
use_bpm 100
live_loop :bd do
puts states
if be % 8 == 0
# if n < states.length
# states[choices[n]] = 1
# puts states[choices[n]], 'add'
# n += 1
# end
if states.count(1) >= 2
if one_in(4)
target = random_choice(1, states)
states[target] = 0
nums[target] = rand_i(4)
end
end
if states != [1,1,1]
if one_in(2)
target = random_choice(0, states)
states[target] = 1
end
end
end
be += 1
sample bds[nums[0]], amp: states[0]
sleep 1
end
live_loop :hh do
sync :bd
sample hhs[nums[1]], amp: states[1]
sleep 0.2499
sample hhs[nums[1]], amp: states[1]
sleep 0.2499
end
live_loop :sd do
sync :bd
sleep 0.5
r = choose(chord(:E3, :madd13))
sample sds[nums[2]], amp: states[2]
sleep 0.2499
end