Thanks for sticking with me on all of this. I’ve learned a bit more about how this is all supposed to work and have a solution that’s working for me, now. I never could get the amixer stuff working and I think I know (partially) why.
Seems the pulseaudio server has issues when started for a user at system startup (in rc.local for example) and then the user wants to use it from a login shell.
That is, in rc.local I have this:
sudo -i -u pi -- sh -c "aplay -D Pulse /var/tones/beep.wav"
Works, great! Plays a beep and the pulseaudio server is running under user “pi.”
But if I then log in (ssh) to my system and do
aplay -D Pulse /var/tones/beep.wav
Nothing happens. Likewise, if I try to use the pa* controls (pactl, pacmd, etc) they all fail. I have to do
sudo -i -u pi -- sh -c "aplay -D Pulse /var/tones/beep.wav"
or
sudo -i -u pi -- sh -c "pactl set-sink-volume 2 10%"
When I do that, all is fine. Works as expected. So that’s simply what I’m going to do. I have all of this scripted, anyway, so it’s easy for me to change my “beep.sh” script to use sudo. I still don’t know why this is an issue (if I “sudu -u pi” then user pi should be able to use it, I would think. But for another day… I have other things I need to get working, then I can come back and optimize.)
Hope this helps someone else!