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

.asoundrc added to audio configuration #172

Closed
wants to merge 2 commits into from

Conversation

shivasiddharth
Copy link

The normal audio installation will blank the .asoundrc and just copy the asound.conf. The Raspbian Stretch tends to populate its own .asoundrc, if left empty and it will cause audio rate errors like this one googlesamples/assistant-sdk-python#127
So its advisable to copy .asoundrc as well along with asound.conf.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@shivasiddharth
Copy link
Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@jrgleason
Copy link

Looks like I may have found an answer but I have to check...

https://developers.google.com/assistant/sdk/develop/grpc/hardware/audio

If you have both an HDMI monitor and a 3.5mm jack speaker connected, you can play audio out of either one. Run the following command:

sudo raspi-config
Go to Advanced options > Audio and select the desired output device.

Going to check that config in a bit and I will post on here if that works. I already reformatted my SD card so it might take a bit.

@jrgleason
Copy link

Oh nm is that what this does options snd_rpi_googlemihat_soundcard index=0?

@drigz
Copy link
Member

drigz commented Nov 13, 2017

@jrgleason, the index=0 line used to make sure that the Voice HAT was sound card 0, although the name is incorrect so it won't work any more - I'll send a PR.

@shivasiddharth, does this PR fully fix the issue, or does whatever populates ~/.asoundrc also modify it? We found it that the volume widget would create/modify .asoundrc, and we tried to eliminate the situations where this happened (eg with alsa-init.service).

@shivasiddharth
Copy link
Author

@drigz , in the tests that i did, this seemed to fix the issue. However, just to double check, someone else might as well try this.

@drigz
Copy link
Member

drigz commented Nov 13, 2017

What did you test? Do you know what caused .asoundrc to be created if not present? I can try to reproduce.

@shivasiddharth
Copy link
Author

I blanked the EEPROM, compiled I2S kernels just to make sure that it was not the HAT that was causing the issue. The volume widget issue i suppose is the case where the widget appears muted without controls ? I believe that to be the result of .asroundrc being auto populated.
Though i was not able to locate the source of issue, i can say with a fair bit of confidence that, this PR will fix the auto population issue as well as the muted widget issue.

@drigz
Copy link
Member

drigz commented Nov 13, 2017

Thanks. I'm out of the office this week, but I'll try it out next week.

@drigz
Copy link
Member

drigz commented Nov 23, 2017

I've tried to reproduce this but I can't. I would merge it, but I'm concerned about confusing users who edit one file, but the changes don't work because ALSA is reading the other file.

Does it work if you use a symlink? ie ln -s $global_asoundrc $asoundrc

Also, you should check that /home/pi exists, as some distros have a different username, ie:

if [[ -d /home/pi ]] ; then
  # create new file
fi

@shivasiddharth
Copy link
Author

  1. It is actually making use of the location of .asoundrc already declared in the script. So i would assume that, those using this script with other distros would be changing that, otherwise, it would have returned an error.
  2. Those using other audio config, would not even run this script, so i feel that there might not be any confusion.
  3. Or else, instead of merging this PR, maybe you can drop in a line in Hacking.md or readme asking ppl to copy paste the contents of asound.conf into .asoundrc. and reference this error.

@drigz
Copy link
Member

drigz commented Nov 23, 2017

It is actually making use of the location of .asoundrc already declared in the script.

That's a fair point, the script won't work fully until #95 is resolved.

Those using other audio config, would not even run this script

I'm concerned about people who want to tweak the audio config, eg to work around #47.

Or else, instead of merging this PR, maybe you can drop in a line in Hacking.md

That's a good idea, and maybe we'll have a chance to find out what people to do cause ~/.asoundrc to be created. #184

@drigz
Copy link
Member

drigz commented Nov 28, 2017

#187 makes this unnecessary.

@drigz drigz closed this Nov 28, 2017
mbrooksx pushed a commit that referenced this pull request 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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants