Saturday, 8 March 2025

Usable Seeed Respeaker 4-mic Array on Raspberry Pi OS

 

Seeed Respeaker Mic Arrays

I bought the Seeed Respeaker 4-mic Array to run Picroft/Mycroft smart speaker. I was quite pleased with it until sometime in early 2024 when the Mycroft servers were shut down. I guess I could have turned it into a Google smart speaker except Google seemed to be dumbing down its smart assistant in favor of an AI-based one.

It's time to build my own smart home server, Home Assistant on a Raspberry Pi 4. That done, there is Home Assistant's nifty ESP32-S3 smart speaker, but for now I should be able to build one using my Respeaker mic and say, Rhasspy

Except the Respeaker mic array has become abandonware, and running a routine 'apt upgrade' will remove Raspberry Pi OS support for it. Restoring support for it was an unexpected struggle.

Respeaker 4-mic Array next to a Raspberry Pi

 

Seeed lists my 4-mic array under the 'Discontinued Products' column. It also says to make sure you are running the latest Raspberry Pi OS before you install the seeed voice card code from HinTak's github repository.

This does not work. And usually fails while compiling the respeaker kernel module with an error in source file seeed-voicecard.c:

/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:57:40: error: field ‘cpu_dai’ has incomplete type
   57 |                 struct simple_util_dai cpu_dai;

The problem is as of this writing (9 March 2025) at best HinTak /seeed-voicecard  supports kernel version 6.13 and the lastest 64-bit Raspberry Pi OS release, debian 12 bookworm has kernel version 6.6.51.

Furthermore even if you had a working version like I did, simply doing a routine OS update:

sudo apt update

sudo apt upgrade

Will result in your kernel version being updated until the respeaker no longer works. 

In fact despite HinTak current version, most of the 6.13 versions of old Raspberry Pi OS from their archive did not work. This is a known issue from 2 years ago, but as yet unresolved. The clue is a cryptic one-liner from Issue #339:

Told you already, wrong branch.
Use the v6.1 branch of https://github.com/HinTak/seeed-voicecard

The link to HinTak v6.1 is here. Now we need to match it to an archived version of Raspberry Pi OS. The last time seeed-voicecard.c was actually patched was 3 years ago, about 2022. So trying the Pi OS archive images from 2022 onwards, I eventually came to the right one, 2023-05-03-raspios-bullseye.

Download the image, and then,

$unxz 2023-05-03-raspios-bullseye-arm64.img.xz
$sudo dd bs=4M if=~/raspi/2023-05-03-raspios-bullseye-arm64.img of=/dev/
sda status=progress conv=sync
$sync

Remember to 'sync' after the dd as Ubuntu will exit the dd command many minutes before most sdcards finish writing. Boot up from the sdcard, and after the usual configurations (enable both i2c and spi interfaces).

 Check the kernel version:

 $ uname -r
6.1.21-v8+

I downloaded HinTak v6.1 as a zipfile and after unzipping, the install just worked:

~/seeed-voicecard-6.1 $ sudo ./install.sh

Next  we need to pin the kernel image version so that it does not get upgraded by apt. Get the working kernel versions thus:

$ sudo apt list --installed | grep -i kernel

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

raspberrypi-kernel-headers/oldstable,now 1:1.20230405-1 arm64 [installed]
raspberrypi-kernel/oldstable,now 1:1.20230405-1 arm64 [installed]

Then the actual pinning:

 $ sudo vi /etc/apt/preferences.d/kernel-pin 

$ sudo cat /etc/apt/preferences.d/kernel-pin
Package: raspberrypi-kernel
Pin: version 1:1.20230405-1
Pin-Priority: 1001
 

And that is all there is to it. We are ready for the installation of Rhasspy, which is best run from docker, the installation of which - you guessed it - starts with the inevitable 

$ sudo apt update
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [27.2 kB]
Hit:2 http://deb.debian.org/debian bullseye InRelease
Hit:3 http://deb.debian.org/debian bullseye-updates InRelease
Hit:4 http://archive.raspberrypi.org/debian bullseye InRelease
Fetched 27.2 kB in 2s (11.3 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
276 packages can be upgraded. Run 'apt list --upgradable' to see them.
 

$ sudo apt upgrade
 wpasupplicant xserver-common xserver-xorg-core xwayland
276 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 406 MB of archives.
After this operation, 139 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

And that actually turned out OK, one Seeed Respeaker 4-mic array saved from the scrap heap. 

Happy Trails.