A Crude Script I am using to automatically turn my amp on and off
# This Script is to read the Alsa Sound State and Automatcally
# swing a GPIO pin to allow auto switch on / off of an external
# amplifier, its crude dirty and badly written any sugestions
# or criticism welcome
# Trevor Cockayne email@example.com
# Exports pin to userspace
echo "26" > /sys/class/gpio/export
# Sets pin 26 as an output
echo "out" > /sys/class/gpio/gpio26/direction
for (( ; ; ))
if grep -q "closed" /proc/asound/card1/pcm0p/sub0/hw_params; then
# echo "DAC IDLE"
# echo "DAC Playing"
if [[ $count -gt $time || $count == $time ]]
# echo "Amp Off"
echo "0" > /sys/class/gpio/gpio26/value
# echo "Amp ON"
echo "1" > /sys/class/gpio/gpio26/value
# echo $count
More Info at http://www.runeaudio.com/forum/auto-amplifier-on-off-t928-10.html