NAME
MIDI::Drummer::Tiny::Syncopate - Syncopation logic
VERSION
version 0.4305
SYNOPSIS
use MIDI::Drummer::Tiny::Syncopate;
my $d = MIDI::Drummer::Tiny::Syncopate->new(
file => 'syncopate.mid',
reverb => 15,
);
$d->combinatorial( $d->snare, {
repeat => 2,
patterns => [qw(0101 1001)],
});
# Play parts simultaneously
$d->sync( \&snare, \&kick, \&hhat );
sub snare { $d->combinatorial( $d->snare, { count => 1 } ) }
sub kick { $d->combinatorial( $d->kick, { negate => 1 } ) }
sub hhat { $d->steady( $d->closed_hh ) }
$d->write;
DESCRIPTION
MIDI::Drummer::Tiny::Syncopate
provides methods to use in the eg/syncopation/* lessons.
ATTRIBUTES
duration
$duration = $d->duration;
Default: quarter
repeat
$repeat = $d->repeat;
Default: 4
METHODS
new
$d = MIDI::Drummer::Tiny::Syncopate->new(%arguments);
Return a new MIDI::Drummer::Tiny::Syncopate
object.
steady
$d->steady;
$d->steady( $d->kick );
$d->steady( $d->kick, { duration => $d->eighth } );
Play a steady beat with the given instrument and optional duration, for the number of beats accumulated in the object's counter attribute.
Defaults:
instrument: closed_hh
Options:
duration: given by constructor
combinatorial
$d->combinatorial;
$d->combinatorial( $d->kick );
$d->combinatorial( $d->kick, \%options );
Play a beat pattern with the given instrument, given by "variations_with_repetition" in Algorithm::Combinatorics.
This method accumulates beats in the object's counter attribute if the count option is set.
The vary option is a hashref of coderefs, keyed by single character tokens, like the digits, 0-9. The coderef durations should add up to the duration option.
Defaults:
instrument: snare
Options:
duration: given by constructor
count: 0
negate: 0
beats: given by constructor
repeat: given by constructor
vary:
0 => sub { $self->rest( $options->{duration} ) },
1 => sub { $self->note( $options->{duration}, $instrument ) },
patterns: undef
SEE ALSO
The eg/syncopation/* lessons.
https://www.amazon.com/dp/0882847953 - "Progressive Steps to Syncopation for the Modern Drummer"
AUTHOR
Gene Boggs <gene@cpan.org>
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.