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

use Data::Dumper::Compact 'ddc';
use lib map { "$ENV{HOME}/sandbox/$_/lib" } qw(MIDI-Chord-Guitar MIDI-Util);
use MIDI::Chord::Guitar;
use MIDI::Util;

my $score = MIDI::Util::setup_score(patch => 24, bpm => 120);

my $mcg = MIDI::Chord::Guitar->new;

for my $n (1 .. 4) {
    for my $spec (
        ['C3', '', 0],
        ['A2', 'm', 1],
        ['E2', 'm', 2],
        ['G2', '', 2],
    ) {
        my $chord = $mcg->transform(@$spec);
        $score->n('qn', $chord->[0], $chord->[3]);
        $score->n('en', $chord->[1]);
        $score->n('en', $chord->[2]);
        $score->n('en', $chord->[0]);
        $score->n('en', $chord->[3]);
        $score->n('qn', $chord->[1]);
    }
}

my $chord = $mcg->transform('C3', '', 0);
$score->n('wn', @$chord);

$score->write_score("$0.mid");
