ReSpeaker 2-Mics Pi HAT not recording

Hi Seeed team. I have purchased a few 2-Mics pihats for an audio project I am working on and I am running into issues getting it working. I am following the wiki on how to set it up but when I get to step 3 it does not work. I am using a raspberry pi 0w and when I record a wav file I get no no output.
Here is some more details of my outputs

pi2@pi2:~ $ arecord -l

**** List of CAPTURE Hardware Devices ****
card 1: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

pi2@pi2:~ $ 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: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0

When I attempt to record I get the following output

pi2@pi2:~ $ arecord -f cd -Dhw:1 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
arecord: set_params:1407: Unable to install hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 44100
PERIOD_TIME: (125011 125012)
PERIOD_SIZE: 5513
PERIOD_BYTES: 22052
PERIODS: 4
BUFFER_TIME: (500045 500046)
BUFFER_SIZE: 22052
BUFFER_BYTES: 88208
TICK_TIME: 0

pi2@pi2:~ $ aplay -Dhw:1 test.wav
test.wav: No such file or directory

I decided to continue with the setup anyways and attempted to use the python scripts.
My output when attempting to get the devices index is as follows

pi2@pi2:~/mic_hat $ python3 recording_examples/get_device_index.py 
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_a52.c:823:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib conf.c:5200:(snd_config_expand) Unknown parameters {AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2  CARD 0}
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM iec958:{AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2  CARD 0}
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1009:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
ALSA lib pcm_dsnoop.c:573:(snd_pcm_dsnoop_open) The dsnoop plugin supports only capture stream
ALSA lib pcm_dmix.c:1009:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
ALSA lib pcm_dsnoop.c:573:(snd_pcm_dsnoop_open) The dsnoop plugin supports only capture stream
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
Input Device id  0  -  seeed-2mic-voicecard: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 (hw:1,0)
Input Device id  1  -  pulse
Output Device id  2  -  playback
Input Device id  3  -  capture
Output Device id  4  -  dmixed
Input Device id  5  -  array
Input Device id  6  -  default

I then changed the record.py file to read in from device 0.

when I ran the record it gave the same ALSA… lines as shown above and then the following:

pi2@pi2:~/mic_hat $ python3 recording_examples/record.py 
....
....
....
* recording
Traceback (most recent call last):
    File "/home/pi2/mic_hat/recording_examples/record.py", line 27, in <module>
        data = stream.read(CHUNK)
    File "/home/pi2/.local/lib/python3.9/site-packages/pyaudio.py", line 612, in read
        return pa.read_stream(self._stream, num_frames, exception_on_overflow)
OSError: [Errno -9981] Input overflowed

When I attempted to simply

arecord hello.wav

I downloaded the output and it had no data.

Any advice will be greatly appreciated, I am quite stuck.
Thanks in advance

somebody found the solution? i have the same problem.

i bought several ReSpeaker 2-Mics Pi HAT. Installed Raspian Bookworm and the driver for the 2-Mic-Hats from this repo: GitHub - HinTak/seeed-voicecard: This is an enhancement fork with the explicit aim of supporting current shipping Raspbian/Ubuntu kernels without requiring downgrading. Please donate at https://hintak.github.io/ if it works for you. Use vX.Y branch for kernel version vX.Y.

The system detects the soundcards. But recording is not possible. Wavefiles are always without data.

It works if you clone from HinTak/seeed-voicecard: This is an enhancement fork with the explicit aim of supporting current shipping Raspbian/Ubuntu kernels without requiring downgrading. Please donate at https://hintak.github.io/ if it works for you. Use vX.Y branch for kernel version vX.Y
Then you has to clone correct branch according to your linux kernel. Latest Raspbian Bookworm has kernel v6.6.

1 Like

I’m getting this error:

make -j4 KERNELRELEASE=6.6.20+rpt-rpi-v7 -C /lib/modules/6.6.20+rpt-rpi-v7/build M=/var/lib/dkms/seeed-voicecard/0.3/build.....(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.6.20+rpt-rpi-v7 (armv7l)
Consult /var/lib/dkms/seeed-voicecard/0.3/build/make.log for more information.

and

 more  /var/lib/dkms/seeed-voicecard/0.3/build/make.log 
DKMS make.log for seeed-voicecard-0.3 for kernel 6.6.20+rpt-rpi-v7 (armv7l)
Fri 22 Mar 16:43:14 PDT 2024
make: Entering directory '/usr/src/linux-headers-6.6.20+rpt-rpi-v7'
  CC [M]  /var/lib/dkms/seeed-voicecard/0.3/build/wm8960.o
  CC [M]  /var/lib/dkms/seeed-voicecard/0.3/build/ac108.o
  CC [M]  /var/lib/dkms/seeed-voicecard/0.3/build/ac101.o
  CC [M]  /var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.o
In file included from /usr/src/linux-headers-6.6.20+rpt-common-rpi/include/linux/device.h:15,
                 from /var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:19:
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c: In function ‘seeed_voice_card_trigger’:
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:223:20: error: ‘struct snd_soc_dai’ has no member named ‘stream_active’
  223 |                 dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK], dai->stream_active[SNDRV_PCM_STREAM_CAPTURE]);
      |                    ^~
/usr/src/linux-headers-6.6.20+rpt-common-rpi/include/linux/dev_printk.h:129:48: note: in definition of macro ‘dev_printk’
  129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
      |                                                ^~~~~~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:221:9: note: in expansion of macro ‘dev_dbg’
  221 |         dev_dbg(rtd->card->dev, "%s() stream=%s  cmd=%d play:%d, capt:%d\n",
      |         ^~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:223:67: error: ‘struct snd_soc_dai’ has no member named ‘stream_active’
  223 |                 dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK], dai->stream_active[SNDRV_PCM_STREAM_CAPTURE]);
      |                                                                   ^~
/usr/src/linux-headers-6.6.20+rpt-common-rpi/include/linux/dev_printk.h:129:48: note: in definition of macro ‘dev_printk’
  129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
      |                                                ^~~~~~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:221:9: note: in expansion of macro ‘dev_dbg’
  221 |         dev_dbg(rtd->card->dev, "%s() stream=%s  cmd=%d play:%d, capt:%d\n",
      |         ^~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:245:24: error: ‘struct snd_soc_dai’ has no member named ‘stream_active’
  245 |                 if (dai->stream_active[SNDRV_PCM_STREAM_CAPTURE] && substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
      |                        ^~
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:265:20: error: ‘struct snd_soc_dai’ has no member named ‘stream_active’
  265 |                 dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK], dai->stream_active[SNDRV_PCM_STREAM_CAPTURE], ret);
      |                    ^~
/usr/src/linux-headers-6.6.20+rpt-common-rpi/include/linux/dev_printk.h:129:48: note: in definition of macro ‘dev_printk’
  129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
      |                                                ^~~~~~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:263:9: note: in expansion of macro ‘dev_dbg’
  263 |         dev_dbg(rtd->card->dev, "%s() stream=%s  cmd=%d play:%d, capt:%d;finished %d\n",
      |         ^~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:265:67: error: ‘struct snd_soc_dai’ has no member named ‘stream_active’
  265 |                 dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK], dai->stream_active[SNDRV_PCM_STREAM_CAPTURE], ret);
      |                                                                   ^~
/usr/src/linux-headers-6.6.20+rpt-common-rpi/include/linux/dev_printk.h:129:48: note: in definition of macro ‘dev_printk’
  129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
      |                                                ^~~~~~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:263:9: note: in expansion of macro ‘dev_dbg’
  263 |         dev_dbg(rtd->card->dev, "%s() stream=%s  cmd=%d play:%d, capt:%d;finished %d\n",
      |         ^~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c: In function ‘asoc_simple_parse_dai’:
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:314:15: error: too few arguments to function ‘snd_soc_of_get_dai_name’
  314 |         ret = snd_soc_of_get_dai_name(node, &dlc->dai_name);
      |               ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:26:
/usr/src/linux-headers-6.6.20+rpt-common-rpi/include/sound/soc.h:1335:5: note: declared here
 1335 | int snd_soc_of_get_dai_name(struct device_node *of_node,
      |     ^~~~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c: In function ‘asoc_simple_init_dai_link_params’:
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:399:17: error: ‘struct snd_soc_dai_link’ has no member named ‘params’
  399 |         dai_link->params = params;
      |                 ^~
/var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.c:400:19: error: ‘struct snd_soc_dai_link’ has no member named ‘num_params’; did you mean ‘c2c_params’?
  400 |         dai_link->num_params = 1;
      |                   ^~~~~~~~~~
      |                   c2c_params
make[2]: *** [/usr/src/linux-headers-6.6.20+rpt-common-rpi/scripts/Makefile.build:248: /var/lib/dkms/seeed-voicecard/0.3/build/seeed-voicecard.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /usr/src/linux-headers-6.6.20+rpt-common-rpi/include/linux/device.h:15,
                 from /usr/src/linux-headers-6.6.20+rpt-common-rpi/include/linux/acpi.h:14,
                 from /usr/src/linux-headers-6.6.20+rpt-common-rpi/include/linux/i2c.h:13,
                 from /var/lib/dkms/seeed-voicecard/0.3/build/ac108.c:21:
/var/lib/dkms/seeed-voicecard/0.3/build/ac108.c: In function ‘ac108_hw_params’:
/var/lib/dkms/seeed-voicecard/0.3/build/ac108.c:656:28: error: ‘struct snd_soc_dai’ has no member named ‘stream_active’
  656 |                         dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK], dai->stream_active[SNDRV_PCM_STREAM_CAPTURE]);
      |                            ^~
/usr/src/linux-headers-6.6.20+rpt-common-rpi/include/linux/dev_printk.h:129:48: note: in definition of macro ‘dev_printk’
  129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
      |                                                ^~~~~~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/ac108.c:654:9: note: in expansion of macro ‘dev_dbg’
  654 |         dev_dbg(dai->dev, "%s() stream=%s play:%d capt:%d +++\n", __func__,
      |         ^~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/ac108.c:656:75: error: ‘struct snd_soc_dai’ has no member named ‘stream_active’
  656 |                         dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK], dai->stream_active[SNDRV_PCM_STREAM_CAPTURE]);
      |                                                                           ^~
/usr/src/linux-headers-6.6.20+rpt-common-rpi/include/linux/dev_printk.h:129:48: note: in definition of macro ‘dev_printk’
  129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
      |                                                ^~~~~~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/ac108.c:654:9: note: in expansion of macro ‘dev_dbg’
  654 |         dev_dbg(dai->dev, "%s() stream=%s play:%d capt:%d +++\n", __func__,
      |         ^~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/ac108.c:667:66: error: ‘struct snd_soc_dai’ has no member named ‘stream_active’
  667 |         if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE && dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK])
      |                                                                  ^~
/var/lib/dkms/seeed-voicecard/0.3/build/ac108.c:668:67: error: ‘struct snd_soc_dai’ has no member named ‘stream_active’
  668 |          || (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && dai->stream_active[SNDRV_PCM_STREAM_CAPTURE])) {
      |                                                                   ^~
/var/lib/dkms/seeed-voicecard/0.3/build/ac108.c: At top level:
/var/lib/dkms/seeed-voicecard/0.3/build/ac108.c:1548:21: error: initialization of ‘int (*)(struct i2c_client *)’ from incompatible pointer type ‘int (*)(struct i2c_client *, const struc
t i2c_device_id *)’ [-Werror=incompatible-pointer-types]
 1548 |         .probe =    ac108_i2c_probe,
      |                     ^~~~~~~~~~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/ac108.c:1548:21: note: (near initialization for ‘ac108_i2c_driver.probe’)
/var/lib/dkms/seeed-voicecard/0.3/build/wm8960.c:1409:21: error: initialization of ‘int (*)(struct i2c_client *)’ from incompatible pointer type ‘int (*)(struct i2c_client *, const stru
ct i2c_device_id *)’ [-Werror=incompatible-pointer-types]
 1409 |         .probe =    wm8960_i2c_probe,
      |                     ^~~~~~~~~~~~~~~~
/var/lib/dkms/seeed-voicecard/0.3/build/wm8960.c:1409:21: note: (near initialization for ‘wm8960_i2c_driver.probe’)
/var/lib/dkms/seeed-voicecard/0.3/build/ac101.c: In function ‘ac101_hw_params’:
/var/lib/dkms/seeed-voicecard/0.3/build/ac101.c:1083:38: error: ‘struct snd_soc_dai’ has no member named ‘stream_active’
 1083 |                         if (codec_dai->stream_active[SNDRV_PCM_STREAM_CAPTURE] && dmic_used && codec_aif1_fs[i].samp_rate == 44100) {
      |                                      ^~
cc1: some warnings being treated as errors
make[2]: *** [/usr/src/linux-headers-6.6.20+rpt-common-rpi/scripts/Makefile.build:248: /var/lib/dkms/seeed-voicecard/0.3/build/ac108.o] Error 1
make[2]: *** [/usr/src/linux-headers-6.6.20+rpt-common-rpi/scripts/Makefile.build:248: /var/lib/dkms/seeed-voicecard/0.3/build/ac101.o] Error 1
cc1: some warnings being treated as errors
make[2]: *** [/usr/src/linux-headers-6.6.20+rpt-common-rpi/scripts/Makefile.build:248: /var/lib/dkms/seeed-voicecard/0.3/build/wm8960.o] Error 1
make[1]: *** [/usr/src/linux-headers-6.6.20+rpt-common-rpi/Makefile:1938: /var/lib/dkms/seeed-voicecard/0.3/build] Error 2
make: *** [/usr/src/linux-headers-6.6.20+rpt-common-rpi/Makefile:246: __sub-make] Error 2
make: Leaving directory '/usr/src/linux-headers-6.6.20+rpt-rpi-v7'

Any advice?

Had the same problem. Try using raspberry pi os legacy. I followed this approach: wyoming-satellite/docs/tutorial_2mic.md at master · rhasspy/wyoming-satellite (github.com)

Hope it helps!

Try to reconfigure ALSA to use the Seeed 2-Mics Pi HAT as the default audio device. You can do this by editing the ALSA configuration file /etc/asound.conf or ~/.asoundrc . Make sure to set the default capture and playback devices to card 1, device 0.