raspberry-pialsadebian-basedlibalsalibasound

Unable to use Alsaeq with Snapclient, but speaker-test works


I have installed alsaequal on a Raspberry Pi 4 B+ running Raspian and Snapclient (Linux snapclient 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux).

When I run:

speaker-test -D equal

the speaker test works and alsa equaliser can control the audio output using alsamixer -D equal.

When I list the audio devices available to Snapclient with:

snapclient -l

I get:

0: null
Discard all samples (playback) or generate zero samples (capture)

1: plugequal


2: equal


3: hw:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Direct hardware device without any conversions

4: plughw:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Hardware device with all software conversions

5: default:CARD=sndrpihifiberry
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Default Audio Device

6: sysdefault:CARD=sndrpihifiberry
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Default Audio Device

7: dmix:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Direct sample mixing device

but if I try to run:

snapclient -s 2

I get an error:

2024-02-12 11-10-17.610 [Info] (Snapclient) Version 0.27.0, revision 54a3d862
2024-02-12 11-10-17.627 [Info] (Avahi) (Browser) NEW: service 'Snapcast' of type '_snapcast._tcp' in domain 'local'
2024-02-12 11-10-17.628 [Info] (Avahi) (Browser) CACHE_EXHAUSTED
2024-02-12 11-10-18.075 [Info] (Avahi) Service 'Snapcast' of type '_snapcast._tcp' in domain 'local':
2024-02-12 11-10-18.076 [Info] (Avahi)  snapserver.local:1704 (192.168.0.237)
2024-02-12 11-10-18.080 [Info] (Controller) Found server 192.168.0.237:1704
2024-02-12 11-10-18.080 [Info] (Connection) Resolving host IP for: 192.168.0.237
2024-02-12 11-10-18.081 [Info] (Connection) Connecting
2024-02-12 11-10-18.099 [Notice] (Connection) Connected to 192.168.0.237
2024-02-12 11-10-18.099 [Info] (Connection) My MAC: "d8:3a:dd:8e:4b:58", socket: 8
2024-02-12 11-10-18.301 [Info] (Controller) ServerSettings - buffer: 1000, latency: 0, volume: 48, muted: 0
2024-02-12 11-10-18.302 [Info] (Controller) Codec: flac, sampleformat: 44100:16:2
2024-02-12 11-10-18.302 [Info] (Player) Player name: alsa, device: equal, description: <none>, idx: 2, sharing mode: unspecified, parameters: <none>
2024-02-12 11-10-18.302 [Info] (Player) Mixer mode: software, parameters: <none>
2024-02-12 11-10-18.302 [Info] (Player) Sampleformat: 44100:16:2, stream: 44100:16:2
2024-02-12 11-10-18.302 [Info] (Alsa) Using default buffer_time: 80 ms, default fragments: 4
ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_equal.so (/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_equal.so: cannot open shared object file: No such file or directory)
2024-02-12 11-10-18.303 [Error] (Alsa) Exception: Can't open equal, error: No such device or address, code: -6
2024-02-12 11-10-18.304 [Fatal] (Snapclient) Exception: Can't open equal, error: No such device or address
2024-02-12 11-10-18.304 [Notice] (Snapclient) Snapclient terminated.

I checked for libasound_module_pcm_equal.so and it can be found in /lib/aarch64-linux-gnu/alsa-lib/ but for some reason, Snapclient is trying to find it in /lib/arm-linux-gnueabihf/alsa-lib/

If I try and add a link:

sudo ln -s /lib/aarch64-linux-gnu/alsa-lib/libasound_module_* /lib/arm-linux-gnueabihf/alsa-lib/

I get the error:

ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_equal.so (/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_equal.so: wrong ELF class: ELFCLASS64)

My /etc/asound.conf looks like this:

ctl.equal {
    type equal;
}

pcm.plugequal {
    type equal;
    #slave.pcm "plughw:0,0";
    slave.pcm "plug:dmix"
}

pcm.equal {
    type plug;
    slave.pcm plugequal;
}

Any ideas how I can fix this?

Thank you.


Solution

  • So I managed to figure this out. I also realised I had an error in my /etc/asound.conf file in the original post, but I set it to:

    pcm.!default {
      type plug
      slave.pcm plugequal;
    }
    ctl.!default {
      type hw card 0
    }
    ctl.equal {
      type equal;
    }
    pcm.plugequal {
      type equal;
      slave.pcm "plughw:0,0";
    }
    pcm.equal {
      type plug;
      slave.pcm plugequal;
    }
    

    As per the instruction here: https://www.hifiberry.com/docs/software/guide-adding-equalization-using-alsaeq/

    Otherwise, since I had installed the armhf version of snapclient, I also needed to install the armhf version of both libasound2-plugin-equal and alsa-utils found here:

    After that, I could start snapclient using equal as the soundcard and then adjust the output using:

    alsamixer -D equal
    

    I did also encounter the following error:

    /home/pi/.alsaequal.bin is the wrong length.
    [Error] (Alsa) Exception: Can't open equal, error: Operation not permitted, code: -1
    

    Not sure if this came about from all my tinkering but I deleted /home/pi/.alsaequal.bin and the error went away.