MIC+ and Pi Zero Problem [resolved]


I’ve been having a major headache getting the assistant to work with the pi zero. I’ve followed the installation guide from here and the test script

sudo wget -O - test.raspiaudio.com | sudo bash

plays and records audio fine. However, when I run

arecord --format=S16_LE --duration=5 --rate=16000 --file-type=raw out.raw

and play it back with

aplay --format=S16_LE --rate=16000 out.raw

there is only a silent 5 second clip.
If I change the .asoundrc file to the one in the google guide then I can record audio by specifying the device

arecord -D mic --format=S16_LE --duration=5 --rate=16000 --file-type=raw out.raw

and play it back fine. But running without “-D mic” results in 5 seconds of silence again.

I’m confused as to why the test script works, but the arecord doesn’t. I think this is leading to the voice assistant not being able to record audio properly.

This has been driving me insane, so any help would be greatly appreciated!

in the script I am using this command to record, does this commands works for you?

arecord -d4 --rate=44000 /home/pi/test.wav&

if yes try to add your parameter one by one to check which one is causing the failure, maybe (not tested) this is the low sample rate that you have set.

Thanks for the reply.
I’ve found that the problem is related to permissions somehow. The audio only records when arecord run with sudo privilege. I noticed this when running your test script locally without using wget. Strangely, I don’t get a permission denied when I try to record, it just doesn’t work. Also pi is in the audio user group and aplay works fine without sudo.

I don’t recall this was a problem when I set-up the hat on my pi4. Do you have an idea of how to fix this? As the google-assistant still can’t access the recorder.
Thanks again

I seem to have solved the problem with a simple apt-get update + upgrade.
Silly me.

No problem, the update things happend to all of us at least once in our life :shushing_face: