diff options
-rwxr-xr-x | god/overlord/index | 27 | ||||
-rwxr-xr-x | god/overlord/overlord | 19 | ||||
-rwxr-xr-x | noise/modules/overlord | 30 | ||||
-rwxr-xr-x | noise/modules/temp | 42 |
4 files changed, 54 insertions, 64 deletions
diff --git a/god/overlord/index b/god/overlord/index new file mode 100755 index 00000000..27506ccd --- /dev/null +++ b/god/overlord/index @@ -0,0 +1,27 @@ +#! /bin/sh +set -euf + +# cd // +cd $(dirname $(readlink -f $0))/../.. + +max=100 +step=10 +min=0 + +# fade-out streams +for i in `seq $max -$step $min`; do + amixer -q -c 0 -D hw:0 sset Front $i% + sleep 0.1 +done +streams/streams stop + +amixer -q -c 0 -D hw:0 sset Front $max% +mplayer god/overlord/announce.mp3 >/dev/null +espeak -v de -s 120 -a 900 "$*" + +# fade-in streams +streams/streams start +for i in `seq $min $step $max`; do + sleep 0.1 + amixer -q -c 0 -D hw:0 sset Front $i% +done diff --git a/god/overlord/overlord b/god/overlord/overlord deleted file mode 100755 index 501afc80..00000000 --- a/god/overlord/overlord +++ /dev/null @@ -1,19 +0,0 @@ -#! /bin/sh -set -euf - -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 90% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 80% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 70% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 60% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 50% -/krebs/streams/streams stop -amixer -q -c 0 -D hw:0 sset Front 100% -mplayer announce.mp3 -/krebs/streams/streams start & -espeak -v de -s 120 -a 900 "$*" -amixer -q -c 0 -D hw:0 sset Front 40% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 50% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 60% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 70% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 80% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 90% diff --git a/noise/modules/overlord b/noise/modules/overlord index 6df2451d..ded8627a 100755 --- a/noise/modules/overlord +++ b/noise/modules/overlord @@ -1,26 +1,14 @@ #! /bin/sh set -euf -announce() { -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 90% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 80% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 70% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 60% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 50% -/krebs/streams/streams stop -amixer -q -c 0 -D hw:0 sset Front 100% -mplayer /krebs/god/overlord/announce.mp3 -/krebs/streams/streams start & -espeak -v de -s 120 -a 900 "$*" -amixer -q -c 0 -D hw:0 sset Front 40% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 50% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 60% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 70% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 80% -sleep 0.4; amixer -q -c 0 -D hw:0 sset Front 90% -} +# cd // +cd $(dirname $(readlink -f $0))/../.. -case "$1" in - --help) echo "Make an announcement! Usage: /overlord <text>";; - *) announce "$@";; +case "${1---help}" in + --help) + echo "Make an announcement! Usage: /overlord <text>" + ;; + *) + exec god/overlord/index "$@" + ;; esac diff --git a/noise/modules/temp b/noise/modules/temp index 2f1dfcef..a11c3720 100755 --- a/noise/modules/temp +++ b/noise/modules/temp @@ -1,33 +1,32 @@ #! /bin/bash +temper=/krebs/temper/temper + main() { - case "$1" in + case "${1--K}" in (--help) echo "report temperature in K, °C, °R, or °F." + exit ;; - (-C|--celsius) - espeak_inside `inside_temp 'x - 273.15'` Grad Zelsius - espeak_outside `outside_temp 'x - 273.15'` Grad Zelsius - ;; - (-F|--fahrenheit) - espeak_inside `inside_temp 'x * 9/5 - 459.67'` Grad Fahrenheit - espeak_outside `outside_temp 'x * 9/5 - 459.67'` Grad Fahrenheit - ;; - (-R|--rankine) - espeak_inside `inside_temp 'x * 9/5'` Grad Renkin - espeak_outside `outside_temp 'x * 9/5'` Grad Renkin - ;; - (-K|--kelvin|*) - espeak_inside `inside_temp` Kelvin - espeak_outside `outside_temp` Kelvin + (-C|--celsius) unit='Grad Zelsius' ; formula='x - 273.15' ;; + (-F|--fahrenheit) unit='Grad Fahrenheit'; formula='x * 9/5 - 459.67' ;; + (-R|--rankine) unit='Grad Renkin' ; formula='x * 9/5' ;; + (-K|--kelvin) unit='Kelvin' ; formula='x' ;; + (*) + echo 'Error 1: you are made of stupid!' + exit 23 ;; esac + if test -f $temper -a -x $temper; then + espeak_inside `inside_temp "$formula"` $unit + fi + espeak_outside `outside_temp "$formula"` $unit } ## temp [<formula with temperature as x>] ## Echo temperature in K. If formula is given then return that result instead. inside_temp() { - echo "scale=2; x=`/krebs/temper/temper` + 273.15; ${1-x}" | bc + echo "scale=2; x=`$temper` + 273.15; ${1-x}" | bc } outside_temp() { @@ -36,13 +35,8 @@ outside_temp() { ` + 273.15; ${1-x}" | bc } -espeak_inside() { - echo Die Krebs-tempera-tur beträgt $@ | to_espeak -} - -espeak_outside() { - echo Die Außen-tempera-tur beträgt $@ | to_espeak -} +espeak_inside() { echo Die Krebs-tempera-tur beträgt $@ | to_espeak; } +espeak_outside() { echo Die Außen-tempera-tur beträgt $@ | to_espeak; } to_espeak() { sed ' |