Sclang can't boot jackd on rPi4

Hi everyone.

I’m attempting to get SC running on Raspbian Lite on an rPi4, headless.

I have everything working, sclang runs, jackd works when I start it from the cli. However, I can’t seem to get sclang to boot the server and start jack successfully, it always fails with:

ALSA lib control.c:1375:(snd_ctl_open_noupdate) Invalid CTL 75
control open "75" (No such file or directory)
audio_reservation_init
ALSA lib control.c:1375:(snd_ctl_open_noupdate) Invalid CTL 75
Acquire audio card Audio0
control open "75" (No such file or directory)
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM 75
ALSA: Cannot open PCM device alsa_pcm for playback. Falling back to capture-only mode
creating alsa driver ... 75|-|512|3|44100|0|8|nomon|swmeter|-|32bit
JackTemporaryException : now quits...
Released audio card Audio0
ALSA lib control.c:1375:(snd_ctl_open_noupdate) Invalid CTL 75
control open "75" (No such file or directory)
Cannot initialize driver
audio_reservation_finish
JackServer::Open failed with -1
Failed to open server

… But when I run my .jackdrc ("source .jackdrc") file from the command line it boots jack successfully.

Alternatively, I’m trying to get jackd to start on boot, but i haven’t been able to figure out a way to do that reliably yet (after much searching).

I did my base setup following (more or less) this guide: Notes for setting up a Raspberry Pi 4 for audio work :: Mads Kjeldgaard — Composer and developer

Any help would be greatly appreciated.

Hi I had the same problem.
The only solution I’ve found is to use an external USB interface. Even a very cheap one should work.

You have to connect it and then configure manually Jack before booting SC

I hope it works for you as well

1 Like

How does your .jackdrc look?

Here’s the .jackdrc:

/usr/bin/jackd -P75 -dalsa -dhw:audioinjectoroc -r44100 -p16 -n3 -o8

And it works perfectly run from the cli directly.

As @maronid suggested, I might just have to write a shell script to start my SC script properly when the Pi boots, and in the script I can start Jack before starting SC.

I started my setup again from scratch, trying to do things in the most simple way possible to get a sense of what settings work with this audio device…

Starting from standard Raspberry Pi OS (with desktop) I installed the Octo device, Jack, and SC. Now it’s closer, with SC starting Jack successfully.

However, it doesn’t seem to be connecting ports automatically. I can get sound when I manually connect SC outs to Jack system playback ports. But I have to use jack_connect to do so, otherwise nothing is connected.

Should SC be automatically mapping server outputs to jack system ports? I don’t see anything about how to do this in the help files or searching the forum (and searching generally).

I could run the jack_connect commands from within SC … but from what I’ve read it seems like it should autoconnect the ports…

Thanks again for any help getting this all running.

See supercollider/README_LINUX.md at develop · supercollider/supercollider · GitHub

In general, it should auto-connect. Sclang in Linux initializes the SC_JACK_DEFAULT_OUTPUTS and SC_JACK_DEFAULT_INPUTS variables to “system” during language startup:

		// default jack port hookup
		// use "system" as default when env vars haven't been set by user
		if("SC_JACK_DEFAULT_INPUTS".getenv.isNil, {
			"SC_JACK_DEFAULT_INPUTS".setenv("system")
		});

		if("SC_JACK_DEFAULT_OUTPUTS".getenv.isNil, {
			"SC_JACK_DEFAULT_OUTPUTS".setenv("system")
		});

That’s in LinuxPlatform:startup, which runs automatically every time the language initializes – you shouldn’t have to do this by yourself.

We’re assuming that JACK’s name for the hardware inputs and outputs will be system:capture_x and system:playback_y respectively. Maybe this is different in RPi? (I’ve no idea because there’s no example here of a jack_connect command.) If so, you could override these system environment variables in your sclang startup file.

(Also I tested setting one of these to a wrong value – the connection attempt fails silently with no visible “connection failed” message. So I’d guess, either these variables are not set in your system [no connection attempt] or they are set to a port name that doesn’t exist [silent failure].)

hjh

1 Like

Thanks for that. Looking at the jack port names, it looks like it doesn’t have any prefix.

The jack_connect command that works is:

jack_connect SuperCollider:out_1 :playback_1

If I edit my startup.scd and manually assign the “SC_JACK_DEFAULT_OUTPUTS” to all individual :playback_# then it seems to work… but I can’t find any setting that auto connects all SC outs to corresponding jack playback ports without any prefix.

No prefix… I didn’t see that coming.

The individual connections in the environment vars are probably the best way to go, then.

May be worth adding to the RPi readme.

hjh

1 Like

The no prefix thing might also be because of this oddball soundcard – Audio Injector Octo. Which has a lot of its own strange quirks, but is easily the smallest multi-channel interface for the rPi.