.asoundrc: pcm.dmixer { type dmix ipc_key 1024 ipc_key_add_uid false ipc_perm 0660 slave { pcm "hw:0,0" rate 48000 channels 2 format S32_LE period_time 0 period_size 1024 buffer_time 0 buffer_size 4096 } } pcm.!default { type plug slave.pcm "dmixer" } swap.sh: #!/bin/bash #swap.sh - sherl0k@gmail.com #Using a basic .asoundrc, this will swap the outputs between two different sources. #For my uses, between my laptop's speakers, and the HDMI output going to my television. config="$HOME/.asoundrc" SPEAKERS=`cat $config | grep "hw:0,0" | wc -w` if [ $SPEAKERS == "2" ] then sed -i -e 's/pcm "hw:0,0"/pcm "hw:0,3"/' .asoundrc echo "Sound outputting to HDMI" exit fi SPEAKERS=`cat $config | grep "hw:0,3" | wc -w` if [ $SPEAKERS == "2" ] then sed -i -e 's/pcm "hw:0,3"/pcm "hw:0,0"/' .asoundrc echo "Sound outputting to laptop speakers" exit fi exit