I had an issue with my PS3Eye mic volume being too low (I’m using raspberry Pi 3B+)
On my host system I’ve amended /etc/asound.conf and it’s ok, but Rhasspy uses default config inside Hass.io addon (which is docker container)
So below is my solution:
Run sudo docker container ls | grep rhasspy
on host system (Rhasspy addon should be started) and find Rhasspy container ID
Copy you config file into container: sudo docker cp /etc/asound.conf 3ade54edfea0:/root/.asoundrc
here and below replace 3ade54edfea0 with your container id
With the command above we create .asoundrc which overrides default asound.conf
That’s all. You should see effect immediately
Testing:
To record wav file run: sudo docker exec 3ade54edfea0 arecord -d 5 -r 16000 /tmp/test.wav
To play wav file: sudo docker exec 3ade54edfea0 aplay /tmp/test.wav
Important note: every time you restart Hassio addon you need to copy the file again
I’m gong to create automation in HA, maybe you have other ideas? =)
You can also create a custom volume to store that file outside the container. Then it won’t get overwritten if the container is refreshed. I stored it under /etc versus the root home folder, but either should work the same.
Sorry I am not 100% familiar with all the ins and outs of Hassio. My assumption was since it is based on docker you could adjust the config. You might be able to use docker commands or something like portainer.
For those, who is interested in it
Method I use (until I automate it )
On a host system go to /usr/share/hassio/addons/git/75f2ff60/rhasspy/docker
and copy updated asound.conf there
Then go level up and open this file in rhasspy directory sudo nano Dockerfile
And add there COPY command COPY docker/asound.conf /root/.asoundrc
Save and then rebuild rhasspy addon in HA addon menu
That’s all… you can check docker container to be sure file is there
You can start/stop addon, but after rebuildor upgrade you need to do this again
This is a tough call. Rhasspy generally does not write to directories outside of the profile or /tmp, so I’m hesitant to add something that ends up writing a file in the user’s $HOME.
For the Hass.io add-on, however, this is a different story. An add-on config option might be an easy option to add. Is anyone aware of any Hass.io controls for the microphone volume? I’d hate to end up overwriting settings accidentally.
but it failed - apparently there is a problem with alsa and the micarray of the ps3 eyecam
so i only stored the settings for audio output on card 0
sudo alsactl store 0
and this seems to work
EDIT: Also found a solution for “saving” the mic gain - i just lowered the resolution down to 3 (in asound.conf)- so it can only sit on 0%, 50% and 100% - now its on 100% after reboot, just have to adjust my max_dB in the config (40 is a little bit to much )
Someone needs to add volume support for the alsa implementation on the supervisor and expose it to the API for a slider on the frontend
So there is nothing yet. The current way (proposed in this topic) is too complicated for most people and quite a bad UX. It would be really great if you could make this slightly simpler
Just added a config option to the Hass.io add-on in 2.4.17 called “asoundrc”. The contents of the settings are copied to /root/.asoundrc when the add-on starts
I don’t have a working Hass.io installation to test (SD card died), so you’ll have to let me know if it works or not
Hi @synesthesiam
Thank you for this feature! I’ve tried with this config "asoundrc": "Test"
And it works… almost
In run.sh could you change line cat "${asoundrc}" > /root/.asoundrc
to echo "${asoundrc}" > /root/.asoundrc
because in case of cat created file is empty
Just a note for others
As the new parameter is "str" and not ["str"] you should escape double quotes like this \" and replace line breaks with \n to have single line
As an example, here is my config
{
"user_dir": "/share/rhasspy/profiles",
"profile": "en",
"ssl": false,
"certfile": "fullchain.pem",
"keyfile": "privkey.pem",
"asoundrc": "\npcm.jack {\n type hw\n card ALSA\n}\npcm.array {\n type hw\n card CameraB409241\n}\npcm.softvol {\n type softvol\n slave.pcm \"jack\"\n control {\n name Master\n card 0\n }\n}\npcm.cap {\n type plug\n slave.pcm \"array\"\n slave.channels 4\n ttable {\n 0.0 15.0\n 1.1 15.0\n }\n}\npcm.!default {\n type asym\n playback.pcm \"plug:softvol\"\n capture.pcm {\n type plug\n slave.pcm \"cap\"\n }\n}\n"
}