This is the MIDI example from Tinyusb, tweaked and configured such that it'll compile on a Raspberry Pi Pico out of the box.
It uses a highly similar CMake configuration to the Raspberry Pi Examples, so should be compilable in a very similar way: I'm just cribbing from the "Getting started with Raspberry Pi Pico" document.
When compiled successfully, the Pico will appear as a USB MIDI Device, emitting a stream of note data. You can connect this to a software synthesizer, or view it in a MIDI monitor tool to confirm success.