Last active
December 30, 2015 19:09
-
-
Save mperlet/7872291 to your computer and use it in GitHub Desktop.
execute commands if microphone input >= the level variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
level=$1 | |
i=0 | |
while true; | |
do | |
l_value=$(rec -n stat trim 0 .5 2>&1 | awk '/^RMS amplitude/ { printf $3 }';) | |
is_loud=$(echo $l_value | awk -v lev="$level" '{ if ($0 >= lev) printf "1"; else printf "0" }') | |
if [ $is_loud == 1 ] | |
then | |
# execute... | |
i=$((i + 1)) | |
clear | |
echo $l_value | |
echo "counter = $i" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment