Sonic pi 3.3 beta on Linux and midi port names


Finally, the latest spi version is very easy to install on ubuntu 18.04 (see the other posts) or 20.04.
Congratulations @samaaron and others to have simplified the installation process clap clap clap.

What this spi 3.3 version is changing as midi is concerned ? What issues are resolved ?

I notice the long long long long names for the midi ports. No way to make shorter ?

1 Like


The new midi system in SP on Linux uses rtmidi to find midi ports. This finds port names with a more ./sonic

Oops my last post got posted by mistake! I will remove it.
The development of the midi system places more emphasis on erlang than before, and uses a new module sp_midi developed by Luis Lloret to do so. It also now allows connected midi devices to be automtically updated in the list of devices when devices are added or removed. previously this didn’t work on mac computers. This resulted following the removal of the osmid binaries and instead introducing rtmidi. Unfortunately, on Linux this introduces a more involved device port string being generated. It has been sanitised a bit by removing an initial RTMidi at the front of each string, but in order to reduce it further some munging would have to be added to generate local port strings which would then be translated back again when sending midi signals out. The strings are more complex, but Sam has added autocompletion in use_midi_defaults port: ...... which means that you should be able to avoid having to type them out completely. The more familiar port names are still produced by the windows and mac files in rtmidi. So at present in beta builds you will get long port string with the initial name of the device repeated.

ok thanks for your explanations.

We should be able to get used to it without too much efforts :slight_smile:

Does this version has an impact on this point : MIDI Keyboard with Sonic Pi No Audio - #16 by samaaron

Hi, as Robin mentioned, the longer names are the direct result of switching MIDI backend to Rtmidi. These longer names are the choice of Rtmidi and only appear to be longer on Linux for some reason.

The issue with MIDI names containing multiple : is completely unrelated to this MIDI backend change but has been fixed and should work just fine with BETA-4.

Note that we still don’t have the resources to support Linux in any real capacity beyond supplying the source and improving the build instructions for intrepid users wishing to build their own software.

Our main platforms are macOS and Windows.

1 Like

To follow up on Sam’s comments, If you don’t care about channel or port then it is easiest to sync on "/midi*/note_on" for example. On Linux on my RPI the sync for the default midi through port would be on

Here the sections separated by :
midi (the type of sync event as opposed to osc for example)
midi_through_midi_through_port-0_145_0 (the port string detected by rtmidi)
1 (the channel on which the event was detected)
note_on (the type of midi event received)

NB there is no port number now as previously

Now you won’t get any : inside the port string, but only between the main sections.
I use this in my parse_midi_address function to extract the midi channel when required.