Your CDSP config is a very important info for troubleshooting, please post it here.
Your chain has only one fixed clock - the DAC crystal clock. That clocks your RPi/CDSP playback soundcard. The other soundcard is the USB gadget (which determines sample consumption rate on the USB host for the player and sample production rate in CDSP capture thread), but its "clock" can be tuned by the async control. CDSP is able to monitor and determine the relative ratio of the capture and playback clocks and adjust the USB gadget "clock" accordingly - if told to do so via the enable_rate_adjust config. It even complains in the logs if that parameter is not set for the USB gadget device - I quoted that from your logs. Also Henrik describes meaning of the enable_rate_adjust param in the documentation
https://github.com/HEnquist/camilladsp?tab=readme-ov-file quite in detail.
My CamillaDSP config file that's been running for the past two days is the following:
YAML:
description: 'Audiophonics DAC HAT to W4 speakers.
Filters to optimize the W4 performance.'
devices:
adjust_period: null
capture:
channels: 2
device: default:CARD=UAC2Gadget
format: S24LE
type: Alsa
capture_samplerate: 96000
chunksize: 1024
enable_rate_adjust: true
playback:
channels: 2
device: default:CARD=sndrpihifiberry
format: S24LE
type: Alsa
queuelimit: null
rate_measure_interval: null
resampler: null
samplerate: 96000
silence_threshold: -60
silence_timeout: 10
stop_on_rate_change: null
target_level: null
volume_ramp_time: null
filters:
LPF1k:
description: null
parameters:
freq: 1000
q: 0.5
type: Lowpass
type: Biquad
W4 fix1:
description: null
parameters:
freq: 7500
gain: 8
q: 2
type: Peaking
type: Biquad
W4 fix2:
description: null
parameters:
freq: 13000
gain: 8
q: 2
type: Peaking
type: Biquad
W4 fix3:
description: null
parameters:
freq: 1000
gain: 2
q: 0.25
type: Peaking
type: Biquad
W4 global HPF1:
description: null
parameters:
freq: 20
type: HighpassFO
type: Biquad
W4 global HPF2:
description: null
parameters:
freq: 25
order: 4
type: LinkwitzRileyHighpass
type: BiquadCombo
mixers:
W4-mixer:
channels:
in: 2
out: 2
description: Includes -10 db gain for filter headroom.
mapping:
- dest: 0
mute: false
sources:
- channel: 0
gain: -10
inverted: false
mute: false
scale: dB
- dest: 1
mute: false
sources:
- channel: 1
gain: -10
inverted: false
mute: false
scale: dB
pipeline:
- bypassed: false
description: null
name: W4-mixer
type: Mixer
- bypassed: false
channel: 0
description: null
names:
- W4 global HPF2
- W4 global HPF2
- W4 fix1
- W4 fix2
- W4 fix3
type: Filter
- bypassed: false
channel: 1
description: null
names:
- W4 global HPF2
- W4 global HPF2
- W4 fix1
- W4 fix2
- W4 fix3
type: Filter
processors: {}
title: Audiophonics-W4
And for the record usb_g_audio.conf (one line):
options g_audio c_srate=44100,48000,88200,96000,176400,192000 c_ssize=4 c_chmask=3 p_chmask=0
The c_ssize=4 is there even though format in the yaml is S24LE, because lowering c_ssize to 3 would somehow not work. I'm trying to change as few things as possible at a time to see how a specific change affects, so it's 4 for now. Windows sees it as 32 bit sink in sound options.
It seems that I quite often get the
2024-09-18 17:55:40.001811 WARN [src/alsadevice.rs:138] PB: Prepare playback after buffer underrun
message when host PC is starting an audio stream. W10 does this a lot more than W11. I'm not sure how I could verify this, but I'm certain that some of the timestamps are when I
started playback. (I got two laptops and a dock on my desk. When switching from laptop to another, I connect the docks data cable to the laptop I'm using. The RPi is connected to the dock. The W10 gets much more playback hours.)
Actually I can repeat this. Pause playback on host pc, wait at least silence_timeout duration, and start playback. The log entry is stamped on the start of playback. Just pausing will not generate a log entry. Using W11 Spotify app. If I set the timeout low, like 2 seconds, it will trigger it if a song has that much continuous silence, like at the end of a song. Yup, 100 % return rate and always at when sound starts to come out again.
A chunk size of 1024 is a bit on the small side at 96 kHz. You can try doubling or quadrupling it.
Thanks, I just read your docs over github and noticed the same thing. I adjusted it now to see how it goes. I've been listening to music with increased buffer while writing this and I've seen log entries of the said kind while writing the last paragraph.
FWIW: The Audiophonics DAC officially supports B-variants of the RPi, but I'm currently using it on top of a Zero 2 W, because it seems to work without obvious audible issues. The Zero line is kind of low power implementation in the Raspberry family, I wonder if the SKU has any inherent problems for this kind of use? It's a better choice power-wise, because it can be comfortably powered by USB bus (less cable clutter). My 4B is still reserved for dev use, so I cannot pull it yet, but I have appropriate power/data splitter cable for it. The Zero currently uses the
dtoverlay=hifiberry-dac
driver that ships with the RPi OS. I'm not sure if it's exactly the correct one, but sound comes out.