NAME

MIDI::Drummer::Tiny - Glorified metronome

VERSION

version 0.1101

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

reverb

Default: 0

chorus

Default: 0

pan

Default: 0

bars

Default: 4

beats

Computed given the signature.

divisions

Computed given the signature.

signature

Default: 4/4

beats / divisions

KIT

kick
snare
open_hh
closed_hh
pedal_hh
crash1
crash2
splash
china
ride1
ride2
ride_bell
hi_tom
hi_mid_tom
low_mid_tom
low_tom
hi_floor_tom
low_floor_tom

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.

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 an "accented 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 t/* and eg/* programs in this distribution

Moo

MIDI::Simple

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.