Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting error loading alsactl state files #1

Open
shaunaa126 opened this issue Dec 28, 2021 · 5 comments
Open

getting error loading alsactl state files #1

shaunaa126 opened this issue Dec 28, 2021 · 5 comments

Comments

@shaunaa126
Copy link

I am running latest raspberry pi os lite version, I have configured the config.txt file accordingly.. however I receive the following error when trying to load the state files:

pi@raspberrypi1:~/Downloads/Pi-Codec-master $ sudo alsactl restore -f IQaudIO_Codec_AUXIN_record_and_HP_playback.state
alsactl: set_control:1461: Cannot write control '2:0:0:Mic 1 Volume:0' : Remote I/O error
alsactl: set_control:1461: Cannot write control '2:0:0:Mic 2 Volume:0' : Remote I/O error
alsactl: set_control:1461: Cannot write control '2:0:0:Aux Volume:0' : Remote I/O error
alsactl: set_control:1461: Cannot write control '2:0:0:Mixin PGA Volume:0' : Remote I/O error
alsactl: set_control:1461: Cannot write control '2:0:0:ADC Volume:0' : Remote I/O error
alsactl: set_control:1461: Cannot write control '2:0:0:DAC Volume:0' : Remote I/O error
alsactl: set_control:1461: Cannot write control '2:0:0:Headphone Volume:0' : Remote I/O error
alsactl: set_control:1461: Cannot write control '2:0:0:Lineout Volume:0' : Remote I/O error
alsactl: set_control:1461: Cannot write control '2:0:0:DAC EQ Switch:0' : Remote I/O error
alsactl: set_control:1461: Cannot write control '2:0:0:DAC EQ1 Volume:0' : Remote I/O error

Any help is appreciated, it seems another user has the same issue: https://forums.raspberrypi.com/viewtopic.php?t=323725

@shaunaa126
Copy link
Author

@iqaudio are you able to help troubleshoot this? I am running latest Raspberry OS (Bullseye) on Raspberry Pi Zero 2 W hardware.

@shaunaa126
Copy link
Author

@iqaudio is there anyone who can help troubleshoot this issue?

@AlexMaghen
Copy link

@shaunaa126 - Well, it seems you and I are alone here. Last time you posted this question was a year and a half ago! I am now dealing with the same problem and am having a terrible time just getting audio to play out of the speaker connector on this board. If you've had any luck at all, I'd appreciate your help. It's surprising to me that these guys sell this thing but provide ZERO support for it.

@jwatt
Copy link

jwatt commented Nov 11, 2022

Does it help to explicitly specify the device by name by adding -D IQaudIOCODEC to the command? As in:

sudo alsactl restore -D IQaudIOCODEC -f IQaudIO_Codec_AUXIN_record_and_HP_playback.state

@GuillaumeRossolini
Copy link

GuillaumeRossolini commented Apr 13, 2023

Hi,

I had the same issue with a Raspberry Pi Zero W v1.1 and a headless RaspiOS install, and here is how I got it to work.

$ uname -a
Linux rpiaudio-zc 6.1.21+ #1642 Mon Apr  3 17:19:14 BST 2023 armv6l GNU/Linux

First, the instructions as I found them

$ cat /boot/config.txt | grep audio | grep -iv hdmi
# Enable audio (loads snd_bcm2835)
#dtparam=audio=on
dtoverlay=iqaudio-dacplus
$ cat ~/.asoundrc
pcm.!default {
        type hw
        card Zero
}
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: vc4hdmi [vc4-hdmi], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
$ docker run --rm --device /dev/snd mikebrady/sps-alsa-explore
> Device Full Name:    "hw:vc4hdmi"
  Short Name:          "hw:0"
  Shairport Sync can not use this device.
$ sudo alsactl restore -f /home/pi/Pi-Codec/IQaudIO_Codec_OnboardMIC_record_and_SPK_playback.state && echo ok || echo KO
No state is present for card vc4hdmi
alsa-lib main.c:1014:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -2
Found hardware: "vc4-hdmi" "" "" "" ""
Hardware is initialized using a generic method
No state is present for card vc4hdmi
KO
$ sudo alsactl restore -D IQaudIOCODEC -f /home/pi/Pi-Codec/IQaudIO_Codec_OnboardMIC_record_and_SPK_playback.state && echo ok || echo KO
alsactl: load_state:1763: Cannot find soundcard 'IQaudIOCODEC'...
KO

Now with fixes from various places

$ cat /boot/config.txt | grep audio | grep -vi hdmi
# Enable audio (loads snd_bcm2835)
#dtparam=audio=on
#dtoverlay=iqaudio-dacplus
dtoverlay=iqaudio-codec

$ cat ~/.asoundrc
pcm.!default {
        type hw
        card IQaudIOCODEC
}

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: vc4hdmi [vc4-hdmi], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: IQaudIOCODEC [IQaudIOCODEC], device 0: IQaudIO CODEC HiFi v1.2 da7213-hifi-0 [IQaudIO CODEC HiFi v1.2 da7213-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: IQaudIOCODEC [IQaudIOCODEC], device 0: IQaudIO CODEC HiFi v1.2 da7213-hifi-0 [IQaudIO CODEC HiFi v1.2 da7213-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

$ docker run --rm --device /dev/snd mikebrady/sps-alsa-explore
> Device Full Name:    "hw:vc4hdmi"
  Short Name:          "hw:0"
  Shairport Sync can not use this device.

> Device Full Name:    "hw:IQaudIOCODEC"
  Short Name:          "hw:1"
  This device seems suitable for use with Shairport Sync.
  Possible mixers:     "Headphone",0           Range:  63.00 dB
                       "Lineout",0             Range:  63.00 dB
                       "Mic 1",0               Range:  42.00 dB
                       "Mic 2",0               Range:  42.00 dB
                       "Aux",0                 Range:  69.00 dB
                       "Mixin PGA",0           Range:  22.50 dB
                       "ADC",0                 Range: 100011.24 dB
                       "ALC Max Analog Gain",0 Range:  36.00 dB
                       "ALC Max Attenuation",0 Range:  90.00 dB
                       "ALC Max Gain",0        Range:  90.00 dB
                       "ALC Max Threshold",0   Range:  94.50 dB
                       "ALC Min Analog Gain",0 Range:  36.00 dB
                       "ALC Min Threshold",0   Range:  94.50 dB
                       "ALC Noise Threshold",0 Range:  94.50 dB
                       "DAC",0                 Range: 100011.24 dB
                       "DAC EQ1",0             Range:  22.50 dB
                       "DAC EQ2",0             Range:  22.50 dB
                       "DAC EQ3",0             Range:  22.50 dB
                       "DAC EQ4",0             Range:  22.50 dB
                       "DAC EQ5",0             Range:  22.50 dB
  The following rate and format would be chosen by Shairport Sync in "auto" mode:
     Rate              Format
     44100             S32_LE

$ sudo alsactl restore -f /home/pi/Pi-Codec/IQaudIO_Codec_OnboardMIC_record_and_SPK_playback.state && echo ok || echo KO
No state is present for card vc4hdmi
alsa-lib main.c:1014:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -2
Found hardware: "vc4-hdmi" "" "" "" ""
Hardware is initialized using a generic method
No state is present for card vc4hdmi
KO

$ sudo alsactl restore -D IQaudIOCODEC -f /home/pi/Pi-Codec/IQaudIO_Codec_OnboardMIC_record_and_SPK_playback.state && echo ok || echo KO
ok

$ cat /etc/rc.local | grep IQaudIOCODEC
/usr/sbin/alsactl restore -D IQaudIOCODEC -f /home/pi/Pi-Codec/IQaudIO_Codec_OnboardMIC_record_and_SPK_playback.state

The .asound file isn't always required

This is Linux and most programs can probably target the sound device:

$ time aplay -D hw:vc4hdmi whatever.wav && echo ok || echo KO
Playing WAVE 'whatever.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
aplay: set_params:1343: Sample format non available
Available formats:
- IEC958_SUBFRAME_LE

real    0m0.055s
user    0m0.030s
sys     0m0.009s
KO

$ time aplay -D hw:IQaudIOCODEC whatever.wav && echo ok || echo KO
Playing WAVE 'whatever.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

real    0m6.747s
user    0m0.039s
sys     0m0.018s
ok

More useful testing with a network audio service

In this case an AirPlay server.

$ docker run --rm --device /dev/snd --network host mikebrady/shairport-sync --statistics -- -d hw:IQaudIOCODEC 
<snip/>
Server startup complete. Host name is rpiaudio-zc.local. Local service cookie is 1958647242.
Service "rpiaudio-zc" (/etc/avahi/services/ssh.service) successfully established.
Service "rpiaudio-zc" (/etc/avahi/services/sftp-ssh.service) successfully established.
Connection 2: Playback started at frame 2066952694 -- AirPlay 2 Buffered.
Sync Error ms | Net Sync PPM | All Sync PPM | Output FPS (r) | Output FPS (c)
        -0.14            5.7            5.7              N/A              N/A
        -0.21           17.0           17.0         44100.05         44099.14
         0.10            5.7            5.7         44099.99         44099.09
         0.14           14.2           14.2         44099.67         44098.79

The numbers here are statistics this particular server outputs on stdout every few seconds, as long as music is playing.

=> The Codec Zero card is working. Don't forget to check the schematics to ensure you're not using the Jack mic input to plug the headphones ;)

I'm suggesting this for the main documentation at
https://www.raspberrypi.com/documentation/accessories/audio.html#codec-zero-configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants