commit | author | age
|
4ce3ae
|
1 |
#!/bin/sh |
828250
|
2 |
|
JG |
3 |
# Stream pulseaudio to remote sources |
|
4 |
# This can be used to stream audio to a phone assuming it has an appropriate app |
|
5 |
# I got most of this code from StackOverflow |
|
6 |
|
4ce3ae
|
7 |
server_port=8000 |
JG |
8 |
ip_address=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p') |
|
9 |
pulse_source=$(pactl list sources short | grep analog-stereo.monitor | awk '{print $2}') |
|
10 |
case "$1" in |
|
11 |
start) |
|
12 |
$0 stop |
|
13 |
pactl load-module module-simple-protocol-tcp rate=48000 format=s16le channels=2 source=$pulse_source record=true port=$server_port |
|
14 |
;; |
|
15 |
stop) |
|
16 |
pactl unload-module `pactl list | grep tcp -B1 | grep M | sed 's/[^0-9]//g'` |
|
17 |
;; |
|
18 |
*) |
|
19 |
echo "Usage: $0 start|stop" >&2 |
|
20 |
;; |
|
21 |
esac |