Raspberry Pi, Jackd, Audio Injector - help!

Hi all -
I’ve looked for help on Stack Exchange and Reddit, speaking to Linux people and Rasberry Pi people, but no one in these places has been able to help. Maybe this subject will be special to people who use SuperCollider and someone here will have some information.

I am using a Rasberry Pi 4. I followed the directions by dyfer on Github. I am using the GUI-less build.

I am also using an Audio Injector Octo “hat” that plugs into the GPIO and allows for 8 channels of audio output.

ALSA seems to recognize the AudioInjector and allows me to make settings changes in the alsa mixer. Jackd, on the otherhand, seems to be an issue.
I try to route jackd to alsa with this line:

jackd -d alsa -r 44100 -P hw:2

But it causes a freeze.

When I attempt to boot SuperCollider, I get the following:

s.boot
-> localhost
sc3> Booting server 'localhost' on address 127.0.0.1:57110.
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.22
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2023 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 75
self-connect-mode is "Don't restrict self connect requests"
creating alsa driver ... hw:2,0|hw:2,0|1024|3|44100|0|0|nomon|swmeter|-|32bit
configuring for 44100Hz, period = 1024 frames (23.2 ms), buffer = 3 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 3 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 3 periods for playback
driver: cannot register port for system:playback_8
Cannot attach audio driver
JackTemporaryException : now quits...
JackServer::Open failed with -1
Failed to open server
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
could not initialize audio.
Server 'localhost' exited with exit code 1.

Any suggestions or advice would be greatly appreciated. I have been stuck on this for months now.

Thank you!

Any suggestions or advice would be greatly appreciated. I have been stuck on this for months now.
List Index - lists.linuxaudio.org

1 Like

I’m afraid many of these listservs are more or less dead.

Hello,

I managed to get SC working on a RasPi 3 a few years ago, with a ‘justBoom DAC HAT’ shield. I had to setup a few things but I don’t remember which steps. But I don’t think it would help here.

Trying a few web searches about this, it would seem that jack is quite buggy on Raspbian.

Apparently, the good old pulseaudio server might be preventing jack to run correctly (this was a common issue in Linux systems until recently).

I think you can try to

killall pulseaudio

before setting jack up and see if the results are better ?

Unfortunately, that didn’t solve the issue on the post I linked above.

Or just uninstall it? If that’s a RasPi, maybe that would make sense.

Side note: With Pipewire now integrated into all major distributions, I’ve noticed that the low-latency performance isn’t quite the same for me. Is anyone here experiencing the same performance Pipewire as before with jack?

What are you guys using right now? I attempted to switch back to JACK, but that led to other functionalities breaking.

I can’t help you much more with this, because I don’t have a RPi to try things out :frowning: .

But yeah, I didn’t propose to remove pulseaudio completely, because this is brutal and might remove OS sounds, but that’s what I did on every OS installation so far, unless pulseaudio and JACK could coexist natively (I don’t remember if it’s the case with my current Ubuntu, or if I removed it). If you know what you’re doing, you should definitely try this. And if everything breaks, reinstalling Raspbian isn’t that painful.

I think your issue is really just to get JACK to work on RPi 4. There seems to be a lot of topics about this issue on the internets. You might have to try out a few solutions before finding the correct one :confused: .


Regarding Pipewire, I didn’t try it. I mean I tried to fix an issue with it, and it was so confusing that I abandoned. Jack is working perfectly (at least on AMD…), and if it ain’t broke, I don’t see any reason to fix it.

From what I read, it would seem that Pipewire isn’t designed to improve music making, but to ease ‘standard user experience’. I might be wrong, but I think one of it’s goal is to separate softwares contexts to enforce security. If you have two softwares running, their graphical context are strictly separated so a ‘virus’ cannot try to navigate between the two, trying to exploit security flows between them to get access to somewhere it would like to do nasty things.

That’s one problem I had with Flatpaks (and it should be the same with Ubuntu’s Snaps). They try to run in an autonomous context so they communicate as less as possible with the OS, effectively preventing security issues. But doing so, they remove the ability to communicate with other softwares : I installed LMMS Flatpak version, and it couldn’t connect to JACK at all… Well, I’ll pass then. There’s a post on the internets saying that Flatpak and JACK are by nature incompatible. But I think Pipewire has a way to fix this. When I tried, I quickly ended up with 5 different technologies manual open, saying ‘do this, do that’, etc. I didn’t want to send a month trying to understand what was going on.

From the user’s point of view, thinking beyond “pro audio”, pipewire is an incredible advancement. Everything works perfectly, whatever the application, just like on macOS. With the advantage of having all jackd features, like connection features between applications, etc.

I read that the performance is similar to jackd, but I haven’t had that experience YET. Maybe I don’t know how to adjust the configuration properly, or there is a problem with permissions regarding the kernel’s realtime scheduling. The documentation is a disaster, very hard to get information in order to tweak the system. My system with jackd was unbeatable, but with those eventual small problems when you mix ‘pro audio’ applications with web browsers etc.

And this way, I doubt the software will be able to use permissions to use things like real-time scheduling. For audio, I think it would be harder to use the full potential of the system.

Hi there,

I removed Pulse, so I don’t think that’s the issue…

Someone else recommended Pipewire also - but I’m a little confused about what I have to do in order to get it up and running with SC. Do I need to disable Jackd to use it?

The approach in the git link posted above uses Jack and works fine - introducing the “AudioInjector” seems to bring about the trouble. If I understand things correctly, Jackd works in between SuperCollider and ALSA - and ALSA is supposed to then interact with the AudioInjector. Maybe that complexity is just not possible?

Yes, you need to remove jackd and install the pipewire jack plugin. It just works with jack applications.

Jack should work fine. Are you sure that 2 is the correct hardware card? Try running aplay -l again. The number changes between boots randomly. It’s better to use the device name instead, found in the same list in alsa.

I’m afraid many of these listservs are more or less dead.

Is this an informed guess? The statistics and archive at
https://lists.linuxaudio.org/hyperkitty/list/linux-audio-user@lists.linuxaudio.org/
suggest otherwise.

I suppose that list might have had helped with the jack problem by now…

No, I’ll try that one. The other 5 lists have less than 4 members.

Jack should work fine. Are you sure that 2 is the correct hardware card? Try running aplay -l again.

Yes - I have tried this. Is there anything else I should try?

I would try another audio interface. In a situation like this, the easiest is to rule out problems like that one by one.

Also, I normally start jack before starting supercollider on Pi. Not sure if it will make a difference.

If you just run your jack command jackd -d alsa -r 44100 -P hw:2 on the command line, does it work? If it doesn’t, then the problem has nothing to do with SC but either your audio interface or the jack command itself. Some audio interfaces can be extremely finicky about which settings to use, eg some might not work with 512 as block size, some only support 44.1 khz or whatever. I would also recommend trying to specify the number of channels in and out in your jack command if it’s a multi channel thing.

For example, to try with just the headphone jack on the pi:

/usr/bin/jackd -P95 -dalsa -dhw:Headphones -r44100 -p512```
1 Like

Yes - I think the audio interface is the main part of the problem - I’m able to run SC with jack in other scenarios quite easily.

I would also recommend trying to specify the number of channels in and out in your jack command if it’s a multi channel thing.

This seems like it could work - do you know the command to do that? I’m a little bit at a loss for finding Jack documentation.

If you run jackd -h on the command line, it should tell you what the flags are :slight_smile:

Alright, with more consideration of the flags, I tried:
jackd -d alsa -r 44100 -i 6 -o 8 -s 16 -P hw:2

The terminal responds with the following:

jackdmp 1.9.22
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2023 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
creating alsa driver ... hw:2|-|1024|2|44100|0|8|nomon|swmeter|-|32bit
configuring for 44100Hz, period = 1024 frames (23.2 ms), buffer = 2 periods
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback

After this prints, I seem unable to type commands.

Looks like it works ! You can run jackd ans any process in the background by adding the &

Just don’t close this particular terminal, otherwise you will have no sound anymore :slight_smile: . That’s the danger of using &.