Page 1 of 1

simple eq frequency learning script - edited

Posted: Sat Aug 30, 2014 11:18 pm
by artek
script.sh filename

Code: Select all

#!/bin/sh
band=(63 80 100 125 160 200 250 315 400 500 630 800 1000 1250 1600 2000 2500 3150 4000 5000 6300 8000 10000 12500 16000)
bband="63 80 100 125 160 200 250 315 400 500 630 800 1000 1250 1600 2000 2500 3150 4000 5000 6300 8000 10000 12500 16000"
db="6"
br=$((RANDOM%25))

if [ -f "$1" ] ; then
	file="$1"
else
	echo "usage: $0 filename"
	exit
fi

echo "NEW TEST"
while true; do
	echo "playing original file"
	play -q $file trim 0 7 gain -$db dither
	echo "playing equed file"
	play -q $file trim 0 7 gain -$db equalizer ${band[$br]} 0.3o $db dither
	echo "$bband"
	read -p "What frequency was boosted? (r for resign, q for quit) " frq
	case $frq in
		r ) echo "it was ${band[$br]}"; br=$((RANDOM%25));echo "NEW TEST";;
		q ) echo "it was ${band[$br]}"; exit;;
		${band[$br]} ) echo OK; br=$((RANDOM%25));echo; echo "NEW TEST";;
		* ) echo wrong; echo REPEATING;;
	esac
done
script use sox program, it plays 7s of original file then plays 7s of equalized file and you must guess which frequency has been boosted by 6db.
10.08.14 changed bandwidth of equalizer to 0.3 of octave and shortened play time to 7 seconds
10.13.14 added dithering