Last active
May 5, 2023 08:17
-
-
Save justinatcamfil/b4f1a8c4eab249a91863 to your computer and use it in GitHub Desktop.
stream linux audio from sound card through netcat
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/bash | |
# run on mac in terminal | |
while TRUE; do | |
nc <server_address> 15000 | play -q -t mp3 - || echo Attempting to connect... | |
sleep 1; | |
done |
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/bash | |
# run on linux box | |
MONITOR=$(pactl list | grep -A2 '^Source #' | \ | |
grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -n1) | |
parec -d "$MONITOR" | sox -v 0.8 -s -S -t raw -r 44100 -sLb 16 -c 2 - -t mp3 -C 196 - | netcat -l 15000 -k | |
# why doesn't this work? sounds like playing a record with a pencil lead | |
# rec -t raw -b 16 -r 44100 -e signed -c 2 -L - -t mp3 -C 196 - | netcat -l 15000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment