Created
June 3, 2019 05:31
-
-
Save non/d92e5136e6d0a04c5ff02a32b11f721a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# simple streaming from the command line: | |
# | |
# ./cast.sh send *.mp3 # stream some files | |
# | |
# ./cast.sh recv # listen to the stream | |
# | |
# currently hardcodes localhost port 9999. | |
# | |
# also currently set for mac. for linux, replace "-t coreaudio" with | |
# "-t alsa" or a similar linux driver. | |
send() { | |
mplayer -vo null -vc null -ao pcm:file=/dev/stdout -really-quiet "$@" | \ | |
sox -e signed -r 44100 -b 16 -c 2 -t raw - -t ogg - | \ | |
nc -l localhost 9999 | |
} | |
recv() { | |
nc localhost 9999 | \ | |
sox -t ogg - -t coreaudio | |
} | |
case "$1" in | |
send) shift; send "$@"; exit 0;; | |
recv) recv; exit 0;; | |
*) echo "expected send|recv, got: $@"; exit 1;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment