💾 Archived View for thrig.me › blog › 2023 › 10 › 02 › midibank.pl captured on 2024-07-09 at 01:43:40.
⬅️ Previous capture (2023-11-04)
-=-=-=-=-=-=-
#!/usr/bin/perl # midibank.pl - try out MIDI bank select operations. will doubtless # require tweaks depending on the soundfont file or synth involved use 5.36.0; use MIDI; sub CHAN () { 0 } sub NOW () { 0 } sub MSB () { 0 } sub LSB () { 32 } my $file = shift // 'out.midi'; my @Events = ( #[ control_change => NOW, CHAN, MSB, 0 ], [ text_event => NOW, "steel guitar?" ], [ patch_change => NOW, CHAN, 25 ], [ note_on => NOW, CHAN, 60, 100 ], [ note_off => 96, CHAN, 60, 0 ], [ note_on => NOW, CHAN, 60, 100 ], [ note_off => 96, CHAN, 60, 0 ], [ note_on => NOW, CHAN, 60, 100 ], [ note_off => 96, CHAN, 60, 0 ], [ control_change => 96, CHAN, MSB, 16 ], [ text_event => NOW, "mandolin?" ], [ patch_change => NOW, CHAN, 25 ], [ note_on => NOW, CHAN, 60, 100 ], [ note_off => 96, CHAN, 60, 0 ], [ note_on => NOW, CHAN, 60, 100 ], [ note_off => 96, CHAN, 60, 0 ], [ note_on => NOW, CHAN, 60, 100 ], [ note_off => 96, CHAN, 60, 0 ], ); MIDI::Opus->new( { tracks => [ MIDI::Track->new( { events => \@Events } ) ] } ) ->write_to_file($file);