NAME

Music::SimpleDrumMachine - Simple 16th-note-phrase Drummer

VERSION

version 0.0100

SYNOPSIS

use Music::SimpleDrumMachine ();

my $dm = Music::SimpleDrumMachine->new(verbose => 1);

DESCRIPTION

Music::SimpleDrumMachine is a simple 16th-note-phrase drummer.

ATTRIBUTES

beats

$beats = $dm->beats;

The number of beats in a phrase.

Default: 16

bpm

$bpm = $dm->bpm;

The beats per minute.

Default: 120

chan

$chan = $dm->chan;

The MIDI channel.

If the channel is set to -1, multi-timbral mode is turned on and channels 0, 1, ... and up are used, instead of a single channel for all the percussion.

Default: 9

divisions

$divisions = $dm->divisions;

The number of divisions of a quarter-note into the number of beat-notes. For the default, this is the number of divisions of a quarter-note to get 16ths.

Default: 4

drums

$drums = $dm->drums;

The known drums.

Default:

kick  => { num => 36, chan => ..., pat => [] },
snare => { num => 38, chan => ..., pat => [] },
hihat => { num => 42, chan => ..., pat => [] },
crash => { num => 49, chan => ..., pat => [] },

fill_part

$fill_part = $dm->fill_part;

Code-ref of the part to play for 1/2-bar fills.

Default: \&_default_part

next_part

$next_part = $dm->next_part;

Name of the part to play first.

Default: '_default_part'

notes

$notes = $dm->notes;

The notes to set for each drum - why not?

Default: [60, 64, 67]

parts

$parts = $dm->parts;

List of code-refs of the parts to play.

Default: [\&_default_part]

port_name

$port = $dm->port_name;

The name of the MIDI output port.

Default: usb

ppqn

$ppqn = $dm->ppqn;

The "pulses per quarter-note" or "clocks per beat."

Default: 24

verbose

$verbose = $dm->verbose;

Show progress.

METHODS

new

$dm = Music::SimpleDrumMachine->new(verbose => 1);

Create a new Music::SimpleDrumMachine object.

SEE ALSO

Moo

http://somewhere.el.se

AUTHOR

Gene Boggs <gene.boggs@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 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.