Hi all! I have a Raspberry Pi 3 Model B loaded with the latest Patchbox image. My Raspberry Pi has a PCM5102 chip which is properly connected according to these instructions which I want to use as its sound card. However, it seems nothing can connect to JACK even though it is able to get running. Namely, I’m having trouble with SuperCollider connecting when JACK is connected.
Here is my config.txt:
config.txt
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2
hdmi_mode=85
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18
# Additional overlays and parameters are documented /boot/overlays/README
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
#dtoverlay=pisound
#dtoverlay=i2s-mmap
dtoverlay=hifiberry-dac
# Automatically load overlays for detected cameras
camera_auto_detect=1
# Automatically load overlays for detected DSI displays
display_auto_detect=1
# Enable DRM VC4 V3D driver
#dtoverlay=vc4-kms-v3d
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
# Disable compensation for displays with overscan
disable_overscan=1
[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1
[all]
[pi4]
# Run as fast as firmware / board allows
arm_boost=1
[all]
maybe of most importance I made these changes:
dtparam=audio=on
#dtoverlay=pisound
#dtoverlay=i2s-mmap
dtoverlay=hifiberry-dac
This works in somuch that I can see the PCM5102:
> aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
Subdevices: 3/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 3/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 2: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 [HifiBerry DAC HiFi pcm5102a-hifi-0]
Subdevices: 0/1
Subdevice #0: subdevice #0
And it appears that JACK is working when selecting this sound card:
> systemctl status jack.service
● jack.service - JACK Server
Loaded: loaded (/lib/systemd/system/jack.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2024-02-01 04:18:14 GMT; 3min 3s ago
Main PID: 399 (jackd)
Tasks: 4 (limit: 1600)
CPU: 1.331s
CGroup: /system.slice/jack.service
└─399 /usr/bin/jackd -t 2000 -R -P 95 -d alsa -d hw:sndrpihifiberry -r 44100 -p 128 -n 3 -s -S
Feb 01 04:18:15 patchbox jackdrc[399]: jackdmp comes with ABSOLUTELY NO WARRANTY
Feb 01 04:18:15 patchbox jackdrc[399]: This is free software, and you are welcome to redistribute it
Feb 01 04:18:15 patchbox jackdrc[399]: under certain conditions; see the file COPYING for details
Feb 01 04:18:15 patchbox jackdrc[399]: JACK server starting in realtime mode with priority 95
Feb 01 04:18:15 patchbox jackdrc[399]: self-connect-mode is "Don't restrict self connect requests"
Feb 01 04:18:16 patchbox jackdrc[399]: creating alsa driver ... hw:sndrpihifiberry|hw:sndrpihifiberry|128|3|44100|0|0|nomon|swmeter|soft-mode|16bit
Feb 01 04:18:16 patchbox jackdrc[399]: ALSA: Cannot open PCM device alsa_pcm for capture. Falling back to playback-only mode
Feb 01 04:18:16 patchbox jackdrc[399]: configuring for 44100Hz, period = 128 frames (2.9 ms), buffer = 3 periods
Feb 01 04:18:16 patchbox jackdrc[399]: ALSA: final selected sample format for playback: 16bit little-endian
Feb 01 04:18:16 patchbox jackdrc[399]: ALSA: use 3 periods for playback
Now when I run SuperCollider in headless it loads fine:
> export QT_QPA_PLATFORM=offscreen; export DISPLAY=:0; export JACK_NO_AUDIO_RESERVATION=1; sclang
And it boots fine:
s.boot
-> localhost
sc3> Booting server 'localhost' on address 127.0.0.1:57110.
Found 0 LADSPA plugins
JackDriver: client name is 'SuperCollider'
SC_AudioDriver: sample rate = 44100.000000, driver's block size = 128
JackDriver: connected SuperCollider:out_1 to system:playback_1
JackDriver: connected SuperCollider:out_2 to system:playback_2
SuperCollider 3 server ready.
JackDriver: max output latency 8.7 ms
Requested notification messages from server 'localhost'
localhost: server process's maxLogins (1) matches with my options.
localhost: keeping clientID (0) as confirmed by server process.
Shared memory server interface initialized
But no audio comes out when I play a simple Sine wave:
> { Out.ar(0,SinOsc.ar(440)) } .play;
Synth('temp__2' : 1002)
I couldn’t really figure this out so I tried another experiment. I stopped the JACK service and started my own JACK using just the playback for hw:2
(my PCM5102):
sudo JACK_NO_AUDIO_RESERVATION=1 /usr/bin/jackd -d alsa -P hw:2 -S -r 44100
Now, when I boot SuperCollider it fails consistently:
> s.boot
Booting server 'localhost' on address 127.0.0.1:57110.
Found 0 LADSPA plugins
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
exec of JACK server (command = "#!/bin/sh") failed: No such file or directory
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
terminate called without an active exception
could not initialize audio.
Server 'localhost' exited with exit code 0.
which is odd, as these should be valid JACK settings.
Sorry for the long post. This is a long way of saying, I have no idea what’s going on and I would very much appreciate any assistance anyone can provide. If I missed something improtant, please let me know, of if there is something else I can try, please let me know.