Version
version 0.4206
Import the Module
use MIDI::Drummer::Tiny ();
Object Instantiation
Use the defaults
my $d = MIDI::Drummer::Tiny->new;
Attribute configuration
my $d = MIDI::Drummer::Tiny->new(
file => 'drums.mid',
bpm => 120,
channel => 10,
volume => 120,
signature => '5/4', # OR:
#beats => 5,
#divisions => 4,
bars => 8,
reverb => 0,
kick => 36, # Override default patch
snare => 40, # "
verbose => 1,
);
Drum Set Components
Kick and snare-like things
acoustic_bass, electric_bass ("kick")
acoustic_snare, electric_snare, side_stick, clap
Cymbals
open_hh, closed_hh, pedal_hh
crash1, crash2, splash, china
ride1, ride2, ride_bell
Toms
hi_tom, hi_mid_tom, low_mid_tom, low_tom, hi_floor_tom, low_floor_tom
Miscellaneous
click, bell (metronome), tambourine, cowbell, vibraslap, etc.
Handy Duration Aliases
whole, triplet_whole, dotted_whole, double_dotted_whole
half, triplet_half, dotted_half, double_dotted_half
quarter, triplet_quarter, dotted_quarter, double_dotted_quarter
eighth, triplet_eighth, dotted_eighth, double_dotted_eighth
etc. up to 128th notes
Basic Beats
Rock
$d->metronome44;
# OR
$d->metronome44($d->bars, 1);
That's it!
Swing
$d->metronome44swing;
That's it!
Viennese Waltz
for my $n (1 .. $d->bars) {
$d->note($d->quarter, $d->ride1, $d->kick);
$d->note($d->quarter, $d->ride1, $d->snare);
$d->note($d->quarter, $d->ride1, $d->snare);
}
In 3/4 time
Disco
for my $n ( 0 .. $d->bars - 1 ) {
$d->note( $d->sixteenth, $d->closed_hh, $d->kick );
$d->note( $d->sixteenth, $d->closed_hh );
$d->note( $d->sixteenth, $d->closed_hh );
$d->note( $d->sixteenth, $d->open_hh );
$d->note( $d->sixteenth, $d->pedal_hh, $d->kick, $d->snare );
$d->note( $d->sixteenth, $d->closed_hh );
$d->note( $d->sixteenth, $d->closed_hh );
$d->note( $d->sixteenth, $d->closed_hh );
}
This beat is extra-cheesy.
And Finally...
We need to write-out the score to a MIDI file.
$d->write;
MIDI Playback
Use the venerable command-line program, timidity++ - which is likely available through your package manager (e.g. apt, homebrew). You can also use the excellent, cross platform program, VLC .
> timidity drums.mid
Easy!
Copyright and License
This software is copyright (c) 2014-2023 by Gene Boggs.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.