I am working on a multi-instrument device, which will hopefully utilise SuperCollider as the sound synth for many of the instruments.
I am considering Raspberry Pi’s, as I can have 10 of them fitting in a small space, mobile, with low power needs. However the RPi3 does not seem to cope with reverb plus one instrument. I do not want to consider RPI4s yet as I have already have a number of RPI3s for testing, so I thought of reducing the RPi overhead.
scsynth loads as a daemon so I am wondering whether it is possible to send OSC remotely to the device running Jackd and scsynth without loading x display. i.e. No GUI. My tests so far throw no errors but no sound either, whereas sound works as soon as I load SuperCollider in the GUI.
I use the following to launch the scsynth:-
scsynth -t 57110 -B 0.0.0.0
I can find no documentation regarding scsynth without GUI or with CLI, so I am starting to think it has never been done because it needs x display libraries.
This is a very common use-case - there are at least one or two shipping commercial hardware devices that run headless SuperCollider, and many many third-party applications that use
scsynth as a standalone process they send messages to.
To diagnose the problem you’re having, I would suggest:
- When you are able to get SuperCollider working via the GUI workflow as you described…
Server.default.options.asOptionsString - this will give you the exact command line arguments that are being used to launch
scsynth in your successful use-case.
Server.default.dumpOSC(1) before booting the server and running your working test. This will dump all of the OSC commands being send to the server in your successful use-case.
With these two pieces of information, you should be able to compare with what you’re doing differently in the headless case, and diagnose what might be going wrong. Also note that, in general, you cannot easily build SynthDefs via OSC from other clients - you’ll probably have to build your SynthDefs in SuperCollider / sclang in the normal fashion, and then make sure you point your headless
scsynth to them to load. I believe this path can be set by the
SC_SYNTHDEF_PATH environment variable, but it’s worth reading the docs to learn more.
Also, if you haven’t yet found it, Frederik Olofsson maintains pre-built raspberry pi SuperCollider executables here: https://github.com/redFrik/supercolliderStandaloneRPI2
I’m not super familiar with how these were constructed, but there may be workarounds for RPI specific issues and gotchas - at least worth take a peek!
Also, in my experience: launching scsynth (and not sclang) doesn’t automatically connect scsynth to jack outputs. Hence, no sound…
So check that as well, you can connect jack using jack_connect
This is good news that it is a common use-case. Thank you for confirming scztt.
After writing my question, I found the https://github.com/redFrik/supercolliderStandaloneRPI1 and managed to get it working, although not exactly in the way described. The RPi2 does not seem to be man enough for the job as I am getting Jackd X Runs when using Reverb. I will try tomorrow with https://github.com/redFrik/supercolliderStandaloneRPI2 and a RPI3.
elgiano, you are spot-on correct. I needed to run sclang, which either needs x display or xvfb. Once I had xvfb installed I was able to run sclang, which loads scsynth and they all talk to one another and I had sound.
Thank you both for very accurate, informative and prompt responses.
Worst case is that I run it without reverb and use a Guitar reverb unit. I am a believer for right tool for the job.
Just to make sure: you don’t need to run sclang unless you want to.
You can have scsynth listening to a network address and control it with OSC or with a sclang process running on a different machine.
scsynth can also autoconnect to jack, on linux, by setting env variables. This command:
SC_JACK_DEFAULT_OUTPUTS="system" SC_JACK_DEFAULT_INPUTS="system" scsynth -u 57100 -B 0.0.0.0
will start scsynth on udp port 57100, and automatically connect its inputs and outputs to “system”.(-B 0.0.0.0 as you already know, it’s for scsynth to be able to communicate on a network)
Searching is difficult, but I know that there are extensive threads on the email list about RPI as well - you can find the archives here: http://www.listarc.bham.ac.uk/marchives/sc-users/
And, I do know that - one critical piece of getting good performance from SuperCollider (and audio applications in general…) on embedded devices is enabling the correct realtime kernel extensions. There are a million guides / articles about this around the internet, though I’m not knowledgeable enough about it to direct you to a specific one… Maybe someone more knowledgeable about linux / RT kernel stuff can point in a better direction?
At the very least: I think running a basic reverb like GVerb should be possible on RPI with scsynth - so if there are severe xruns, that smells like there may be another configuration issue?