From b3fcec3f81ec00852e59af2a1a5cb142b7e71386 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 22 Jun 2017 19:29:46 -0400 Subject: [PATCH] sounds abound game from the Ideal Maniac game. --- sounds-abound/sounds-abound | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 sounds-abound/sounds-abound diff --git a/sounds-abound/sounds-abound b/sounds-abound/sounds-abound new file mode 100755 index 0000000..69cc859 --- /dev/null +++ b/sounds-abound/sounds-abound @@ -0,0 +1,51 @@ +#!/bin/bash + +# Thanks for playing. +# Visit me at https://stormdragon.tk +# Released under the terms of the WTFPL http://wtfpl.net +# Follow me on GNU Social: https://social.stormdragon.tk/storm + +# Set the difficulty +case "$1" in +1) +difficulty=0.25 +;; +3) +difficulty=0.1 +;; +4) +difficulty=0.08 +;; +5) +difficulty=0.05 +;; +6) +difficulty=0.02 +;; +*) +difficulty=0.2 +esac +notes=("C4" "D4" "E4" "F4" "G4" "A4" "B4") +length=$(($RANDOM % 15 + 5)) +i=0 +unset sequence +while [ $i -lt $length ]; do +sequence="${sequence}\"|sox -np synth 0.0$(($RANDOM % 5 + 4)) sq ${notes[$(($RANDOM % 6))]} pad $difficulty\" " +((i++)) +done +eval play -q ${sequence} norm -5 +sleep .5 +unset guess +i=0 +while [ -z "${guess}" ]; do +play -nqV0 synth .2 sq E4 pad .3 norm -5 & +read -sn1 -t .6 guess +((i++)) +done +if [ $i -eq $length ]; then +echo "you win!" +else +echo "you lose" +echo "You guessed $i. the actual number was $length." +fi +exit 0