diff --git a/scripts/beep b/scripts/beep new file mode 100755 index 0000000..6e78f11 --- /dev/null +++ b/scripts/beep @@ -0,0 +1,23 @@ +#!/bin/sh + +n=3 +case "$5" in + LOW) n=1 ;; + NORMAL) n=3 ;; + CRITICAL) n=5;; +esac + +lock=/tmp/.beep-lock +test -f $lock && exit 1 +touch $lock + +python -c " +import sys, numpy as np +t = np.arange(0, 0.25, 1/48000) +for i in range($n): + tone = np.random.choice([0,3,5,6,7,10,12]) + note = 0.2 * np.sin(np.pi * 650 * 2**(tone/12) * t) + sys.stdout.buffer.write(np.int32(2**31 * note).tobytes()) +" | aplay -c 1 -f S32_LE -r 48000 -Dbeep + +rm -f $lock diff --git a/scripts/beep-charlie b/scripts/beep-charlie deleted file mode 100755 index bc83443..0000000 --- a/scripts/beep-charlie +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -lock=/tmp/.beep-lock -test -f $lock && exit 1 -touch $lock - -head -c 8 /dev/urandom | - hexdump -v -e '/1 "%u\n"' | - awk '{ split("0,3,5,6,7,10,12",a,","); - for (i = 0; i < 1; i+= 0.00012) - printf("%08X\n", 60*sin(450*exp((a[$1 % 8]/12)*log(2))*i)) }' | - xxd -r -p | - aplay -c 1 -f S32_LE -r 48000 -D plug:default - -rm -f $lock diff --git a/scripts/beep-wigfrid b/scripts/beep-wigfrid deleted file mode 100755 index 7ad7d8c..0000000 --- a/scripts/beep-wigfrid +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -lock=/tmp/.beep-lock -test -f $lock && exit 1 -touch $lock - -head -c 4 /dev/urandom | \ - hexdump -v -e '/1 "%u\n"' | - awk '{ split("0,3,5,6,7,10,12",a,","); - for (i = 0; i < 1; i+= 0.00011) - printf("%08X\n", 40*sin(450*exp((a[$1 % 8]/12)*log(2))*i)) }' | - xxd -r -p | - aplay -c 2 -f S16_LE -r 48000 -Dvideocard - -rm -f $lock