clofresh (owner)

Revisions

gist: 204126 Download_button fork
public
Public Clone URL: git://gist.github.com/204126.git
Embed All Files: show embed
db_drum_definition.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
$clock.bpm = 80
$mutation = L{|measure| true}
$measures = 4
 
 
def note(midi_note_number)
  Note.create(:channel => 2,
              :number => midi_note_number,
              :duration => 1,
              :velocity => 100 + rand(27))
end
 
kick = 36
snare = 38
clap = 39
hihat1 = 42
hihat2 = 69
xylo1 = 41
xylo2 = 43
xylo3 = 45
xylo4 = 47
xylo5 = 48
 
 
probabilities = {}
probabilities[kick] = [1.0, 0.5, 1.0, 0.5] * 4
probabilities[snare] = [0.5] * 16
probabilities[hihat1] = [0.75] * 16
probabilities[hihat2] = [1.0, 0.0] * 8
probabilities[xylo1] = [0.5]*16
probabilities[xylo2] = [0.5]*16
probabilities[xylo3] = [0.5]*16
probabilities[xylo4] = [0.5]*16
probabilities[xylo5] = [0.5]*16
probabilities[clap] = [0.0, 1.0]*8
 
 
notes = [
    Drum.new(:note => note(kick),
                    :when => L{|beat| false},
                    :number_generator => L{rand},
                    :next => L{|queue| queue[rand(queue.size)]},
             :probabilities => probabilities[kick]),
 
    Drum.new(:note => note(snare),
                    :when => L{|beat| false},
                    :number_generator => L{rand},
                    :next => L{|queue| queue[rand(queue.size)]},
             :probabilities => probabilities[snare]),
 
    Drum.new(:note => note(hihat1),
                    :when => L{|beat| false},
                    :number_generator => L{rand},
                    :next => L{|queue| queue[rand(queue.size)]},
             :probabilities => probabilities[hihat1]),
 
    Drum.new(:note => note(hihat2),
                    :when => L{|beat| false},
                    :number_generator => L{rand},
                    :next => L{|queue| queue[rand(queue.size)]},
             :probabilities => probabilities[hihat2]),
 
    Drum.new(:note => note(xylo1),
                    :when => L{|beat| false},
                    :number_generator => L{rand},
                    :next => L{|queue| queue[rand(queue.size)]},
             :probabilities => probabilities[xylo1]),
 
    Drum.new(:note => note(xylo2),
                    :when => L{|beat| false},
                    :number_generator => L{rand},
                    :next => L{|queue| queue[rand(queue.size)]},
             :probabilities => probabilities[xylo2]),
 
    Drum.new(:note => note(xylo3),
                    :when => L{|beat| false},
                    :number_generator => L{rand},
                    :next => L{|queue| queue[rand(queue.size)]},
             :probabilities => probabilities[xylo3]),
 
    Drum.new(:note => note(xylo4),
                    :when => L{|beat| false},
                    :number_generator => L{rand},
                    :next => L{|queue| queue[rand(queue.size)]},
             :probabilities => probabilities[xylo4]),
 
    Drum.new(:note => note(xylo5),
                    :when => L{|beat| false},
                    :number_generator => L{rand},
                    :next => L{|queue| queue[rand(queue.size)]},
             :probabilities => probabilities[xylo5]),
 
    Drum.new(:note => note(clap),
                    :when => L{|beat| false},
                    :number_generator => L{rand},
                    :next => L{|queue| queue[rand(queue.size)]},
             :probabilities => probabilities[clap]),
 
]
 
 
 
notes