line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MIDI::Simple::Drummer::Rock; |
2
|
|
|
|
|
|
|
$MIDI::Simple::Drummer::Rock::VERSION = '0.0810'; |
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GENE'; |
4
|
1
|
|
|
1
|
|
918
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
6
|
1
|
|
|
1
|
|
517
|
use parent 'MIDI::Simple::Drummer'; |
|
1
|
|
|
|
|
342
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
81
|
use constant CLOSED => 'Closed Hi-Hat'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
101
|
|
9
|
1
|
|
|
1
|
|
7
|
use constant CRASH => 'Crash Cymbal 1'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
47
|
|
10
|
1
|
|
|
1
|
|
6
|
use constant BELL => 'Ride Bell'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
59
|
|
11
|
1
|
|
|
1
|
|
7
|
use constant RIDE2 => 'Ride Cymbal 2'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
12
|
1
|
|
|
1
|
|
5
|
use constant TOM1 => 'High Tom'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
59
|
|
13
|
1
|
|
|
1
|
|
6
|
use constant TOM2 => 'Low-Mid Tom'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
14
|
1
|
|
|
1
|
|
7
|
use constant TOM3 => 'Low Tom'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
15
|
1
|
|
|
1
|
|
7
|
use constant TOM4 => 'High Floor Tom'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
16
|
1
|
|
|
1
|
|
6
|
use constant TOM5 => 'Low Floor Tom'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2325
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
1
|
|
|
1
|
1
|
764
|
my $self = shift; |
20
|
1
|
|
|
|
|
12
|
$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
|
|
7
|
my $self = shift; |
57
|
3
|
|
|
|
|
13
|
my %args = @_; |
58
|
|
|
|
|
|
|
$self->note( |
59
|
|
|
|
|
|
|
$args{-note}, |
60
|
|
|
|
|
|
|
$self->kick, |
61
|
|
|
|
|
|
|
$args{-fill} |
62
|
3
|
0
|
|
|
|
21
|
? $self->strike($args{-patches} ? @{$args{-patches}} : CRASH) |
|
0
|
50
|
|
|
|
0
|
|
63
|
|
|
|
|
|
|
: $self->tick |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _half_one { |
68
|
3
|
|
|
3
|
|
9
|
my $self = shift; |
69
|
3
|
|
|
|
|
12
|
my %args = @_; |
70
|
3
|
|
|
|
|
43
|
$self->_kick_fill(-note => $self->EIGHTH, %args); |
71
|
3
|
|
|
|
|
300
|
$self->note($self->EIGHTH, $self->tick); |
72
|
3
|
|
|
|
|
176
|
$self->note($self->EIGHTH, $self->snare, $self->tick); |
73
|
3
|
|
|
|
|
251
|
$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
|
2
|
|
|
2
|
|
5
|
my $self = shift; |
87
|
2
|
|
|
|
|
5
|
my %args = @_; |
88
|
2
|
|
|
|
|
13
|
$self->note($self->EIGHTH, $self->tick); |
89
|
2
|
|
|
|
|
126
|
$self->note($self->EIGHTH, $self->kick, $self->tick); |
90
|
2
|
|
|
|
|
158
|
$self->note($self->EIGHTH, $self->snare, $self->tick); |
91
|
2
|
|
|
|
|
191
|
$self->note($self->EIGHTH, $self->kick, $self->tick); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub _half_four { |
95
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
96
|
1
|
|
|
|
|
4
|
my %args = @_; |
97
|
1
|
|
|
|
|
8
|
$self->note($self->EIGHTH, $self->kick, $self->tick) for 0 .. 1; |
98
|
1
|
|
|
|
|
78
|
$self->note($self->EIGHTH, $self->snare, $self->tick); |
99
|
1
|
|
|
|
|
99
|
$self->note($self->EIGHTH, $self->kick, $self->tick); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub _half_four_two { |
103
|
2
|
|
|
2
|
|
5
|
my $self = shift; |
104
|
2
|
|
|
|
|
5
|
my %args = @_; |
105
|
2
|
|
|
|
|
9
|
$self->note($self->EIGHTH, $self->tick); |
106
|
2
|
|
|
|
|
114
|
$self->note($self->EIGHTH, $self->kick, $self->tick); |
107
|
2
|
|
|
|
|
156
|
$self->note($self->EIGHTH, $self->snare, $self->tick); |
108
|
2
|
|
|
|
|
236
|
$self->note($self->EIGHTH, $self->tick); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub _half_five { |
112
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
113
|
0
|
|
|
|
|
0
|
my %args = @_; |
114
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, $self->kick, $self->tick); |
115
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, $self->tick); |
116
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, $self->snare, $self->tick); |
117
|
0
|
|
|
|
|
0
|
$self->note($self->EIGHTH, $self->kick, $self->tick); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub _default_patterns { |
121
|
1
|
|
|
1
|
|
3
|
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
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
155
|
1
|
|
|
|
|
6
|
my %args = @_; |
156
|
1
|
|
|
|
|
16
|
$self->_half_one(%args); |
157
|
1
|
|
|
|
|
67
|
$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
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
167
|
0
|
|
|
|
|
0
|
my %args = @_; |
168
|
0
|
|
|
|
|
0
|
$self->_half_five(%args); |
169
|
0
|
|
|
|
|
0
|
$self->_half_four; |
170
|
|
|
|
|
|
|
}, |
171
|
|
|
|
|
|
|
2.6 => sub { # Ex. 6 |
172
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
173
|
0
|
|
|
|
|
0
|
my %args = @_; |
174
|
0
|
|
|
|
|
0
|
$self->_half_five(%args); |
175
|
0
|
|
|
|
|
0
|
$self->_half_one; |
176
|
0
|
|
|
|
|
0
|
$self->_half_one; |
177
|
0
|
|
|
|
|
0
|
$self->_half_four; |
178
|
0
|
|
|
|
|
0
|
$self->_half_five; |
179
|
0
|
|
|
|
|
0
|
$self->_half_one; |
180
|
|
|
|
|
|
|
}, |
181
|
|
|
|
|
|
|
2.7 => sub { # Ex. 7 |
182
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
183
|
0
|
|
|
|
|
0
|
my %args = @_; |
184
|
0
|
|
|
|
|
0
|
$self->_half_four(%args); |
185
|
0
|
|
|
|
|
0
|
$self->_half_five; |
186
|
0
|
|
|
|
|
0
|
$self->_half_five; |
187
|
0
|
|
|
|
|
0
|
$self->_half_four_two; |
188
|
0
|
|
|
|
|
0
|
$self->_half_four; |
189
|
0
|
|
|
|
|
0
|
$self->_half_five; |
190
|
|
|
|
|
|
|
}, |
191
|
|
|
|
|
|
|
2.8 => sub { # Ex. 8 |
192
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
193
|
1
|
|
|
|
|
4
|
my %args = @_; |
194
|
1
|
|
|
|
|
7
|
$self->_half_one(%args); |
195
|
1
|
|
|
|
|
60
|
$self->_half_four_two; |
196
|
1
|
|
|
|
|
63
|
$self->_half_four; |
197
|
1
|
|
|
|
|
82
|
$self->_half_three; |
198
|
1
|
|
|
|
|
77
|
$self->_half_one; |
199
|
1
|
|
|
|
|
63
|
$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
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
215
|
1
|
|
|
|
|
13
|
$self->note($self->SIXTEENTH, $self->snare) for 0 .. 3; |
216
|
1
|
|
|
|
|
60
|
$self->note($self->SIXTEENTH, $self->strike(TOM1)) for 0 .. 3; |
217
|
1
|
|
|
|
|
57
|
$self->note($self->SIXTEENTH, $self->strike(TOM3)) for 0 .. 3; |
218
|
1
|
|
|
|
|
66
|
$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
|
|
|
|
|
7
|
$self->note($self->EIGHTH, $self->kick, $self->strike(CRASH)); |
240
|
1
|
|
|
|
|
96
|
$self->note($self->EIGHTH, $self->snare) for 0 .. 2; |
241
|
1
|
|
|
|
|
89
|
$self->note($self->SIXTEENTH, $self->strike(TOM1)) for 0 .. 3; |
242
|
1
|
|
|
|
|
58
|
$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
|
|
|
|
|
105
|
}; |
276
|
|
|
|
|
|
|
} |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
1; |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
__END__ |