Mercurial > hg > decimation
view run-tests.sh @ 23:24598a8754b4
Some helpful output
author | Chris Cannam |
---|---|
date | Mon, 21 Oct 2013 09:24:22 +0100 |
parents | 83e285b97c01 |
children | 96e9b4e2ae86 |
line wrap: on
line source
#!/bin/bash mydir="`dirname $0`" # Our input sweep is at 96kHz, so these factors correspond to 48, 24, # 12, 6, 3, and 1.5kHz. factors="2 4 8 16 32 64" original=96000 resample="$mydir/garage-resampler/resample" decimate="$mydir/qm-dsp-decimate/decimate" if [ ! -x "$resample" ]; then echo "Program $resample not found: Try running make?" exit 1 fi if [ ! -x "$decimate" ]; then echo "Program $decimate not found: Try running make?" exit 1 fi if ! sndfile-resample 2>&1 | grep -q samplerate ; then echo "Program sndfile-resample not found in PATH?" exit 1 fi do_src() { factor="$1" infile="$2" outfile="$3" time sndfile-resample -to "$(($original/$factor))" "$infile" "$outfile" } do_linear() { factor="$1" infile="$2" outfile="$3" echo "factor is $factor" echo "running... sndfile-resample -to $(($original/$factor)) -c 4 $infile $outfile" time sndfile-resample -to "$(($original/$factor))" -c 4 "$infile" "$outfile" } do_resample_hq() { factor="$1" infile="$2" outfile="$3" time "$resample" --snr 100 --bandwidth 0.02 --to "$(($original/$factor))" "$infile" "$outfile" } do_resample_mq() { factor="$1" infile="$2" outfile="$3" time "$resample" --snr 70 --bandwidth 0.03 --to "$(($original/$factor))" "$infile" "$outfile" } do_resample_lq() { factor="$1" infile="$2" outfile="$3" time "$resample" --snr 50 --bandwidth 0.05 --to "$(($original/$factor))" "$infile" "$outfile" } decimate_twice() { first="$1" second="$2" infile="$3" outfile="$4" "$decimate" --by "$first" "$infile" "$outfile".tmp "$decimate" --by "$second" "$outfile".tmp "$outfile" rm "$outfile".tmp } do_decimate() { factor="$1" infile="$2" outfile="$3" time case "$factor" in 16) decimate_twice 4 4 "$infile" "$outfile";; 32) decimate_twice 8 4 "$infile" "$outfile";; 64) decimate_twice 8 8 "$infile" "$outfile";; *) "$decimate" --by "$factor" "$infile" "$outfile";; esac } mkdir -p "$mydir"/out for f in $factors; do for impl in linear decimate resample_hq resample_mq resample_lq src; do echo "factor $f, impl $impl..." do_$impl "$f" "$mydir/infinitewave-testsignals/Swept_float.wav" "$mydir"/out/"$f"_"$impl".wav > "$mydir"/out/"$f"_"$impl".log 2>&1 done done