Skip to content

Instantly share code, notes, and snippets.

@ology
Last active April 21, 2026 09:33
Show Gist options
  • Select an option

  • Save ology/9bb1a752507e570f602a506a0cd1c674 to your computer and use it in GitHub Desktop.

Select an option

Save ology/9bb1a752507e570f602a506a0cd1c674 to your computer and use it in GitHub Desktop.
Not getting clock ticks with get_message_decoded()
#!/usr/bin/env perl
use v5.36;
use feature 'try';
use Data::Dumper::Compact qw(ddc);
use MIDI::RtMidi::FFI::Device ();
my $port_name = shift || 'iac'; # on a mac
$SIG{INT} = sub {
say "\nStopping...";
exit;
};
my $device = RtMidiIn->new;
try { # this will die on Windows but is needed for Mac
$device->open_virtual_port('RtMidiIn');
}
catch ($e) {}
$device->open_port_by_name(qr/\Q$port_name/i);
print "Listening on '$port_name'...\n";
while (1) {
my $event = $device->get_message_decoded;
if ($event) {
say ddc $event;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment