PiCroft with Respeaker 2-mic PiHat

Hi everybody,

I tried to setup picroft with Respeaker 2-mic PiHat with the information from these two topics:

But the device doesnt work. When I try to record something, I get the following error:

(.venv) pi@picroft:~ $ arecord -Dhw:1 -f cd test.wav
ALSA lib pcm_hw.c:1822:(_snd_pcm_hw_open) Invalid value for card
arecord: main:828: audio open error: No such file or directory

Could someone please give an advise?

Best regards
eyk

@eyk107 Can you tell me what you’ve done so far to setup the Respeaker 2-mic PiHat?

Hi rlongfield,

thank you for your fast supply.

I’ve done this steps from mrhavoc:

And I edited all the files that you have mentioned here:

After the driver installation from seeed-studio, I’ve tried the arecord command. Did this command work for you? I suggest that there is a driver problem. Could you install the seeed-driver without problems?

BR

If you putted dtparam=audio=off in your config file, then you don’t have that soundcard anymore, so you need:

Dhw:0

That is than of course if you use the jack from de mic hat.

Okay, that part with Dhw was not clear to me. Will try it and will Update the post.
Edit:
No I get a different error:
(.venv) pi@picroft:~ $ arecord -Dhw:0 -f cd test.wav
arecord: main:828: audio open error: Device or resource busy

Unfortunately I cannot find anything in the forum. Has somebody an idea how to fix this?

If you use ALSA, there can only be one program that accesses the soundcard.

You need to stop all Mycroft instances / items, before you run the “arecord” command.

I stopped everything, but still the same problem:
(.venv) pi@picroft:~/seeed-voicecard $ mycroft-stop
Stopping all mycroft-core services
Stopping messagebus.service (757)…stopped.
Stopping skills (760)…failed to stop.
Killing skills (760)…killed.
Stopping audio (763)…stopped.
Stopping speech (766)…stopped.
Stopping enclosure (769)…failed to stop.
Killing enclosure (769)…killed.
(.venv) pi@picroft:~/seeed-voicecard $ arecord -Dhw:0 -f cd test.wav
arecord: main:828: audio open error: Device or resource busy
(.venv) pi@picroft:~/seeed-voicecard $

I can also see the device in the alsamixer. That seems to me that the drivers are working correct?

Well, this is EXACTLY the reason I choose to use PulseAudio instead.

Can you post the content of your asound.conf ?

I’m totally new to all of this. If PulseAudio is working better, I would also switch to it.
Here is the content of my asoudn.conf

`# Use PulseAudio by default
pcm.!default {
type pulse
fallback “sysdefault”
hint {
show on
description “Default ALSA Output (currently PulseAudio Sound Server)”
}
}

ctl.!default {
type pulse
fallback “sysdefault”
}

pcm.playback {
type plug
slave.pcm “dmixed”
}

pcm.capture {
type plug
slave.pcm “array”
}

pcm.dmixed {
type dmix
slave.pcm “hw:seeed2micvoicec”
ipc_key 555555
}

There is also another weird thing:
I can here periodical noise output over my headphone. I think it could be the voice from mycroft which tells to pair the device and spells the different letters and numbers. It isn’t understandable, but maybe a hint where the problem comes from?!

You are mixing stuff up in your asound file. Recipe for disaster!

Either use the default from seeed, using ALSA;

Or use pulseAudio (but make sure you have it installed, including; pulse alsa-utils);

My advise for now, is to stick with ALSA at the moment. So replace everything as it was, from the seeed github link.

Then make sure you use the default ALSA ctl by using these two lines in your mycroft.conf

“play_wav_cmdline”: “aplay %1”
“play_mp3_cmdline”: “mpg123 %1”

(Make sure you end up with valid JSON)

I tried your seggestions but it didn’t work out. Here is my mycroft.conf:

{
“play_wav_cmdline”: “aplay %1”,
“play_mp3_cmdline”: “mpg123 %1”,
“enclosure”: {
“platform”: “picroft”
},
“tts”: {
“mimic”: {
“path”: “/home/pi/mycroft-core/mimic/bin/mimic”
}
},
“ipc_path”: “/ramdisk/mycroft/ipc/”
}

Maybe any other suggestions?

If you have the latest PiCroft image, then PulseAudio should be installed.

Last I can think of to tru is, to use the pulse option as linked above within asound.conf. (delete all content and only put the info from my link)

Reboot, and see if that works for you. Leave the mycroft.conf just as it is.

Do I have to enable pulseaudio, or is it just the asound.conf? I edited the file, but the problem still exists. I think I have to make clear, that the driver ist corectly installed. I think the best way would currently be “arecord -Dhw:0”
I tried to get information, why the device is busy, but couldnt see any information with “ps-A”

(.venv) pi@picroft:~ $ ps -A
PID TTY TIME CMD
1 ? 00:00:03 systemd
2 ? 00:00:00 kthreadd
3 ? 00:00:00 rcu_gp
4 ? 00:00:00 rcu_par_gp
7 ? 00:00:00 kworker/u8:0-events_unbound
8 ? 00:00:00 mm_percpu_wq
9 ? 00:00:00 ksoftirqd/0
10 ? 00:00:00 rcu_sched
11 ? 00:00:00 rcu_bh
12 ? 00:00:00 migration/0
13 ? 00:00:00 cpuhp/0
14 ? 00:00:00 cpuhp/1
15 ? 00:00:00 migration/1
16 ? 00:00:00 ksoftirqd/1
19 ? 00:00:00 cpuhp/2
20 ? 00:00:00 migration/2
21 ? 00:00:00 ksoftirqd/2
22 ? 00:00:00 kworker/2:0-events
24 ? 00:00:00 cpuhp/3
25 ? 00:00:00 migration/3
26 ? 00:00:00 ksoftirqd/3
29 ? 00:00:00 kdevtmpfs
30 ? 00:00:00 netns
31 ? 00:00:00 kworker/0:1-events
32 ? 00:00:00 kworker/1:1-events
34 ? 00:00:00 khungtaskd
35 ? 00:00:00 oom_reaper
36 ? 00:00:00 writeback
37 ? 00:00:00 kcompactd0
38 ? 00:00:00 crypto
39 ? 00:00:00 kblockd
40 ? 00:00:00 watchdogd
41 ? 00:00:00 rpciod
42 ? 00:00:00 kworker/u9:0-hci0
43 ? 00:00:00 xprtiod
46 ? 00:00:00 kswapd0
47 ? 00:00:00 nfsiod
58 ? 00:00:00 kthrotld
59 ? 00:00:00 kworker/3:1-events
60 ? 00:00:00 iscsi_eh
61 ? 00:00:00 dwc_otg
62 ? 00:00:00 DWC Notificatio
63 ? 00:00:00 vchiq-slot/0
64 ? 00:00:00 vchiq-recy/0
65 ? 00:00:00 vchiq-sync/0
66 ? 00:00:00 vchiq-keep/0
67 ? 00:00:00 SMIO
68 ? 00:00:00 kworker/2:2-mm_percpu_wq
69 ? 00:00:00 irq/86-mmc1
71 ? 00:00:00 mmc_complete
72 ? 00:00:00 kworker/2:1H-kblockd
73 ? 00:00:00 kworker/0:1H-kblockd
74 ? 00:00:00 kworker/1:1H-kblockd
75 ? 00:00:00 jbd2/mmcblk0p2-
76 ? 00:00:00 ext4-rsv-conver
77 ? 00:00:00 kworker/1:2H
78 ? 00:00:00 ipv6_addrconf
82 ? 00:00:00 kworker/3:1H-kblockd
93 ? 00:00:00 kworker/2:2H
94 ? 00:00:00 kworker/3:2H
95 ? 00:00:00 kworker/0:2H
97 ? 00:00:00 irq/166-usb-001
106 ? 00:00:00 systemd-journal
127 ? 00:00:00 kworker/1:2-events
140 ? 00:00:00 kworker/3:2-cgroup_destroy
142 ? 00:00:00 systemd-udevd
157 ? 00:00:00 SMIO
173 ? 00:00:00 kworker/u8:2-events_unbound
174 ? 00:00:00 mmal-vchiq
176 ? 00:00:00 mmal-vchiq
179 ? 00:00:00 mmal-vchiq
196 ? 00:00:00 cfg80211
197 ? 00:00:00 brcmf_wq/mmc1:0
200 ? 00:00:00 brcmf_wdog/mmc1
254 ? 00:00:00 systemd-timesyn
290 ? 00:00:00 thd
295 ? 00:00:00 systemd-logind
300 ? 00:00:00 dbus-daemon
301 ? 00:00:00 rngd
309 ? 00:00:00 wpa_supplicant
311 ? 00:00:00 rsyslogd
312 ? 00:00:00 alsactl
318 ? 00:00:00 cron
323 ? 00:00:00 avahi-daemon
366 ? 00:00:00 avahi-daemon
367 ? 00:00:00 dhcpcd
392 tty1 00:00:00 login
395 ? 00:00:00 sshd
404 ? 00:00:00 kworker/0:2-events
417 ? 00:00:00 wpa_supplicant
428 ? 00:00:00 spi0
492 ? 00:00:00 systemd
495 ? 00:00:00 (sd-pam)
508 tty1 00:00:00 bash
535 ? 00:00:00 kworker/u9:1-hci0
536 ? 00:00:00 hciattach
542 ? 00:00:00 bluetoothd
609 ? 00:00:06 pulseaudio
611 ? 00:00:00 rtkit-daemon
614 ? 00:00:00 polkitd
618 ? 00:00:00 dbus-daemon
619 ? 00:00:00 kworker/u8:3-events_unbound
753 ? 00:00:00 sshd
885 ? 00:00:00 sshd
888 pts/0 00:00:00 bash
1544 ? 00:00:00 kworker/0:0-events_power_efficient
1748 ? 00:00:00 kworker/0:0H
1759 ? 00:00:00 kworker/2:0H
1878 ? 00:00:00 kworker/2:1-mm_percpu_wq
1940 pts/0 00:00:00 ps

Very hard to debug from remote.

IF all mycroft stuff is stopped or at least not started, what is the “audiotest” option doing?

~/mycroft-core/start-mycroft.sh audiotest

I’ve got an audiofile with this script, but I dont get any playback with my headphones. After that I copied the file from picroft to my notebook and could playback the sound that was captured.

Sounds like your rpi-audio is still in the way. Can you post the output of the command; lsmod

Just to check which modules are loaded.

(.venv) pi@picroft:~ $ lsmod
Module Size Used by
bnep 20480 2
hci_uart 40960 1
btbcm 16384 1 hci_uart
serdev 20480 1 hci_uart
bluetooth 389120 24 hci_uart,bnep,btbcm
ecdh_generic 28672 1 bluetooth
spidev 20480 0
spi_bcm2835 20480 0
i2c_dev 20480 0
8021q 32768 0
garp 16384 1 8021q
stp 16384 1 garp
llc 16384 2 garp,stp
brcmfmac 311296 0
brcmutil 16384 1 brcmfmac
sha256_generic 20480 0
snd_soc_simple_card 16384 5
cfg80211 614400 1 brcmfmac
bcm2835_codec 36864 0
rfkill 28672 6 bluetooth,cfg80211
bcm2835_v4l2 45056 0
v4l2_mem2mem 24576 1 bcm2835_codec
bcm2835_mmal_vchiq 32768 2 bcm2835_codec,bcm2835_v4l2
raspberrypi_hwmon 16384 0
hwmon 16384 1 raspberrypi_hwmon
v4l2_common 16384 1 bcm2835_v4l2
videobuf2_dma_contig 20480 1 bcm2835_codec
videobuf2_vmalloc 16384 1 bcm2835_v4l2
videobuf2_memops 16384 2 videobuf2_dma_contig,videobuf2_vmalloc
videobuf2_v4l2 24576 3 bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem
i2c_bcm2835 16384 0
videobuf2_common 45056 4 bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
videodev 200704 6 bcm2835_codec,v4l2_common,videobuf2_common,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
media 36864 3 bcm2835_codec,videodev,v4l2_mem2mem
snd_soc_bcm2835_i2s 20480 2
vc_sm_cma 36864 1 bcm2835_mmal_vchiq
uio_pdrv_genirq 16384 0
uio 20480 1 uio_pdrv_genirq
fixed 16384 0
snd_soc_wm8960 40960 1
snd_soc_ac108 53248 0
snd_soc_seeed_voicecard 16384 1 snd_soc_ac108
snd_soc_simple_card_utils 16384 2 snd_soc_seeed_voicecard,snd_soc_simple_card
snd_soc_core 192512 6 snd_soc_seeed_voicecard,snd_soc_simple_card_utils,snd_soc_bcm2835_i2s,snd_soc_ac108,snd_soc_wm8960,snd_soc_simple_card
snd_compress 20480 1 snd_soc_core
snd_pcm_dmaengine 16384 1 snd_soc_core
snd_pcm 102400 6 snd_pcm_dmaengine,snd_soc_bcm2835_i2s,snd_soc_core,snd_soc_wm8960
snd_timer 32768 1 snd_pcm
snd 73728 13 snd_compress,snd_timer,snd_soc_core,snd_soc_wm8960,snd_pcm
ip_tables 24576 0
x_tables 32768 1 ip_tables
ipv6 450560 42

I can’t see any problems?!
Thank you very much for your support.

Still see some soc sound things, not sure if it is the onboard or not. What is the output of the command; aplay -l

(.venv) pi@picroft:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 []
Subdevices: 0/1
Subdevice #0: subdevice #0

Should it be Subdevices: 1/1?

Really strange. It shows that indeed you have only one card and one subdevice.

-Dhw:0 should just work.

I start to believe, you have either a hardware failure or the seeed-2mic-voicecard drivers are borked.

1 Like