use 5.36.0;
my $ALL_SOUNDS_OFF = 120;
my $ALL_NOTES_OFF = 123;
my $CONTROL_CHANGE = 11 << 4;
my $midi_dev = shift // '/dev/rmidi0';
open my $midfh, '>', $midi_dev
or die "could not open MIDI device '$midi_dev': $!\n";
binmode $midfh;
$midfh->autoflush(1);
for my $channel ( 0, 9, 1 .. 8, 10 .. 15 ) {
printf $midfh "%c%c%c", $CONTROL_CHANGE | $channel, $ALL_NOTES_OFF, 0;
printf $midfh "%c%c%c", $CONTROL_CHANGE | $channel, $ALL_SOUNDS_OFF,
0;
# ... and in the event the synth don't grok the prior, also spam
# note_off at all the pitches
for my $pitch ( 0 .. 127 ) {
printf $midfh "\x80%c%c", $pitch, 0;
}
}
text/plain
This content has been proxied by September (ba2dc).