You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. if [ -z "$1" ]; then
  3. echo "Usage: $0 <frequency>. Example: $0 90.3"
  4. exit 1
  5. fi
  6. command_exists() {
  7. if ! command -v "$1" &> /dev/null; then
  8. log "Required command not found: $1" "ERROR"
  9. exit 1
  10. fi
  11. }
  12. command_exists "sox"
  13. command_exists "socat"
  14. ## import common lib
  15. . "$HOME/.noaa.conf"
  16. . "$NOAA_HOME/common.sh"
  17. IP=$(ip route | grep "link src" | awk {'print $NF'})
  18. if pgrep "rtl_fm" > /dev/null
  19. then
  20. log "There is an existing rtl_fm instance running, I quit" "ERROR"
  21. exit 1
  22. fi
  23. echo "$(tput setaf 2)
  24. The server is in testing mode tuned to $1 Mhz!
  25. Open a terminal in your computer and paste:
  26. ncat $IP 8073 | play -t mp3 -
  27. $(tput sgr0)
  28. "
  29. rtl_fm ${BIAS_TEE} -f "$1M" -s 256k -g 48 -p 55 -E deemp -F 9 - \
  30. | sox -traw -r256k -es -b16 -c1 -V1 - -tmp3 - \
  31. | socat -u - TCP-LISTEN:8073 1>/dev/null