Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volume control from bash? #142

Open
tatoosh opened this issue Jan 24, 2018 · 1 comment
Open

Volume control from bash? #142

tatoosh opened this issue Jan 24, 2018 · 1 comment

Comments

@tatoosh
Copy link

tatoosh commented Jan 24, 2018

Hello,

is there a way to volume control from a bash script like curl with port 4000?
Maybe you have a snippet for me to increase or decrease volume!?

Thx

@dusatvoj
Copy link

#!/bin/bash
VOL=3
if [ $1 = '+' ]
then
amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')+${VOL}]%

elif [ $1 = '-' ]
then
amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]%|sed 's/%//')-${VOL}]%
elif [[ $1 =~ [gG][eE][tT] ]]
then
VOLLVL=$(amixer get PCM | grep -E '
%' | awk '{print $4, $5}')
echo "Volume level = ${VOLLVL}"
else
echo "Bad input parameter (+/-/GET)"
fi

This could be solution, when you want to controll volume from bash.
I'm using Raspberry SSH android app and I'm using this script for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants