Algorithm-Gutter
view release on metacpan or search on metacpan
eg/rainmidi3000.pl view on Meta::CPAN
#!/usr/bin/env perl
# rainmidi3000.pl - an example Algorithm::Gutter script, where random
# holes in a gutter either produce MIDI note events or toggle other
# holes on or off over time, as fed by changing amounts of rainfall.
# There are lots of things to TWEAK.
use v5.26.0;
use Algorithm::Gutter 0.02;
use Data::Dumper;
use List::Util 'shuffle';
use MIDI;
my $out_file = shift // 'out.midi';
my $ch = 0; # MIDI channel (9 for drums)
my $tick = 32; # default duration (dtime)
# So you can figure out how things were wired up if you actually get
# good results from this thing, unless you are on OpenBSD, or this code
# is somehow incorrect.
eg/rainmidi3000.pl view on Meta::CPAN
sound( $offset, @pitches );
} else {
$offset += $tick + ticknoise();
}
my $r = $gobj->slosh( $slosh_iters // ~0 );
unless ( defined $slosh_iters ) {
$slosh{$r}++;
}
}
unless ( defined $slosh_iters ) {
warn Data::Dumper->Dump( [ \%slosh ], ['slosh_iters'] );
}
}
MIDI::Opus->new(
{ format => 0, ticks => 96, tracks => make_track() } )
->write_to_file($out_file);
########################################################################
#
# SUBROUTINES
( run in 0.422 second using v1.01-cache-2.11-cpan-4d50c553e7e )