Search code examples
craspberry-pimidimpichraspberry-pi2

How to output a midi note to a midi instrument in unix?


I am building a Raspberry Pi2 cluster (aka a bramble) with MPICH2 1.4.

I also have a Launchpad, which is a board of 64+ buttons, each of which can light up with 3 different colors. From what I understand, by sending a midi note to it, you can light any key up, and the color depends on the velocity of the midi note.

What I want to do, is I want to visualize how the data is passing from Pi to Pi by using the launchpad, but have no idea how to pass the midi note to the Launchpad using C only.

If someone could point me in the right direction, I would be forever grateful!

Thank you in advance,

-Alex


Solution

  • You could let somebody else do the work:

    system("amidi -p hw:1 -S '90 12 34'");
    

    Or write the MIDI bytes directly to /dev/midiXX (if the kernel has OSS emulation).

    Or use the snd_rawmidi_* functions to access the device directly (see the amidi source for details).