Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

"Sample format non available" when starting AIY demos #254

Closed
pghardy opened this issue Jan 12, 2018 · 3 comments
Closed

"Sample format non available" when starting AIY demos #254

pghardy opened this issue Jan 12, 2018 · 3 comments
Labels

Comments

@pghardy
Copy link

pghardy commented Jan 12, 2018

I built the AIY projects kit from the May 2017 MagPi, downloading the aiyprojects-2018-01-03.img.xz OS image. It boots and and after updating OS to current and configuring, it passes the check_audio and check_wifi tests, so pi, speaker and microphone are working. However following the instructions on https://aiyprojects.withgoogle.com/voice/ to run any of the demos fail - see listing below:

(env) pi@HardyAIY:~/AIY-projects-python/src/examples/voice $ ./assistant_grpc_demo.py 
Press the button and speak
[2018-01-12 20:45:17,123] INFO:recorder:started recording
arecord: set_params:1299: Sample format non available
Available formats:
- S32_LE
[2018-01-12 20:45:17,133] ERROR:recorder:Microphone recorder died unexpectedly, aborting...
(env) pi@HardyAIY:~/AIY-projects-python/src/examples/voice $ 
@drigz
Copy link
Member

drigz commented Jan 15, 2018

Thanks for reporting! Can you check if you have a file called ~/.asoundrc? If so, what does it contain?

If it exists, you can try deleting it and rerunning the demos.

If it doesn't exist, could you post the output of arecord --list-pcms?

@pghardy
Copy link
Author

pghardy commented Jan 15, 2018

./asoundrc does exist. It contains:

pcm.!default {
	type hw
	card 0
}

ctl.!default {
	type hw
	card 0
}

I deleted the file and tried the assistant_grpc_demo.py again, and it works!
assistant_library_demo.py also works OK.

Any clue as to how/why that file got created?

@drigz
Copy link
Member

drigz commented Jan 15, 2018

Yes, it gets created by the default volume widget (source). It seems to get created if the driver hasn't been loaded correctly.

Maybe the best thing to do in the short term is to make check_audio.py detect this case and explain what to do, or even automatically resolve it.

@drigz drigz changed the title Errors starting AIY demos "Sample format non available" when starting AIY demos Jan 26, 2018
mbrooksx pushed a commit that referenced this issue Feb 27, 2018
This was originally proposed by @shivasiddharth in #172. We managed to
figure out what made it necessary in that case, but since the problem
has come back with the aiyprojects-2018-01-03 image, I think the
workaround will be more reliable long term.

This should avoid issues like #254 and #262.

Change-Id: I50feb4e012ba7c1e47dbf6ab9dd88661895decfc
mbrooksx pushed a commit that referenced this issue Feb 27, 2018
Running as root means that ALSA ignores /home/pi/.asoundrc, so problems
with the demos can't (easily) be detected in check_audio.py. See:
#254

Since it now uses configure_driver.sh, we have to fix
#268
or the config will not survive a reboot.

Change-Id: Icb440243395d885f20cd345b57a83ed82edd6e71
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants