#!/usr/bin/env perl
use strict;
use warnings;

# Written by Frank Zappa

# My write-up is at https://ology.github.io/2022/11/13/the-black-page-in-perl/

# use local author libraries
use MIDI::Drummer::Tiny ();
use Music::Duration ();
use MIDI::Util qw(dura_size);

use constant ACCENT => 70;

my $d = MIDI::Drummer::Tiny->new(
    file   => "$0.mid",
    bpm    => 60,
    bars   => 30,
    reverb => 15,
);

Music::Duration::tuplet($d->half,    'A', 5);    # Ahn
Music::Duration::tuplet($d->eighth,  'B', 5);    # Ben
Music::Duration::tuplet($d->quarter, 'C', 5.2);  # Cqn
Music::Duration::tuplet($d->quarter, 'D', 7);    # Dqn
Music::Duration::tuplet($d->quarter, 'E', 11);   # Eqn
Music::Duration::tuplet($d->quarter, 'F', 12);   # Fqn

my $ten = dura_size($d->triplet_eighth);
Music::Duration::add_duration(Gten => $ten * 2); # Gten

# for bar 5
Music::Duration::tuplet($d->triplet_quarter, 'P', 5); # Ptqn
Music::Duration::tuplet($d->triplet_quarter, 'Q', 6); # Qtqn

# for bar 15
my $thn = dura_size($d->triplet_half);
Music::Duration::add_duration(Tthn => $thn / 2.5);       # Tthn
Music::Duration::add_duration(Uthn => $thn / 7.5);       # Uthn
my $half_thn = dura_size('Tthn');
Music::Duration::add_duration(Vthn => $half_thn / 5.5);  # Vthn
Music::Duration::add_duration(Xthn => $half_thn / 4.5);  # Xthn
my $half_7thn = dura_size('Uthn');
Music::Duration::add_duration(Wthn => $half_7thn / 2.5); # Wthn

$d->sync(
    \&beat,
    \&pulse, # not in the original but handy for debugging
);

$d->write;

sub pulse {
    for my $i (1 .. $d->beats * $d->bars) {
        $d->note($d->quarter, $d->pedal_hh);
    }
}

sub beat {
    # 1
    $d->note($d->quarter, $d->snare);

    $d->note($d->thirtysecond, $d->snare);
    $d->note($d->thirtysecond, $d->snare);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->eighth, $d->snare);

    $d->rest($d->sixteenth);
    $d->flam($d->sixteenth);
    $d->note($d->eighth, $d->kick);

    $d->rest($d->sixteenth);
    $d->roll($d->eighth, $d->thirtysecond);
    $d->note($d->sixteenth, $d->kick);

    # 2
    $d->note($d->triplet_sixteenth, $d->kick);
    $d->note($d->triplet_sixteenth, $d->kick);
    $d->note($d->triplet_sixteenth, $d->snare);
    $d->note($d->eighth, $d->kick);

    $d->note($d->triplet_sixteenth, $d->kick);
    $d->rest($d->triplet_sixteenth);
    $d->note($d->triplet_sixteenth, $d->kick);
    $d->roll($d->eighth, $d->thirtysecond);

    $d->roll('Ahn', $d->thirtysecond);
    $d->flam('Ahn', $d->hi_tom, $d->hi_tom, ACCENT);
    $d->note('Ahn', $d->hi_mid_tom, $d->hi_mid_tom, ACCENT);
    $d->note('Ahn', $d->hi_floor_tom);
    $d->note('Ahn', $d->kick, $d->closed_hh);
    $d->rest('d2'); # differential

    # 3
    $d->note($d->dotted_eighth, $d->kick);
    $d->note($d->thirtysecond, $d->snare);
    $d->note($d->thirtysecond, $d->snare);

    $d->crescendo_roll([100, 50], $d->dotted_quarter, $d->thirtysecond);

    $d->crescendo_roll([50, 100], $d->dotted_quarter, $d->thirtysecond);

    # 4
    $d->note($d->thirtysecond, $d->snare);
    $d->note($d->thirtysecond, $d->snare);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->snare);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);

    $d->note($d->triplet_sixteenth, $d->snare);
    $d->note($d->triplet_sixteenth, $d->kick);
    $d->note($d->triplet_sixteenth, $d->kick);
    $d->note('Ben', $d->kick);
    $d->note('Ben', $d->cowbell);
    $d->note('Ben', $d->cowbell);
    $d->note('Ben', $d->cowbell);
    $d->note('Ben', $d->cowbell);

    $d->note('Dqn', $d->snare, $d->closed_hh);
    $d->note('Dqn', $d->kick);
    $d->note('Dqn', $d->kick);
    $d->note('Dqn', $d->snare, $d->closed_hh);
    $d->note('Dqn', $d->kick);
    $d->note('Dqn', $d->snare, $d->closed_hh);
    $d->note('Dqn', $d->snare, $d->closed_hh);

    $d->note('Dqn', $d->kick);
    $d->note('Dqn', $d->snare, $d->closed_hh);
    $d->note('Dqn', $d->kick);
    $d->note('Dqn', $d->snare, $d->closed_hh);
    $d->note('Dqn', $d->snare, $d->closed_hh);
    $d->note('Dqn', $d->snare, $d->closed_hh);
    $d->note('Dqn', $d->kick);

    # 5
    $d->rest($d->half);

    $d->note('Ptqn', $d->hi_bongo);
    $d->note('Ptqn', $d->low_bongo);
    $d->note('Ptqn', $d->low_bongo);
    $d->note('Ptqn', $d->hi_bongo);
    $d->note('Ptqn', $d->hi_bongo);

    $d->note('Ptqn', $d->hi_bongo);
    $d->note('Ptqn', $d->kick);
    $d->note('Ptqn', $d->kick);
    $d->note('Ptqn', $d->snare);
    $d->note('Ptqn', $d->snare);

    $d->note('Qtqn', $d->kick);
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 40));
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 30));
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 20));
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 10));
    $d->note('Qtqn', $d->snare, 'v' . $d->volume);

    # 6
    $d->note($d->quarter, $d->snare);

    $d->rest($d->sixteenth);
    $d->note($d->dotted_eighth, $d->kick, $d->hi_floor_tom, $d->closed_hh);

    $d->rest($d->eighth);
    $d->note($d->eighth, $d->kick, $d->hi_floor_tom, $d->closed_hh);

    $d->rest($d->dotted_eighth);
    $d->note($d->sixteenth, $d->kick, $d->hi_floor_tom, $d->closed_hh);

    # 7
    $d->rest($d->quarter);

    $d->note($d->quarter, $d->kick, $d->hi_floor_tom, $d->closed_hh);

    $d->rest($d->sixteenth);
    $d->note($d->dotted_eighth, $d->kick, $d->hi_floor_tom, $d->closed_hh);

    $d->rest($d->eighth);
    $d->note($d->eighth, $d->kick, $d->hi_floor_tom, $d->closed_hh);

    # 8
    $d->rest($d->dotted_eighth);
    $d->note($d->sixteenth, $d->kick, $d->hi_floor_tom, $d->closed_hh);

    $d->rest($d->quarter);

    $d->note('Ptqn', $d->hi_bongo);
    $d->note('Ptqn', $d->low_bongo);
    $d->note('Ptqn', $d->low_bongo);
    $d->note('Ptqn', $d->hi_bongo);
    $d->note('Ptqn', $d->hi_bongo);

    $d->note('Ptqn', $d->hi_bongo);
    $d->note('Ptqn', $d->kick);
    $d->note('Ptqn', $d->kick);
    $d->note('Ptqn', $d->snare);
    $d->note('Ptqn', $d->snare);

    $d->note('Qtqn', $d->kick);
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 40));
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 30));
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 20));
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 10));
    $d->note('Qtqn', $d->snare, 'v' . $d->volume);

    # 9
    $d->note($d->whole, $d->kick, $d->ride1);

    # 10
    $d->rest($d->quarter);

    $d->roll($d->eighth, $d->thirtysecond, $d->hi_bongo);
    $d->note($d->thirtysecond, $d->hi_bongo);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->low_bongo);

    $d->note($d->triplet_sixteenth, $d->closed_hh);
    $d->note($d->triplet_sixteenth, $d->kick);
    $d->note($d->triplet_sixteenth, $d->snare);
    $d->note('Ben', $d->kick);
    $d->note('Ben', $d->kick);
    $d->note('Ben', $d->snare);
    $d->note('Ben', $d->kick);
    $d->note('Ben', $d->kick);

    $d->rest('Cqn');
    $d->flam('Cqn', $d->hi_bongo, $d->hi_bongo, ACCENT);
    $d->note('Cqn', $d->low_bongo);
    $d->note('Cqn', $d->hi_floor_tom);
    $d->roll('Cqn', $d->thirtysecond, $d->low_bongo);

    # 11
    $d->flam('Cqn', $d->hi_bongo, $d->hi_bongo, ACCENT);
    $d->note('Cqn', $d->low_bongo);
    $d->note('Cqn', $d->hi_floor_tom);
    $d->roll('Cqn', $d->thirtysecond, $d->low_bongo);
    $d->note('Cqn', $d->kick);

    $d->note('Cqn', $d->kick);
    $d->flam('Cqn', $d->hi_bongo, $d->hi_bongo, ACCENT);
    $d->note('Cqn', $d->low_bongo);
    $d->note('Cqn', $d->hi_floor_tom);
    $d->roll('Cqn', $d->thirtysecond, $d->low_bongo);

    $d->rest($d->half);

    # 12
    $d->rest($d->half);

    $d->note($d->thirtysecond, $d->hi_bongo);
    $d->note($d->thirtysecond, $d->hi_bongo);
    $d->note($d->sixteenth, $d->hi_bongo);
    $d->note($d->thirtysecond, $d->low_bongo);
    $d->note($d->thirtysecond, $d->low_bongo);
    $d->note($d->sixteenth, $d->low_bongo);

    $d->note($d->sixteenth, $d->snare);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->hi_tom);
    $d->note($d->thirtysecond, $d->hi_tom);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->snare);

    # 13
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->snare);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->snare);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->snare);

    $d->note($d->thirtysecond, $d->closed_hh);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->closed_hh);
    $d->note($d->thirtysecond, $d->closed_hh);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->closed_hh);

    $d->note($d->thirtysecond, $d->hi_bongo);
    $d->note($d->thirtysecond, $d->low_bongo);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->hi_tom);
    $d->note($d->thirtysecond, $d->hi_mid_tom);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->hi_floor_tom);
    $d->note($d->thirtysecond, $d->hi_floor_tom);

    $d->note($d->thirtysecond, $d->hi_floor_tom);
    $d->note($d->thirtysecond, $d->hi_floor_tom);
    $d->note($d->thirtysecond, $d->hi_tom);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->snare, $d->closed_hh);
    $d->note($d->thirtysecond, $d->snare, $d->closed_hh);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->snare, $d->closed_hh);

    # 14
    $d->rest($d->eighth);
    $d->note($d->thirtysecond, $d->snare, $d->closed_hh);
    $d->note($d->thirtysecond, $d->snare, $d->closed_hh);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->snare, $d->closed_hh);

    $d->rest($d->quarter);

    $d->note($d->thirtysecond, $d->snare, $d->closed_hh);
    $d->note($d->thirtysecond, $d->snare, $d->closed_hh);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->snare, $d->closed_hh);
    $d->rest($d->eighth);

    $d->rest($d->eighth);
    $d->note($d->thirtysecond, $d->snare, $d->closed_hh);
    $d->note($d->thirtysecond, $d->snare, $d->closed_hh);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->snare, $d->closed_hh);

    # 15
    $d->roll($d->triplet_half, $d->thirtysecond, $d->hi_tom);

    $d->flam('Tthn', $d->snare, $d->snare, ACCENT);
    $d->note('Tthn', $d->hi_floor_tom);
    $d->note('Uthn', $d->hi_floor_tom);
    $d->note('Uthn', $d->snare);
    $d->note('Wthn', $d->hi_floor_tom);
    $d->note('Wthn', $d->snare);
    $d->note('Wthn', $d->snare);

    $d->note('Xthn', $d->closed_hh);
    $d->note('Xthn', $d->hi_mid_tom);
    $d->note('Xthn', $d->closed_hh);
    $d->note('Xthn', $d->kick);
    $d->note('Vthn', $d->kick);
    $d->note('Vthn', $d->kick);
    $d->note('Vthn', $d->closed_hh);
    $d->note('Vthn', $d->kick);
    $d->note('Vthn', $d->kick);

    # 16 (1)
    $d->note($d->quarter, $d->snare);

    $d->note($d->thirtysecond, $d->snare);
    $d->note($d->thirtysecond, $d->snare);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->eighth, $d->snare);

    $d->rest($d->sixteenth);
    $d->flam($d->sixteenth);
    $d->note($d->eighth, $d->kick);

    $d->rest($d->sixteenth);
    $d->roll($d->eighth, $d->thirtysecond);
    $d->note($d->sixteenth, $d->kick);

    # 17 (2)
    $d->note($d->triplet_sixteenth, $d->kick);
    $d->note($d->triplet_sixteenth, $d->kick);
    $d->note($d->triplet_sixteenth, $d->snare);
    $d->note($d->eighth, $d->kick);

    $d->note($d->triplet_sixteenth, $d->kick);
    $d->rest($d->triplet_sixteenth);
    $d->note($d->triplet_sixteenth, $d->kick);
    $d->roll($d->eighth, $d->thirtysecond);

    $d->roll('Ahn', $d->thirtysecond);
    $d->flam('Ahn', $d->hi_tom, $d->hi_tom, ACCENT);
    $d->note('Ahn', $d->hi_mid_tom, $d->hi_mid_tom, ACCENT);
    $d->note('Ahn', $d->hi_floor_tom);
    $d->note('Ahn', $d->kick, $d->closed_hh);
    $d->rest('d2'); # differential

    # 18 (3)
    $d->note($d->dotted_eighth, $d->kick);
    $d->note($d->thirtysecond, $d->snare);
    $d->note($d->thirtysecond, $d->snare);

    $d->crescendo_roll([100, 50], $d->dotted_quarter, $d->thirtysecond);

    $d->crescendo_roll([50, 100], $d->dotted_quarter, $d->thirtysecond);

    # 19 (4)
    $d->note($d->thirtysecond, $d->snare);
    $d->note($d->thirtysecond, $d->snare);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->snare);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);

    $d->note($d->triplet_sixteenth, $d->snare);
    $d->note($d->triplet_sixteenth, $d->kick);
    $d->note($d->triplet_sixteenth, $d->kick);
    $d->note('Ben', $d->kick);
    $d->note('Ben', $d->cowbell);
    $d->note('Ben', $d->cowbell);
    $d->note('Ben', $d->cowbell);
    $d->note('Ben', $d->cowbell);

    $d->note('Dqn', $d->snare, $d->closed_hh);
    $d->note('Dqn', $d->kick);
    $d->note('Dqn', $d->kick);
    $d->note('Dqn', $d->snare, $d->closed_hh);
    $d->note('Dqn', $d->kick);
    $d->note('Dqn', $d->snare, $d->closed_hh);
    $d->note('Dqn', $d->snare, $d->closed_hh);

    $d->note('Dqn', $d->kick);
    $d->note('Dqn', $d->snare, $d->closed_hh);
    $d->note('Dqn', $d->kick);
    $d->note('Dqn', $d->snare, $d->closed_hh);
    $d->note('Dqn', $d->snare, $d->closed_hh);
    $d->note('Dqn', $d->snare, $d->closed_hh);
    $d->note('Dqn', $d->kick);

    # 20 (5)
    $d->rest($d->half);

    $d->note('Ptqn', $d->hi_bongo);
    $d->note('Ptqn', $d->low_bongo);
    $d->note('Ptqn', $d->low_bongo);
    $d->note('Ptqn', $d->hi_bongo);
    $d->note('Ptqn', $d->hi_bongo);

    $d->note('Ptqn', $d->hi_bongo);
    $d->note('Ptqn', $d->kick);
    $d->note('Ptqn', $d->kick);
    $d->note('Ptqn', $d->snare);
    $d->note('Ptqn', $d->snare);

    $d->note('Qtqn', $d->kick);
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 40));
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 30));
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 20));
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 10));
    $d->note('Qtqn', $d->snare, 'v' . $d->volume);

    # 21 (6)
    $d->note($d->quarter, $d->snare);

    $d->rest($d->sixteenth);
    $d->note($d->dotted_eighth, $d->kick, $d->hi_floor_tom, $d->closed_hh);

    $d->rest($d->eighth);
    $d->note($d->eighth, $d->kick, $d->hi_floor_tom, $d->closed_hh);

    $d->rest($d->dotted_eighth);
    $d->note($d->sixteenth, $d->kick, $d->hi_floor_tom, $d->closed_hh);

    # 22 (7)
    $d->rest($d->quarter);

    $d->note($d->quarter, $d->kick, $d->hi_floor_tom, $d->closed_hh);

    $d->rest($d->sixteenth);
    $d->note($d->dotted_eighth, $d->kick, $d->hi_floor_tom, $d->closed_hh);

    $d->rest($d->eighth);
    $d->note($d->eighth, $d->kick, $d->hi_floor_tom, $d->closed_hh);

    # 23 (8)
    $d->rest($d->dotted_eighth);
    $d->note($d->sixteenth, $d->kick, $d->hi_floor_tom, $d->closed_hh);

    $d->rest($d->quarter);

    $d->note('Ptqn', $d->hi_bongo);
    $d->note('Ptqn', $d->low_bongo);
    $d->note('Ptqn', $d->low_bongo);
    $d->note('Ptqn', $d->hi_bongo);
    $d->note('Ptqn', $d->hi_bongo);

    $d->note('Ptqn', $d->hi_bongo);
    $d->note('Ptqn', $d->kick);
    $d->note('Ptqn', $d->kick);
    $d->note('Ptqn', $d->snare);
    $d->note('Ptqn', $d->snare);

    $d->note('Qtqn', $d->kick);
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 40));
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 30));
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 20));
    $d->note('Qtqn', $d->snare, 'v' . ($d->volume - 10));
    $d->note('Qtqn', $d->snare, 'v' . $d->volume);

    # 24 (9)
    $d->note($d->whole, $d->kick, $d->ride1);

    # 25 (10)
    $d->rest($d->quarter);

    $d->roll($d->eighth, $d->thirtysecond, $d->hi_bongo);
    $d->note($d->thirtysecond, $d->hi_bongo);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->low_bongo);

    $d->note($d->triplet_sixteenth, $d->closed_hh);
    $d->note($d->triplet_sixteenth, $d->kick);
    $d->note($d->triplet_sixteenth, $d->snare);
    $d->note('Ben', $d->kick);
    $d->note('Ben', $d->kick);
    $d->note('Ben', $d->snare);
    $d->note('Ben', $d->kick);
    $d->note('Ben', $d->kick);

    $d->rest('Cqn');
    $d->flam('Cqn', $d->hi_bongo, $d->hi_bongo, ACCENT);
    $d->note('Cqn', $d->low_bongo);
    $d->note('Cqn', $d->hi_floor_tom);
    $d->roll('Cqn', $d->thirtysecond, $d->low_bongo);

    # 26 (11)
    $d->flam('Cqn', $d->hi_bongo, $d->hi_bongo, ACCENT);
    $d->note('Cqn', $d->low_bongo);
    $d->note('Cqn', $d->hi_floor_tom);
    $d->roll('Cqn', $d->thirtysecond, $d->low_bongo);
    $d->note('Cqn', $d->kick);

    $d->note('Cqn', $d->kick);
    $d->flam('Cqn', $d->hi_bongo, $d->hi_bongo, ACCENT);
    $d->note('Cqn', $d->low_bongo);
    $d->note('Cqn', $d->hi_floor_tom);
    $d->roll('Cqn', $d->thirtysecond, $d->low_bongo);

    $d->rest($d->half);

    # 27
    $d->rest($d->eighth);
    $d->rest('Ben');
    $d->note('Ben', $d->hi_bongo);
    $d->note('Ben', $d->hi_tom);
    $d->note('Ben', $d->hi_floor_tom);
    $d->note('Ben', $d->low_bongo);

    $d->note('Ben', $d->hi_bongo);
    $d->note('Ben', $d->kick);
    $d->note('Ben', $d->hi_tom);
    $d->note('Ben', $d->hi_floor_tom);
    $d->note('Ben', $d->low_bongo);
    $d->note($d->thirtysecond, $d->kick);
    $d->note($d->thirtysecond, $d->hi_bongo);
    $d->note($d->thirtysecond, $d->hi_tom);
    $d->note($d->thirtysecond, $d->hi_floor_tom);

    $d->note('Eqn', $d->hi_bongo);
    $d->note('Eqn', $d->kick);
    $d->note('Eqn', $d->hi_bongo);
    $d->note('Eqn', $d->kick);
    $d->note('Eqn', $d->hi_tom);
    $d->note('Eqn', $d->hi_floor_tom);
    $d->note('Eqn', $d->low_bongo);
    $d->note('Eqn', $d->kick);
    $d->note('Eqn', $d->snare);
    $d->note('Eqn', $d->snare);
    $d->note('Eqn', $d->kick);

    $d->note('Eqn', $d->hi_bongo);
    $d->note('Eqn', $d->kick);
    $d->note('Eqn', $d->hi_bongo);
    $d->note('Eqn', $d->kick);
    $d->note('Eqn', $d->hi_tom);
    $d->note('Eqn', $d->hi_floor_tom);
    $d->note('Eqn', $d->low_bongo);
    $d->note('Eqn', $d->kick);
    $d->note('Eqn', $d->snare);
    $d->note('Eqn', $d->snare);
    $d->note('Eqn', $d->kick);

    # 28
    $d->note($d->triplet_quarter, $d->closed_hh);
    $d->note($d->triplet_quarter, $d->kick);
    $d->note($d->triplet_quarter, $d->kick);

    $d->crescendo_roll([50, 100], $d->half, $d->thirtysecond);

    # 29
    $d->note('Ptqn', $d->snare);
    $d->note('Ptqn', $d->kick);
    $d->note('Ptqn', $d->kick);
    $d->note('Ptqn', $d->snare);
    $d->note('Ptqn', $d->snare);

    $d->note('Ptqn', $d->hi_tom);
    $d->note('Ptqn', $d->kick);
    $d->note('Ptqn', $d->kick);
    $d->note('Ptqn', $d->hi_floor_tom);
    $d->note('Ptqn', $d->hi_floor_tom);

    $d->note('Qtqn', $d->kick);
    $d->note('Qtqn', $d->low_bongo);
    $d->note('Qtqn', $d->low_bongo);
    $d->note('Qtqn', $d->hi_bongo);
    $d->note('Qtqn', $d->hi_bongo);
    $d->note('Qtqn', $d->low_bongo);

    $d->note('Eqn', $d->hi_bongo);
    $d->note('Eqn', $d->low_bongo);
    $d->note('Eqn', $d->low_bongo);
    $d->note('Eqn', $d->hi_bongo);
    $d->note('Eqn', $d->hi_tom);
    $d->note('Eqn', $d->kick);
    $d->note('Eqn', $d->kick);
    $d->note('Eqn', $d->low_bongo);
    $d->note('Eqn', $d->hi_tom);
    $d->note('Eqn', $d->low_tom);
    $d->note('Eqn', $d->hi_floor_tom);

    $d->note('Eqn', $d->kick);
    $d->note('Eqn', $d->snare);
    $d->note('Eqn', $d->snare);
    $d->note('Eqn', $d->hi_tom);
    $d->note('Eqn', $d->kick);
    $d->note('Eqn', $d->kick);
    $d->note('Eqn', $d->low_tom);
    $d->note('Eqn', $d->hi_floor_tom);
    $d->note('Eqn', $d->kick);
    $d->note('Eqn', $d->kick);
    $d->note('Eqn', $d->snare);

    # 30
    $d->note($d->quarter, $d->kick, $d->snare, $d->closed_hh);

    $d->rest($d->dotted_half);
}
