Skip to content

Instantly share code, notes, and snippets.

@fagci
Last active July 27, 2023 05:28
Show Gist options
  • Save fagci/13af44262c2eefe02ff7a329aa030844 to your computer and use it in GitHub Desktop.
Save fagci/13af44262c2eefe02ff7a329aa030844 to your computer and use it in GitHub Desktop.
VOX based parrot to use with Baofeng UV-K5 or another radio with VOX support. Needs to be sox installed. Optionally, you can add DTMF code actions with multimon-ng dependency. Note: DTMF characters need to be spaced between in "case".
#!/usr/bin/env bash
trap exit INT
while true; do
rec buffer.ogg silence 1 0.1 5% 1 1.0 5%
DPATH="$(date +%Y/%m/%d/)"
TIME="$(date +%H%M%S)"
DSTDIR="./recordings/$DPATH"
DSTFILE="$DSTDIR/$TIME.ogg"
mkdir -p "$DSTDIR"
sox buffer.ogg "$DSTFILE" gain -n -2
play "$DSTFILE"
done
#!/usr/bin/env bash
trap exit INT
while true; do
rec buffer.ogg silence 1 0.1 5% 1 1.0 5%
DPATH="$(date +%Y/%m/%d/)"
TIME="$(date +%H%M%S)"
DSTDIR="./recordings/$DPATH"
DSTFILE="$DSTDIR/$TIME.ogg"
mkdir -p "$DSTDIR"
sox buffer.ogg "$DSTFILE" gain -n -2
dtmf="$(multimon-ng -a DTMF -t ogg "$DSTFILE" -q | cut -d ' ' -f 2| xargs)"
echo "DTMF: $dtmf"
case $dtmf in
"1 #")
echo "HELP!!!111"
;;
*)
play "$DSTFILE"
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment