Algorithm-Gutter

 view release on metacpan or  search on metacpan

eg/rainmidi3000.pl  view on Meta::CPAN

    [ text_event => 0, 'RAIN-MIDI 3000 ][' ],
    #[ patch_change => 0, $ch, 11 ],
    [ set_tempo => 0, 450_000 ],
);

my $gobj  = Algorithm::Gutter->new( rain => \&water );
my $glist = $gobj->gutter;

# The 'undef' are replaced with togglers, while the numbers are used to
# generate MIDI events with the given pitch number. Random pitches
# better suit random drum soundfonts. TWEAK
my $nbuckets = 32;
my @pitches  = shuffle( (undef) x 5, map getapitch(), 1 .. 13 );
#my @pitches = shuffle( (undef) x 5,
#    55, 56, 60, 61, 65, 67, 68, 72, 73, 77, 79, 80, 84 );
die "too many pitches\n" if @pitches > $nbuckets;
my $nholes = @pitches;

# Randomly allocate the toggler and pitch-generating cells. Planning
# where these go might get you better results?
{



( run in 0.591 second using v1.01-cache-2.11-cpan-5735350b133 )