forked from gilesbowkett/archaeopteryx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
harmonic_cycle.rb
57 lines (53 loc) · 2.25 KB
/
harmonic_cycle.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
$clock.bpm = 30
$mutation = L{|measure| true}
$measures = 4
next_midi_note_number = OCTAVES[3].to_a[SCALE[CIRCLE_OF_FOURTHS.next]]
puts next_midi_note_number
def note(midi_note_number)
Note.create(:channel => 2,
:number => midi_note_number,
:duration => 3.00,
:velocity => 100 + rand(27))
end
notes = []
notes << Drum.new(:note => note(next_midi_note_number),
:when => L{|beat| false},
# :number_generator => L{0.9},
:next => L{|queue| queue[queue.size - 1]},
:number_generator => L{rand},
# :next => L{|queue| queue[rand(queue.size)]},
:probabilities => [1.0] + [0.0] * 15)
notes
#
#
# probabilities = {}
#
# probabilities[36] = [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0]
# probabilities[37] = [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# probabilities[38] = [0.2, 0.0, 0.3, 0.0, 0.3, 0.1, 0.3, 0.4, 0.0, 0.0, 0.2, 0.0, 0.4, 0.0, 0.0, 0.0]
# probabilities[39] = [0.3, 0.0, 0.2, 0.6, 0.1, 0.0, 0.4, 0.1, 0.35, 0.15, 0.0, 0.0, 0.2, 0.0, 0.1, 0.0]
# probabilities[40] = [0.0, 0.0, 0.2, 0.0, 0.4, 0.0, 0.0, 0.0, 0.2, 0.0, 0.3, 0.0, 0.3, 0.1, 0.3, 0.4]
# probabilities[41] = [0.76, 0.0, 0.23, 0.0, 0.0, 0.0, 0.67, 0.0, 0.15, 0.0, 0.15, 0.0, 0.49, 0.0, 0.15, 0.0]
# probabilities[42] = [0.75, 0.0, 0.13, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.13, 0.0, 0.23, 0.0, 0.0, 0.35, 0.0]
# probabilities[43] = [0.9] * 16
# probabilities[44] = [0.65] * 16
# probabilities[45] = [0.85, 0.35] * 8
#
# def note(midi_note_number)
# Note.create(:channel => 2,
# :number => midi_note_number,
# :duration => 0.25,
# :velocity => 100 + rand(27))
# end
#
# notes = []
# (36..45).each do |midi_note_number|
# notes << Drum.new(:note => note(midi_note_number),
# :when => L{|beat| false},
# # :number_generator => L{0.9},
# :next => L{|queue| queue[queue.size - 1]},
# :number_generator => L{rand},
# # :next => L{|queue| queue[rand(queue.size)]},
# :probabilities => probabilities[midi_note_number] || probabilities[:none])
# end
# notes