#!/bin/sh
cd ../samples_old
for i in *.wav; do
	n=50
	b=""

	echo "$i"

	while true; do
		if ( ffmpeg -y -i $b$i -af silenceremove=1:0:-${n}dB:stop_periods=1:stop_duration=0:stop_threshold=-${n}dB -ar 11025 -ac 1 ../fishtalk/samples/$i 2>&1 | grep "empty" ); then
			n=`expr $n + 10`
			b="../samples_older/"
			continue
		fi
		break
	done	
done
