$ plenv exec perl midi.pl
Not enough arguments for main::pedal_notes at midi.pl line 107, near "$note)"
BEGIN not safe after errors--compilation aborted at midi.pl line 150.
I got something similar working in Supercollider though, which has a lot of tools for these sort of things, eg: