#!/bin/bash
## simple start|stop script for streaming audio output from pulseaudio
## for receiving stream on android device use this app: https://play.google.com/store/apps/details?id=com.kaytat.simpleprotocolplayer&hl=en
case "$1" in
start)
$0 stop
pactl load-module module-simple-protocol-tcp rate=48000 format=s16le channels=2 source=NAME record=true port=8010
## to get NAME of your output execute "pactl list | grep Name" and copy name with .monitor in the end
;;
stop)
pactl unload-module `pactl list | grep tcp -B1 | grep M | sed 's/[^0-9]//g'`
;;
*)
echo "Usage: $0 start|stop"
;;
esac