line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MIDI::Simple::Drummer::Rock; |
2
|
|
|
|
|
|
|
$MIDI::Simple::Drummer::Rock::VERSION = '0.0813'; |
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GENE'; |
4
|
1
|
|
|
1
|
|
709
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
6
|
1
|
|
|
1
|
|
400
|
use parent 'MIDI::Simple::Drummer'; |
|
1
|
|
|
|
|
287
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
48
|
use constant CLOSED => 'Closed Hi-Hat'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
9
|
1
|
|
|
1
|
|
6
|
use constant CRASH => 'Crash Cymbal 1'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
43
|
|
10
|
1
|
|
|
1
|
|
6
|
use constant BELL => 'Ride Bell'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
11
|
1
|
|
|
1
|
|
5
|
use constant RIDE2 => 'Ride Cymbal 2'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
12
|
1
|
|
|
1
|
|
7
|
use constant TOM1 => 'High Tom'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
13
|
1
|
|
|
1
|
|
5
|
use constant TOM2 => 'Low-Mid Tom'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
84
|
|
14
|
1
|
|
|
1
|
|
7
|
use constant TOM3 => 'Low Tom'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
15
|
1
|
|
|
1
|
|
6
|
use constant TOM4 => 'High Floor Tom'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
16
|
1
|
|
|
1
|
|
6
|
use constant TOM5 => 'Low Floor Tom'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2242
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
1
|
|
|
1
|
1
|
618
|
my $self = shift; |
20
|
1
|
|
|
|
|
6
|
$self->SUPER::new( |
21
|
|
|
|
|
|
|
-patch => 1, |
22
|
|
|
|
|
|
|
@_ |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# "Quater-note beat" Qn tick. Cym on 1. Kick 1&3. Snare 2&4. |
27
|
|
|
|
|
|
|
sub _quarter { |
28
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
29
|
0
|
|
|
|
|
0
|
my %args = @_; |
30
|
0
|
|
|
|
|
0
|
for my $beat (1 .. $self->beats) { |
31
|
|
|
|
|
|
|
$self->note($self->QUARTER, |
32
|
|
|
|
|
|
|
$self->rotate($beat, $args{-rotate}), |
33
|
|
|
|
|
|
|
$self->strike($args{-key_patch}) |
34
|
0
|
|
|
|
|
0
|
); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Common eighth-note based grooves with kick syncopation. |
39
|
|
|
|
|
|
|
sub _eighth { |
40
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
41
|
0
|
|
|
|
|
0
|
my %args = @_; |
42
|
0
|
|
|
|
|
0
|
for my $beat (1 .. $self->beats) { |
43
|
|
|
|
|
|
|
# Lay-down a back-beat rhythm. |
44
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, |
45
|
|
|
|
|
|
|
$self->backbeat_rhythm(%args, -beat => $beat) |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
# Add another kick or tick if we're at the right beat. |
48
|
|
|
|
|
|
|
$self->note($self->EIGHTH, |
49
|
0
|
|
|
|
|
0
|
((grep { $beat == $_ } @{$args{-key_beat}}) |
|
0
|
|
|
|
|
0
|
|
50
|
|
|
|
|
|
|
? ($self->kick, $self->tick) : $self->tick) |
51
|
0
|
0
|
0
|
|
|
0
|
) if $args{-key_beat} && @{$args{-key_beat}}; |
|
0
|
0
|
|
|
|
0
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub _kick_fill { |
56
|
3
|
|
|
3
|
|
4
|
my $self = shift; |
57
|
3
|
|
|
|
|
6
|
my %args = @_; |
58
|
|
|
|
|
|
|
$self->note( |
59
|
|
|
|
|
|
|
$args{-note}, |
60
|
|
|
|
|
|
|
$self->kick, |
61
|
|
|
|
|
|
|
$args{-fill} |
62
|
3
|
0
|
|
|
|
11
|
? $self->strike($args{-patches} ? @{$args{-patches}} : CRASH) |
|
0
|
50
|
|
|
|
0
|
|
63
|
|
|
|
|
|
|
: $self->tick |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _half_one { |
68
|
3
|
|
|
3
|
|
5
|
my $self = shift; |
69
|
3
|
|
|
|
|
6
|
my %args = @_; |
70
|
3
|
|
|
|
|
13
|
$self->_kick_fill(-note => $self->EIGHTH, %args); |
71
|
3
|
|
|
|
|
230
|
$self->note($self->EIGHTH, $self->tick); |
72
|
3
|
|
|
|
|
167
|
$self->note($self->EIGHTH, $self->snare, $self->tick); |
73
|
3
|
|
|
|
|
226
|
$self->note($self->EIGHTH, $self->tick); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub _half_two { |
77
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
78
|
0
|
|
|
|
|
0
|
my %args = @_; |
79
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, $self->kick, $self->tick); |
80
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, $self->kick, $self->tick); |
81
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, $self->snare, $self->tick); |
82
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, $self->tick); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub _half_three { |
86
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
87
|
0
|
|
|
|
|
0
|
my %args = @_; |
88
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, $self->tick); |
89
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, $self->kick, $self->tick); |
90
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, $self->snare, $self->tick); |
91
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, $self->kick, $self->tick); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub _half_four { |
95
|
4
|
|
|
4
|
|
6
|
my $self = shift; |
96
|
4
|
|
|
|
|
17
|
my %args = @_; |
97
|
4
|
|
|
|
|
26
|
$self->note($self->EIGHTH, $self->kick, $self->tick) for 0 .. 1; |
98
|
4
|
|
|
|
|
324
|
$self->note($self->EIGHTH, $self->snare, $self->tick); |
99
|
4
|
|
|
|
|
307
|
$self->note($self->EIGHTH, $self->kick, $self->tick); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub _half_four_two { |
103
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
104
|
1
|
|
|
|
|
2
|
my %args = @_; |
105
|
1
|
|
|
|
|
4
|
$self->note($self->EIGHTH, $self->tick); |
106
|
1
|
|
|
|
|
57
|
$self->note($self->EIGHTH, $self->kick, $self->tick); |
107
|
1
|
|
|
|
|
128
|
$self->note($self->EIGHTH, $self->snare, $self->tick); |
108
|
1
|
|
|
|
|
86
|
$self->note($self->EIGHTH, $self->tick); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub _half_five { |
112
|
6
|
|
|
6
|
|
11
|
my $self = shift; |
113
|
6
|
|
|
|
|
13
|
my %args = @_; |
114
|
6
|
|
|
|
|
19
|
$self->note($self->EIGHTH, $self->kick, $self->tick); |
115
|
6
|
|
|
|
|
489
|
$self->note($self->EIGHTH, $self->tick); |
116
|
6
|
|
|
|
|
342
|
$self->note($self->EIGHTH, $self->snare, $self->tick); |
117
|
6
|
|
|
|
|
466
|
$self->note($self->EIGHTH, $self->kick, $self->tick); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub _default_patterns { |
121
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
122
|
|
|
|
|
|
|
return { |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1.1 => sub { |
125
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
126
|
0
|
|
|
|
|
0
|
my %args = (-key_patch => CLOSED, @_); |
127
|
0
|
|
|
|
|
0
|
$self->_quarter(%args); |
128
|
|
|
|
|
|
|
}, |
129
|
|
|
|
|
|
|
1.2 => sub { |
130
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
131
|
0
|
|
|
|
|
0
|
my %args = (-key_patch => BELL, @_); |
132
|
0
|
|
|
|
|
0
|
$self->_quarter(%args); |
133
|
|
|
|
|
|
|
}, |
134
|
|
|
|
|
|
|
1.3 => sub { |
135
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
136
|
0
|
|
|
|
|
0
|
my %args = (-key_patch => RIDE2, @_); |
137
|
0
|
|
|
|
|
0
|
$self->_quarter(%args); |
138
|
|
|
|
|
|
|
}, |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
# Exercises from the see also link. |
141
|
|
|
|
|
|
|
2.1 => sub { # Ex. 1 |
142
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
143
|
0
|
|
|
|
|
0
|
my %args = @_; |
144
|
0
|
|
|
|
|
0
|
$self->_half_one(%args); |
145
|
0
|
|
|
|
|
0
|
$self->_half_one; |
146
|
|
|
|
|
|
|
}, |
147
|
|
|
|
|
|
|
2.2 => sub { # Ex. 2 |
148
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
149
|
0
|
|
|
|
|
0
|
my %args = @_; |
150
|
0
|
|
|
|
|
0
|
$self->_half_one(%args); |
151
|
0
|
|
|
|
|
0
|
$self->_half_two; |
152
|
|
|
|
|
|
|
}, |
153
|
|
|
|
|
|
|
2.3 => sub { # Ex. 3 |
154
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
155
|
0
|
|
|
|
|
0
|
my %args = @_; |
156
|
0
|
|
|
|
|
0
|
$self->_half_one(%args); |
157
|
0
|
|
|
|
|
0
|
$self->_half_three; |
158
|
|
|
|
|
|
|
}, |
159
|
|
|
|
|
|
|
2.4 => sub { # Ex. 4 |
160
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
161
|
0
|
|
|
|
|
0
|
my %args = @_; |
162
|
0
|
|
|
|
|
0
|
$self->_half_four(%args); |
163
|
0
|
|
|
|
|
0
|
$self->_half_four_two; |
164
|
|
|
|
|
|
|
}, |
165
|
|
|
|
|
|
|
2.5 => sub { # Ex. 5 |
166
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
167
|
1
|
|
|
|
|
4
|
my %args = @_; |
168
|
1
|
|
|
|
|
5
|
$self->_half_five(%args); |
169
|
1
|
|
|
|
|
78
|
$self->_half_four; |
170
|
|
|
|
|
|
|
}, |
171
|
|
|
|
|
|
|
2.6 => sub { # Ex. 6 |
172
|
1
|
|
|
1
|
|
1
|
my $self = shift; |
173
|
1
|
|
|
|
|
5
|
my %args = @_; |
174
|
1
|
|
|
|
|
5
|
$self->_half_five(%args); |
175
|
1
|
|
|
|
|
79
|
$self->_half_one; |
176
|
1
|
|
|
|
|
56
|
$self->_half_one; |
177
|
1
|
|
|
|
|
56
|
$self->_half_four; |
178
|
1
|
|
|
|
|
77
|
$self->_half_five; |
179
|
1
|
|
|
|
|
76
|
$self->_half_one; |
180
|
|
|
|
|
|
|
}, |
181
|
|
|
|
|
|
|
2.7 => sub { # Ex. 7 |
182
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
183
|
1
|
|
|
|
|
4
|
my %args = @_; |
184
|
1
|
|
|
|
|
5
|
$self->_half_four(%args); |
185
|
1
|
|
|
|
|
91
|
$self->_half_five; |
186
|
1
|
|
|
|
|
78
|
$self->_half_five; |
187
|
1
|
|
|
|
|
79
|
$self->_half_four_two; |
188
|
1
|
|
|
|
|
56
|
$self->_half_four; |
189
|
1
|
|
|
|
|
77
|
$self->_half_five; |
190
|
|
|
|
|
|
|
}, |
191
|
|
|
|
|
|
|
2.8 => sub { # Ex. 8 |
192
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
193
|
0
|
|
|
|
|
0
|
my %args = @_; |
194
|
0
|
|
|
|
|
0
|
$self->_half_one(%args); |
195
|
0
|
|
|
|
|
0
|
$self->_half_four_two; |
196
|
0
|
|
|
|
|
0
|
$self->_half_four; |
197
|
0
|
|
|
|
|
0
|
$self->_half_three; |
198
|
0
|
|
|
|
|
0
|
$self->_half_one; |
199
|
0
|
|
|
|
|
0
|
$self->_half_four_two; |
200
|
|
|
|
|
|
|
}, |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
3.1 => sub { # "Syncopated beat 1" en c-hh. qn k1,3,4&. qn s2,4. |
203
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
204
|
0
|
|
|
|
|
0
|
my %args = (-key_beat => [4], @_); |
205
|
0
|
|
|
|
|
0
|
$self->_eighth(%args); |
206
|
|
|
|
|
|
|
}, |
207
|
|
|
|
|
|
|
3.2 => sub { # "Syncopated beat 2" en c-hh. qn k1,3,3&,4&. qn s2,4. |
208
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
209
|
0
|
|
|
|
|
0
|
my %args = (-key_beat => [3, 4], @_); |
210
|
0
|
|
|
|
|
0
|
$self->_eighth(%args); |
211
|
|
|
|
|
|
|
}, |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
'1 fill' => sub { |
214
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
215
|
0
|
|
|
|
|
0
|
$self->note($self->SIXTEENTH, $self->snare) for 0 .. 3; |
216
|
0
|
|
|
|
|
0
|
$self->note($self->SIXTEENTH, $self->strike(TOM1)) for 0 .. 3; |
217
|
0
|
|
|
|
|
0
|
$self->note($self->SIXTEENTH, $self->strike(TOM3)) for 0 .. 3; |
218
|
0
|
|
|
|
|
0
|
$self->note($self->SIXTEENTH, $self->strike(TOM5)) for 0 .. 3; |
219
|
|
|
|
|
|
|
}, |
220
|
|
|
|
|
|
|
'2 fill' => sub { |
221
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
222
|
0
|
|
|
|
|
0
|
$self->note($self->SIXTEENTH, $self->snare, $self->strike(TOM5)) for 0 .. 3; |
223
|
|
|
|
|
|
|
}, |
224
|
|
|
|
|
|
|
'3 fill' => sub { |
225
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
226
|
0
|
|
|
|
|
0
|
$self->note($self->SIXTEENTH, $self->snare) for 0 .. 1; |
227
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, $self->snare); |
228
|
0
|
|
|
|
|
0
|
$self->note($self->SIXTEENTH, $self->strike(TOM1)) for 0 .. 1; |
229
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, $self->strike(TOM1)); |
230
|
|
|
|
|
|
|
}, |
231
|
|
|
|
|
|
|
'4 fill' => sub { |
232
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
233
|
0
|
|
|
|
|
0
|
$self->note($self->SIXTEENTH, $self->snare, $self->strike(TOM5)) for 0 .. 1; |
234
|
0
|
|
|
|
|
0
|
$self->note($self->SIXTEENTH, $self->snare) for 0 .. 1; |
235
|
0
|
|
|
|
|
0
|
$self->note($self->SIXTEENTH, $self->strike(TOM1)) for 0 .. 1; |
236
|
|
|
|
|
|
|
}, |
237
|
|
|
|
|
|
|
'5 fill' => sub { |
238
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
239
|
1
|
|
|
|
|
4
|
$self->note($self->EIGHTH, $self->kick, $self->strike(CRASH)); |
240
|
1
|
|
|
|
|
86
|
$self->note($self->EIGHTH, $self->snare) for 0 .. 2; |
241
|
1
|
|
|
|
|
96
|
$self->note($self->SIXTEENTH, $self->strike(TOM1)) for 0 .. 3; |
242
|
1
|
|
|
|
|
57
|
$self->note($self->SIXTEENTH, $self->strike(TOM3)) for 0 .. 3; |
243
|
|
|
|
|
|
|
}, |
244
|
|
|
|
|
|
|
'6 fill' => sub { |
245
|
0
|
|
|
0
|
|
|
my $self = shift; |
246
|
0
|
|
|
|
|
|
$self->note($self->SIXTEENTH, $self->snare) for 0 .. 3; |
247
|
0
|
|
|
|
|
|
$self->note($self->EIGHTH, $self->strike(TOM1)); |
248
|
0
|
|
|
|
|
|
$self->note($self->SIXTEENTH, $self->strike(TOM1)) for 0 .. 1; |
249
|
0
|
|
|
|
|
|
$self->note($self->SIXTEENTH, $self->snare) for 0 .. 1; |
250
|
0
|
|
|
|
|
|
$self->note($self->EIGHTH, $self->strike(TOM1)); |
251
|
0
|
|
|
|
|
|
$self->note($self->SIXTEENTH, $self->snare) for 0 .. 1; |
252
|
0
|
|
|
|
|
|
$self->note($self->EIGHTH, $self->strike(TOM3)); |
253
|
|
|
|
|
|
|
}, |
254
|
|
|
|
|
|
|
'7 fill' => sub { |
255
|
0
|
|
|
0
|
|
|
my $self = shift; |
256
|
0
|
|
|
|
|
|
$self->note($self->SIXTEENTH, $self->snare); |
257
|
0
|
|
|
|
|
|
$self->note($self->EIGHTH, $self->snare); |
258
|
0
|
|
|
|
|
|
$self->note($self->SIXTEENTH, $self->strike(TOM1)); |
259
|
0
|
|
|
|
|
|
$self->note($self->EIGHTH, $self->strike(TOM1)); |
260
|
0
|
|
|
|
|
|
$self->note($self->SIXTEENTH, $self->strike(TOM3)) for 0 .. 1; |
261
|
0
|
|
|
|
|
|
$self->note($self->SIXTEENTH, $self->snare) for 0 .. 3; |
262
|
0
|
|
|
|
|
|
$self->note($self->SIXTEENTH, $self->strike(TOM3)) for 0 .. 1; |
263
|
0
|
|
|
|
|
|
$self->note($self->EIGHTH, $self->strike(TOM3)); |
264
|
|
|
|
|
|
|
}, |
265
|
|
|
|
|
|
|
'8 fill' => sub { |
266
|
0
|
|
|
0
|
|
|
my $self = shift; |
267
|
0
|
|
|
|
|
|
$self->note($self->EIGHTH, $self->snare); |
268
|
0
|
|
|
|
|
|
$self->note($self->EIGHTH, $self->kick) for 0 .. 1; |
269
|
0
|
|
|
|
|
|
$self->note($self->EIGHTH, $self->snare); |
270
|
0
|
|
|
|
|
|
$self->note($self->EIGHTH, $self->kick) for 0 .. 1; |
271
|
0
|
|
|
|
|
|
$self->note($self->EIGHTH, $self->snare); |
272
|
0
|
|
|
|
|
|
$self->note($self->EIGHTH, $self->kick); |
273
|
|
|
|
|
|
|
}, |
274
|
|
|
|
|
|
|
|
275
|
1
|
|
|
|
|
84
|
}; |
276
|
|
|
|
|
|
|
} |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
1; |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
__END__ |