Sonic Pi + Sunvox + Linux + Midi

So I’m interested in getting Sonic Pi to drive Sunvox ( on Linux. Should be possible since both support Midi, but …

Sunvox is a tiny, free, incredible- sounding soft synth written by a guy in Ekaterinberg, Russia

It supports a wide range of Linux sound options (see Preferences -> Audio -> Driver) including Alsa (Default/Auto), Jack, SDL, OSS.

Sunvox also supports Midi, at least when connected to Alsa; I can connect up a Korg NanoKey via USB (Preferences -> Midi -> ‘Korg NanoKey’) and play notes.

I can’t seem to get Sonic Pi to work on Linux using Alsa and so typically resort to using Jack, which I start as follows -

jackd -R -d alsa -d hw:1

With Sonic Pi running, Sunvox will no longer work in its default (Alsa) mode, so I change its driver to Jack and restart.

Now I have Sonic Pi and Sunvox both running (using Jack) and both making sound.

The problem is on the Midi front. ‘Korg NanoKey’ is no longer an option in Sunvox (Preferences -> Midi); and moreover I notice that if I press a key on the Nano, it is registered as an event in the Sonic Pi console!

My intention is to remove the Nano from the equation and have Sonic Pi trigger Sunvox via Midi messages. The immediate problem seems to be that I can’t configure Sunvox to receive those messages under Jack. The underlying issue is that I suspect I have configured Jack incorrectly or simply failed to connect the two synths in an appropriate fashion (should I be using qjackctl ?)

Hoping someone may be able to shed some light as to how to make these two amazing synths talk to each other.



have a look at ‘a2jmidi_bridge’, see: and let me know whether this helps.


1 Like

Hi, me again.

Actually it might be easier as described in the blog entry I mentioned. I did install a2jmidi and if I remember correctly, it comes with a command line utility called a2jmidi_bridge.

I do have this in my jack startup script and run it just after jack. As soon as it is started I find a2jmidi_bridge in my qjackctl-midi-tabs.

I can then connect e. g. midi-through to a2jmidi_bridge which I then can route to some software synth. This is how I connect e. g. my Arturia keyboard to Yoshimi or synAddSubFX etc.

1 Like

@Martin thanks for that. So am making some progress, I discovered Qjackctl, got it running, can see entries for SuperCollider (sonic-pi) and Sunvox in the Connections -> Audio tab. But before I take a look at a2jmidi I noticed that there are no items currently showing in the Connections -> Midi tab. Is this to be expected ? (perhaps so if sonic-pi only runs under Jack and Sunvox is configured to run the same way; perhaps they both need a2jmidi ?)

@Martin I also found this very informative, and chatted with the author

he recommends Patchage which looks like a potential alternative to a2jmidi, do you have any experience ?


yes I have tried it but basically it seems to do the same as the connection panel in qjackctl. And no, I do not think it is an alternative. a2jmidi is “is an application that bridges between the system MIDI ports and JACK.” As such it seems indispensible if you are working with applications which do not natively provide midi functionality in the jack-world (hope I did phrase this correctly). But maybe patchage does handle that also? I don’t know.

I did experiment with Carla (on Github). (Still I have to start a2jmidi_bridge in the background, see above.) I will have to put some further work into it, but it seems you can setup and manage your audio environement (including all softsynths as plugins) for Sonic Pi (and other) sessions quite well. See this video for a more indepth view…


By the way, my (very clumsy, but working) start script look like that:

#! /bin/bash
jackd -d alsa --device hw:USB --rate 44100 --period 256 & # Scarlett 2i2
sleep 1
qjackctl &
sleep 1
a2jmidi_bridge &
sleep 1
~/bin/carla2.0/Carla ~/projects/sonicpi/playground/config/carla/audio-test.carxp &
sonicpi &

The (brute force, but working) stop script once I am done and want to revive pulse-audio:

#! /bin/bash
killall -9 sonicpi sonic-pi m2o o2m beam.smp ruby &
killall -9 carla &
killall -9 a2jmidi_bridge &
killall -9 jackd jackdbus qjackctl &
killall -9 jackd jackdbus qjackctl sonicpi sonic-pi m2o o2m beam.smp

Any suggestions how to do this in a more elegant way are very appreciated :wink: .

1 Like

@Martin ok thanks very much I will experiment some more and report back!

One other thought. Can Sonic Pi be made to work on Linux with ALSA ? Or does it only work with Jack ?

Hi, as far as I know, it requires Jack. But - as I wrote - it should not be a problem to get sunvox integrated. I did ran it on my computer a few weeks ago, but didn’t do much with it. If I’ll find the time I will check again but I can’t promise anything.

@samaaron can u give official confirmation that SP on Linux requires Jack (not Alsa) ?

Yes, Sonic Pi on Linux currently requires jack due to SuperCollider requiring jack.

I believe there was some work on making an ALSA backend to SuperCollider, but it had issues :frowning:

A pure ALSA backend would be ace.

1 Like

Hmm I think I am not far away but no sound yet. See image below. I changed the Sunvox MIDI setting to Jack and it appeared in the writeable ports window. Am wondering why I can’t see SP in the readable ports window. I have a2jmidid running (as you can see in the Qjackctl window) but TBH not sure it is really required … SP only works with Jack and I have configured Sunvox to use Jack so not sure there is any ALSA component that needs bridging.

I feel like there is a missing connection somewhere, that maybe I need to patch SP to Sunvox via the Qjackctl patch bay. I have a feeling we are not very far away, all help welcome!

@Martin @samaaron

Well done for making progress. It’s quite possible that Sonic Pi’s MIDI system isn’t coming through jack but ALSA, whilst the audio is going through jack. You might want to ask some questions about osmid over on GitHub (osmid is the internal system Sonic Pi uses for MIDI):

Just a shot into the dark: I have in my jack-config (via qjackctl) under Settings - Parameter - Midi-Driver: seq. Might have something to do with it.

In any case I have no problems at all to get any Midi-signal routed via jack.

By the way, just to clear things up @juzbo : jack does depend on alsa but does provide much better ways to connect audio stuff than alsa. That is why it works on top of alsa. At least this is what I understood so far.

By the way, the screenshot you provided do not show any connections as far as I see. In my case I connect e. g. the Arturia Minilab to midi-through. midi-though goes into the a2jmidi_bridge. Then I can route this one to any softsynth. I will try and provide some screens of my setup - though I don’t know exactly when I have the time to do that…

@Martin do you have any references to Sonic Pi / SuperCollider in the Midi -> Readable Clients window ?

So my current major concern is that I whilst I see SuperCollider in Connections -> Audio, I can’t see any reference to SuperCollider in either Connections -> MIDI or Connections -> ALSA. This is true whether I am running a2jmidid or not. It is also in contrast to how Sunvox behaves, which when connected shows an entry in Connections -> Audio and also in Connections -> JACK (writeable). So it feels to me like the problem is on the SP side.

I feel like there are definitely people out there who have managed to get SP on Linux driving a hardware synth via MIDI. If so, what do you see in Connections -> MIDI and/or in Connections -> ALSA ?

@Martin @samaaron @robin.newman


I will document properly later when I have a bit more time. Many thanks to @Martin for his tips regarding a2jmidid and missing connections in QJackCtl -> Connections -> MIDI; these proved to be the key.


Glad to hear that :slight_smile:

So I thought it might be worth documenting how to get MIDI working with SP on Linux (Ubuntu 16.04) as, despite being relatively experienced, I struggled; and is a worthwhile goal because MIDI connectivity opens up a world of different sound possibilities for SP outside of the native SuperCollider engine.

This is written with the Sunvox softsynth in mind as a target (Sunvox is MIDI enabled) but what goes here almost certainly goes for other MIDI targets, whether software or hardware.

Linux Sound Background

I am absolutely not an expert here and encourage you to go read Ted Felix’s excellent guide -

but in summary -

  • ALSA (Advanced Linux Sound Architecture) is the part of the Linux kernel that talks to your sound-related hardware (sound cards and MIDI interfaces)
  • JACK is an extra layer over ALSA offering low latency and the ability to synchronize multiple audio sources

We need to use JACK rather than ALSA here because SuperCollider only works with JACK.


qjackctl is the best way to configure and manage JACK connections.

  • Setup -> Interface -> [ensure your native soundcard is picked; may require some experimentation]
  • Setup -> Midi Driver -> seq [this should be enabled by default]
  • Start [hit the start button]


Now if you happened to connect a Korg NanoKey keyboard to your Linux machine and launch Sunvox in its standard ALSA mode, everything “just works”. But if you configure/launch qjackctl and configure Sunvox for JACK, stuff no longer “just works” :frowning:

This is because ALSA MIDI and JACK MIDI are apparently different things.


Specifically, Sunvox can work with either, but the NanoKey seems to want to work in ALSA MIDI mode; so you force Sunvox to work in JACK MIDI mode, the two can no longer speak.

[why do all MIDI Readable Clients, whether NanoKey, SP or other, seem to want to work in ALSA MIDI mode only ?]

Fortunately this can be resolved by using a2jmidid, which bridges ALSA MIDI connections to JACK MIDI connections, so that our MIDI Readable Client can now talk to our MIDI Writeable Client.

a2jmidid --export-hw


Sunvox ( is an absolutely terrific sounding softsynth written by Russia’s equivalent of @samaaron, a guy called Alexander Zolotov. It is available for pretty much every platform you can name (Windows/Mac/Linux/ioS/Android). It is MIDI enabled. It can work with all the different Linux sound systems including ALSA and JACK. I am not paid to promote it :slight_smile:

Because SuperCollider only works with JACK we need to configure Sunvox to also use JACK; if you have JACK running and try to launch Sunvox in its default (ALSA) configuration, it will likely hang. So -

Preferences -> Audio -> Driver = JACK
Preferences -> MIDI -> MIDI Controller 1 = JACK

[you’ll probably need to do this in separate stages; configure Audio first without JACK running; then shutdown Sunvox, launch qjackctl (see above), re- launch Sunvox and configure MIDI, now JACK is shown as an available MIDI option]

Sonic Pi

Launch SP as normal :slight_smile:

Connecting SP and Sunvox via qjackctl

Ready to go. So, assuming -

  • qjackctl is running
  • a2jmidid is running
  • Sunvox is running and has been configured to use JACK as per above
  • SP is running

then your qjackctl Connect -> MIDI tab should look as follows

[I have added the connection manually, by selecting a source/target from each window and clicking ‘Connect’]

Then assuming you have a Sunvox module selected in the Sunvox UI, a quick SP script should allow you to hear a sound played in Sunvox.

midi_note_on 50
sleep 1
midi_note_off 50

All done. Phew! A world of possibilities opens up. I’m off to but a MIDI-to-CV controller for my Erica Pico :slight_smile:

Thanks to @Martin for some very helpful pointers.