Via Zuzebox’s Blog
The first part of this post are some instructions I wrote back in 2014 (more here)
NOTE: Setting the 31250 baud-rate this way only works for Raspbian kernel 3.18.11, the newer kernel Raspbian 4.xx has some issues.
Getting a MIDI 31250 Baud Rate on a Pi is not easy as it should be as 31250 is not a standard Pi baud-rate. But you can trick your Pi into it if you overclock (or rather underclock) the UART clock.
Each Friday is PiDay here at Adafruit! Be sure to check out our posts, tutorials and new Raspberry Pi related products. Adafruit has the largest and best selection of Raspberry Pi accessories and all the code & tutorials to get you up and running in no time!