NAME
MIDI::Drummer::Tiny - Glorified metronome
VERSION
version 0.1200
SYNOPSIS
use MIDI::Drummer::Tiny;
my $d = MIDI::Drummer::Tiny->new(
file => 'drums.mid',
bpm => 100,
signature => '5/4',
bars => 8,
kick => 'n36', # Override default patch
snare => 'n40', # "
);
$d->count_in(1); # Closed hi-hat for 1 bar
$d->metronome54; # 5/4 time for the number of bars
$d->set_time_sig('4/4');
$d->rest($d->whole);
$d->metronome44; # 4/4 time for the number of bars
# Alternate kick and snare
$d->note( $d->quarter, $d->open_hh, $_ % 2 ? $d->kick : $d->snare )
for 1 .. $d->beats * $d->bars;
$d->write;
DESCRIPTION
This module provides a MIDI drummer with the essentials to add notes to produce a MIDI score.
ATTRIBUTES
file
Default: MIDI-Drummer.mid
score
Default: MIDI::Simple->new_score
channel
Default: 9
volume
Default: 100
bpm
Default: 120
bars
Default: 4
signature
Default: 4/4
beats / divisions
beats
Computed given the signature.
divisions
Computed given the signature.
KIT
- click, bell (metronome)
- open_hh, closed_hh, pedal_hh
- crash1, crash2, splash, china
- ride1, ride2, ride_bell
- side_stick, snare (alternate = n40), clap
- hi_tom, hi_mid_tom, low_mid_tom, low_tom, hi_floor_tom, low_floor_tom
- kick (alternate = n36)
- tambourine, cowbell, vibraslap
- hi_bongo, low_bongo, mute_hi_conga, open_hi_conga, low_conga, high_timbale, low_timbale
- high_agogo, low_agogo, cabasa, maracas, short_whistle, long_whistle, short_guiro, long_guiro, claves, hi_wood_block, low_wood_block, mute_cuica, open_cuica
- mute_triangle, open_triangle
DURATIONS
- whole, half
- quarter, triplet_quarter, dotted_quarter
- eighth, triplet_eighth, dotted_eighth
- sixteenth, triplet_sixteenth, dotted_sixteenth
METHODS
new
$d = MIDI::Drummer::Tiny->new(%arguments);
Return a new MIDI::Drummer::Tiny
object.
note
$d->note( $d->quarter, $d->closed_hh, $d->kick );
$d->note( 'qn', 'n42', 'n35' ); # Same thing
Add a note to the score.
This method takes the same arguments as with "Parameters for n/r/noop" in MIDI::Simple.
rest
$d->rest( $d->quarter );
Add a rest to the score.
This method takes the same arguments as with "Parameters for n/r/noop" in MIDI::Simple.
count_in
$d->count_in;
$d->count_in($bars);
Play the closed hihat for the number of beats times the given bars. If no bars are given, the default times the number of beats is used.
metronome, metronome44
$d->metronome44;
$d->metronome44($bars);
$d->metronome44($bars, $flag);
$d->metronome44(16, 1);
$d->metronome44(0, 1); # Use the ->bars attribute
Add a steady 4/4 beat to the score.
If a flag is provided the beat is modified to include alternating eighth-note kicks.
metronome34
$d->metronome34;
$d->metronome34($bars);
Add a steady 3/4 beat to the score.
metronome54
$d->metronome54;
$d->metronome54($bars);
Add a 5/4 beat to the score.
metronome58
$d->metronome58;
$d->metronome58($bars);
Add a 5/8 beat to the score.
metronome68
$d->metronome68;
$d->metronome68($bars);
Add a 6/8 beat to the score.
metronome74
$d->metronome74;
$d->metronome74($bars);
Add a 7/4 beat to the score.
metronome78
$d->metronome78;
$d->metronome78($bars);
Add a 7/8 beat to the score.
set_time_sig
$d->set_time_sig('5/4');
Set the signature, beats, divisions, and the score time_signature
values based on the given string.
accent_note
$d->accent_note([$accent, $resume], $d->sixteenth, $d->snare);
Play an accented note.
For instance, this can be a "ghosted note", where the accent is a smaller number (< 50). Or a note that is greater than the current (resume) volume.
write
Output the score to the default *.mid file or one given to the constuctor.
SEE ALSO
The eg/* programs in this distribution
https://en.wikipedia.org/wiki/General_MIDI#Percussion
AUTHOR
Gene Boggs <gene@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020 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.