Volume control shell script

Here’s a simple shell script I wrote for controlling PulseAudio volume from shell under Linux. It takes two parameters: up and down and sets volume for all sinks.

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
OLDIFS=$IFS
IFS=$'\n'
for L in `pacmd dump | grep set-sink-volume`; do
    if [ $1 = "up" ]; then
        pacmd set-sink-volume `echo $L | awk '{print $2}'` `echo $L | awk '{print $3+5000}'`
    fi
    if [ $1 = "down" ]; then
        pacmd set-sink-volume `echo $L | awk '{print $2}'` `echo $L | awk '{print $3-5000}'`
    fi
done
IFS=$OLDIFS
Name (required)
E-mail (required - never shown publicly)
Webpage URL
Comment:
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> in your comment.

Trackback responses to this post

About me

Nonoo
I'm Nonoo. This is my blog about music, sounds, filmmaking, amateur radio, computers, programming, electronics and other things I'm obsessed with. ... »

Twitter

Listening now

My favorite artists