I have a Raspberry Pi (called Igor) in my room that plays music, and occasionally speaks a warning message. If I want to change its volume, or mute it, I need to ssh into it from my laptop and start alsamixer
. This is a bit of a hassle and I'd like to use some keyboard shortcuts, or an onscreen control, just for changing Igor's volume.
I suppose I could cobble up a small server on the RPi that listens for network messages and adjusts the volume accordingly. From my laptop I could set up keyboard shortcuts that do something like
echo "+10%" | nc igor $portnumber
for 10% louder, and "-10%"
for softer. Create my own API, so to say. But isn't there already something out there that does that? Does ALSA have an API for network access? Or does PulseAudio?
Just to make it clear, I don't want to stream the music itself to the RPi. Igor has its own sources of music.
@CL. gave me the idea of running a single command through
ssh
, triggered by a keyboard shortcut.On the RPi, I have a script
softer.sh
like this:This
get
s the current volume from amixer (which is a percentage), subtracts 10, sticks the "%" symbol to the end, andset
s the volume to the result. Same forlouder.sh
which adds 10%.On my laptop I set CTRL + F7 to execute:
and of course CTRL + F8 to