Thursday, February 7, 2013

switchaudio.sh - switching pulseaudio output

A script if you use multiple audio output devices and Pulseaudio. For instance USB  headphones and a regular internal sound card. This script makes it easy to switch between the different cards, and update any current applications to use the new output device. 

To execute just copy to a bin directory like `/usr/local/bin` and run `switchaudio.sh --next`.

You can bind this script to a key shortcut in KDE : systemsettings -> Shortcuts and Gestures

You can also find it: http://pastebin.com/a6T3ezFs

1 comment:

  1. In fish

    #!/bin/fish

    set sinks (pacmd list-sinks |sed 's/*//' |awk '/[*]|index:/{print $2}')
    set current (pacmd list-sinks |awk '/* index:/{print $3}')
    set streams (pacmd list-sink-inputs |sed 's/*//' |awk '/[*]|index:/{print $2}')
    set next (next-valid-index $current $sinks)

    for stream in $streams
    pacmd move-sink-input $stream $next
    end

    pacmd set-default-sink $next

    ReplyDelete