Open cubedmeatgoeshere opened 4 months ago
Thanks for reporting this. I don't know how to fix this personally, but I'll try raising it internally and report back if we get anywhere. I strongly suspect that Bookworm broke something here, but I'm not sure what.
Hi @nathan-contino I've looked a several GH tickets relating to troubles with some RPi sound cards and worked with customers reporting some similar things, and while there is a diverse spectrum of issues out there (some valid, some not), it's maybe worth stepping back a little first before deciding how to address some of the issues folks have.
Since our online docs mention creating ~/.asoundrc
it's worth mentioning first of all that the pulse audio applet in the Raspberry Pi OS UI deletes it if it exists.
Most (all?) modern Linux distros use pulseaudio or pipewire for audio control - for example it properly mixes audio from multiple sources, makes changing source more reliable, provides a high level API for audio apps to use, etc. Out of the box, a lot of audio apps talk to pulse or pipe by default, and pulse/pipe talk to ALSA. While it is absolutely okay for a user to create ~/.asoundrc
, this file can only really be used if one is talking directly to ALSA. Our UI deletes this file because the 'direct' ALSA configuration it applies can break things between the UI's view of the audio resources/configuration and what's underneath.
IMHO if someone wants to use raw ALSA, the best thing to do is just to uninstall the pulse controller applet from the taskbar (right-click the taskbar, choose Add/Remove Plugins, and remove it). If they create ~/.asoundrc
it won't be deleted and they can use alsamixer or whatever as they wish.
Which leads on to some of our online doc info, eg setting up a Codec Zero, and some niggles I think we should try and address, including:
~/.asoundrc
but for the reason above, I don't think we should recommended that if using the UI.alsa restore
command to load the statefile(s) for the desired device config, the apparent errors reported (eg #3292) are not actually indicative of a problem. It's unhelpful that they are reported as such but it's outside our control (and we don't want to say 'ignore any errors').~/.asoundrc
is deleted, the default sound card may not still be the expected default, meaning that using aplay
without -D
to play audio from the desired card may result in obscure errors (and confusion). It also means that using -D hw:0,0
may not identify the desired card.If using the UI and we do still need to 'bootstrap' a sound card configuration, I suggest we consider using pactl instead of alsa restore
. Unfortunately, I'm not in a position to be able to offer any advice on that as it's outside my area of expertise.
Maybe we can chat about this 1:1 and get some input from other folks at Pi to perhaps decide on the best way to tweak the documentation.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi
I have a Codec Zero on a Pi Zero 2 W running the latest PiOS Lite 64bit Bookworm in headless configuration
However these alsactl restore commands always fail:
alsactl restore -f ~/Pi-Codec/Codec_Zero_StereoMIC_record_and_HP_playback.state
alsactl restore -D Zero -f ~/Pi-Codec/Codec_Zero_StereoMIC_record_and_HP_playback.state
alsa-lib main.c:1541:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -2
This is probably a harmless error. See https://github.com/raspberrypi/documentation/pull/3855
And when I try using the device with
arecord -D hw:0,0 -f cd test.wav
, I get this errorRecording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo arecord: pcm_read:2221: read error: Input/output error
This likely means there is a low level hardware issue. Examining dmesg may show other kernel errors. I would examine the output of aplay -l
after this error to list the supported devices in the system. hw:X,Y
means hardware:<card number>,<device number>
and it may change between boots depending on devices pluged/unplugged. Also note that hw:0,0
means the default device on the default sound card [1].
I have a Codec Zero on a Pi Zero 2 W running the latest PiOS Lite 64bit Bookworm in headless configuration
/proc/device-tree/hat/name:hat /proc/device-tree/hat/product:Pi-CodecZero /proc/device-tree/hat/product_id:0x0013 /proc/device-tree/hat/product_ver:0x0001 /proc/device-tree/hat/uuid:e15c739c-877d-4e29-ab36-4dc73c21127c /proc/device-tree/hat/vendor:IQaudIO Limited www.iqaudio.com
I've been following the standard documentation on how to configure this HAT via https://www.raspberrypi.com/documentation/accessories/audio.html
Steps taken: edited /boot/firmware/config.txt:
dtparam=audio=on
dtoverlay= dtoverlay=rpi-codeczero
Added pcm.!default { type hw card Zero } to .asoundrc
However these alsactl restore commands always fail:
alsactl restore -f ~/Pi-Codec/Codec_Zero_StereoMIC_record_and_HP_playback.state
alsactl restore -D Zero -f ~/Pi-Codec/Codec_Zero_StereoMIC_record_and_HP_playback.state
alsa-lib main.c:1541:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -2
The device seems like it's loaded: arecord -l List of CAPTURE Hardware Devices card 0: Zero [RPi Codec Zero], device 0: Raspberry Pi Codec Zero HiFi da7213-hifi-0 [Raspberry Pi Codec Zero HiFi da7213-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0
and alsamixer shows the device and I can play around with input levels but I don't see how I can turn on/off inputs/outputs with spacebar or any other key
And when I try using the device with
arecord -D hw:0,0 -f cd test.wav
, I get this errorRecording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo arecord: pcm_read:2221: read error: Input/output error
I've tried many permutations of configurations including disabling HDMI via
#dtoverlay=vc4-kms-v3d
This may be related to the following other issues: https://github.com/raspberrypi/documentation/issues/3593 https://github.com/raspberrypi/documentation/issues/3292#issuecomment-1911443719
Also this may be specific to a recent update and/or Bookworm because I was using this HAT w/ this very Pi on 64 bit Lite Bullseye perfectly fine a few months ago