Open unosonic opened 1 week ago
Which ALSA configuration file are you using?
none, or the following one in /etc/asound.conf:
pcm.mymic {
type dsnoop
ipc_key 1024
ipc_key_add_uid false # let multiple users share
ipc_perm 0666 # IPC permissions for multi-user sharing (octal, default 0600)
slave {
pcm "hw:IQaudIOCODEC" # the actual device
channels 2
rate 44100
period_size 1024
buffer_size 4096
}
I've been using it a lot, since I need a shared alsa device. Works fine on quite many pi zeros /w IQAudio zero and Debian 11 based images.
The only difference when calling e.g. arecord -f cd -d 3 -D mymic test.wav
is that the command doesn't throw that error, but instead never returns.
You do need to use a configuration file to put the card into different modes - that's the reason for this repository's existence. See the README for details.
The first time I tried a record without loading a configuration file, it failed with:
arecord: pcm_read:2221: read error: Input/output error
After loading one of the three record-capable configuration files I was able to capture audio without error. I then tried the Playback-only file and was still able to record. It's possible that some configuration was left over from the other files, and that's what allowed it to work.
Later, after a power-cycle, capture worked without configuration - perhaps the card comes up with some semi-random state, sometimes being capable of capture and sometimes not. I was not able to try capture with the playback-only configuration after previously being unable to capture - the bad state was elusive despite several attempts.
sorry not having mentioned it, I did that before with a working state file, but tried again with:
sudo alsactl restore -f Codec_Zero_StereoMIC_record_and_HP_playback.state
which results in:
alsa-lib main.c:1541:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -2
arecord still fails with pcm_read:2221: read error: Input/output error
error: failed to import hw:0 use case configuration -2
is not really an error. In each case, if you read the next line it will say something like:
No state is present for card Headphones
or
No state is present for card vc4hdmi0
In other words, ALSA is complaining that the configuration file doesn't mention all the soundcards that exist in the system - which is annoying, but it shouldn't cause any problems.
I'm running a current Bookworm image and a 6.6 kernel with no such issues - I can play and record.
OK, try this:
git clone https://github.com/raspberrypi/Pi-Codec.git
sudo alsactl restore -f Pi-Codec/Codec_Zero_AUXIN_record_and_HP_playback.state
- report the output.speaker-test -c 2 -D hw:CARD=IQaudIOCODEC -l 1
arecord -f cd -d 3 -D hw:CARD=IQaudIOCODEC record.wav
all new, even an unused IQAudio Zero board (I have several in the grab box...) no luck.
pi@raspberrypi:~ $ hostnamectl
Static hostname: raspberrypi
Icon name: computer
Machine ID: 6fa972868d314130a509b427afd530d0
Boot ID: fc4c77fbd452447aba0d8c50076d09f6
Operating System: Debian GNU/Linux 12 (bookworm)
Kernel: Linux 6.6.31+rpt-rpi-v8
Architecture: arm64
pi@raspberrypi:~ $ sudo alsactl restore -f Pi-Codec/Codec_Zero_AUXIN_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
alsa-lib main.c:1541:(snd_use_case_mgr_open) error: failed to import hw:1 use case configuration -2
No state is present for card vc4hdmi
alsa-lib main.c:1541:(snd_use_case_mgr_open) error: failed to import hw:1 use case configuration -2
Found hardware: "vc4-hdmi" "" "" "" ""
Hardware is initialized using a generic method
No state is present for card vc4hdmi
pi@raspberrypi:~ $ speaker-test -c 2 -D hw:CARD=IQaudIOCODEC -l 1
speaker-test 1.2.8
Playback device is hw:CARD=IQaudIOCODEC
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 8 to 131072
Period size range from 4 to 65536
Using max buffer size 131072
Periods = 4
was set period_size = 32768
was set buffer_size = 131072
0 - Front Left
1 - Front Right
Write error: -5,Input/output error
xrun_recovery failed: -5,Input/output error
Transfer failed: Input/output error
pi@raspberrypi:~ $ arecord -f cd -d 3 -D hw:CARD=IQaudIOCODEC record.wav
Recording WAVE 'record.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
arecord: pcm_read:2221: read error: Input/output error
I've also jus tested that virgin 64bit image with a raspberry pi4 and yet another iqaudio board, same errors. I forgot to mention that I'm using the bookworm lite version. Will create a new image with full install...
tried also with 64bit desktop and 32bit lite version, same errors. It also fails on a raspberry pi zero WH w/ 32bit image. everything bookworm fails on various hardware it seems. are the different IQAudio revisions around? some hidden switches? I have built about 30 pi zero wh together with this board, all on bullseye based images, and have never seen this problem.
ok, here we go. I've just upgraded to kernel: Linux 6.6.47+rpt-rpi-v8 that works. As I assumed, must have been a driver/alsa issue. I've tried about 5 different kernels during the last months, without success. this is the first which does the job.
hi there, IQAudio Codec Zero doesn't work together with Raspberry OS / Bookworm:
Hardware: Pi Zero, Pi Zero2, IQAudio Code Zero hat Operating System: Debian GNU/Linux 12 (bookworm), Kernel: Linux 6.6.31+rpt-rpi-v8, Architecture: arm64
the card is present, as shown:
pi@birdy2:~ $ arecord -L null Discard all samples (playback) or generate zero samples (capture) hw:CARD=IQaudIOCODEC,DEV=0 IQaudIOCODEC, IQaudIO CODEC HiFi v1.2 da7213-hifi-0 Direct hardware device without any conversions plughw:CARD=IQaudIOCODEC,DEV=0 IQaudIOCODEC, IQaudIO CODEC HiFi v1.2 da7213-hifi-0 Hardware device with all software conversions default:CARD=IQaudIOCODEC IQaudIOCODEC, IQaudIO CODEC HiFi v1.2 da7213-hifi-0 Default Audio Device sysdefault:CARD=IQaudIOCODEC IQaudIOCODEC, IQaudIO CODEC HiFi v1.2 da7213-hifi-0 Default Audio Device dsnoop:CARD=IQaudIOCODEC,DEV=0 IQaudIOCODEC, IQaudIO CODEC HiFi v1.2 da7213-hifi-0 Direct sample snooping device
trying to record something: arecord -f cd -d 3 -D hw:CARD=IQaudIOCODEC test.wav Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo arecord: pcm_read:2221: read error: Input/output error
arecord -f cd -d 3 -D hw:0 test.wav Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo arecord: pcm_read:2221: read error: Input/output error
note: everything works fine on legacy images, i.e. Debian 11 based