bs_dist.tst

来自「speech signal process tools」· TST 代码 · 共 1,159 行 · 第 1/3 页

TST
1,159 行
字号
## --- FEA OUTPUT (1)## --- Make FEA comparison file (1)echo '... making comparison file ref1.fea'esig2fea - ref1.fea <<aArDvArKEsignal   0.0B  ASCII     48    902     -1Tag: LONG <r>BSD: FLOAT <r>nan: LONG 1 <g> [0]            0perceptual_weights: FLOAT 15 <g>   [0]       1.0005122      1.0014822      1.0030890      1.0055434  [4]       1.0091827      1.0145425      1.0224882      1.0344750  [8]       1.0530953      1.0833555      1.1360345      1.2380757  [12]       1.4722099      2.1588106      3.6894841src_sf: DOUBLE 1 <g> [0]        8000.000000000000distortion_type: SHORT 1 <g> [0]       1distortion_type.enumStrings: CHAR 3 5 <g>   [0][0]  "NONE\0"  [1][0]  "BSD\0\0"  [2][0]  "MBSD\0"start: LONG 2 <g>   [0]            1           1record_freq: DOUBLE 1 <g> [0]        500.0000000000000threshold: DOUBLE 1 <g> [0]        0.000000000000000start_time: DOUBLE 1 <g> [0]       0.4640000000000000recordFreq: DOUBLE <g>       500.0000000000000startTime: DOUBLE 1 <g> [0]       0.4640000000000000[Record 0]  [BSD]      0.259441035758503373843589  [Tag]         3681[Record 1]  [BSD]      0.225806772656761456036976  [Tag]         3697[Record 2]  [BSD]      0.171354368212255086191079  [Tag]         3713[Record 3]  [BSD]      0.293333686325420494010447  [Tag]         3729[Record 4]  [BSD]      0.199340179579040831664097  [Tag]         3745[Record 5]  [BSD]      0.238965539533852768877493  [Tag]         3761[Record 6]  [BSD]      0.176473200845952222026501  [Tag]         3777[Record 7]  [BSD]      0.146906793039507086591554  [Tag]         3793[Record 8]  [BSD]      0.144211633144469068103498  [Tag]         3809[Record 9]  [BSD]      0.157219425631123442882853  [Tag]         3825aArDvArK## --- Check FEA output (1)echo '... checking output'## --- Header (1)# tagged?if psps -D out1.fea | grep ' not  *tagged' >/dev/nullthen echo "* * * ERROR: file is not tagged; should be tagged"fi# generic string valuesgv_distortion_type="BSD"for i in \    distortion_typedo    x=`hditem -i $i out1.fea`    eval "pat=\$gv_$i"    case "$x" in    "$pat") : ;;    '') echo "* * * ERROR: header item $i is missing" ;;    *)  echo "* * * ERROR: header item $i is \"$x\"; should be \"$pat\"" ;;    esacdone# generic integer values    gv_nan="0"    gv_ndrec="10"    for i in \	nan	ndrec    do	x=`hditem -i $i out1.fea`	eval "pat=\$gv_$i"	case "$x" in	'') echo "* * * ERROR: header item $i is missing" ;;	*)	    case `echo "if ($x == $pat) \"OK\"" | bc` in	    OK) : ;;	    *)  echo "* * * ERROR: header item $i is $x; should be $pat" ;;	    esac	;;	esac    done    x=`hditem -i start out1.fea`    start_0=1    start_1=1    case "$x" in    '') echo "* * * ERROR: header item start is missing" ;;    *)	n=0	for i in $x	do	    n=`expr $n + 1`	done	if test $n -ne 2	then	    echo "* * * ERROR: header item start has wrong length"	else	    n=0	    for i in $x	    do		eval "y=\$start_$n"		if test $i -ne $y		then		    echo "* * * ERROR: header item start[$n] is $i;" \			 "should be $y"		fi		n=`expr $n + 1`	    done	fi	;;    esac    # generic floating-point values    gv_record_freq="500"    gv_src_sf="8000"    gv_start_time="0.464"    for i in \	record_freq   src_sf        start_time    do	x=`hditem -i $i out1.fea`	eval "pat=\$gv_$i"	case "$x" in	'') echo "* * * ERROR: header item $i is missing" ;;	*)	    case `echo	"scale=20;" \			"if (($pat) >= 0) {" \			"    if (($x) < 0.9999 * ($pat)) \"NOT\";" \			"    if (($pat) < 0.9999 * ($x)) \"NOT\"};" \			"if (($pat) < 0) {" \			"    if (($x) > 0.9999 * ($pat)) \"NOT\";" \			"    if (($pat) > 0.9999 * ($x)) \"NOT\"};" \			"\"OK\"" | bc`	    in	    OK) : ;;	    *)  echo "* * * ERROR: header item $i is $x; should be $pat" ;;	    esac	;;	esac    done    x=`hditem -i perceptual_weights out1.fea`    y=`echo "1.00051224 1.00148221 1.00308900 1.00554334 1.00918270" \	"1.01454247 1.02248820 1.03447494 1.05309536 1.08335560" \	"1.13603451 1.23807577 1.47220992 2.15881055 3.68948410"`    case "$x" in    '') echo "* * * ERROR: header item perceptual_weights is missing" ;;    *)	echo "$y" | testsd -a- tmp.sd	echo "$x" \	    | testsd -a- - \	    | addsd -g-1 tmp.sd - - \	    | feafunc -f samples -f- -FABS - dif.sd	rm -f tmp.sd	`get_esps_base`/bin/select -o tmp.sd -q'samples > 1.0e-4' \						dif.sd 2>/dev/null 1>&2	n=`hditem -i ndrec tmp.sd`	if test "$n" -ne 0	then	    echo "* * * ERROR: header item perceptual_weights is:"	    echo "$x"	    echo "should be:"	    echo "$y"	fi    esac## --- Data (1)if feaop -f BSD -f BSD \	 -f BSD_dif -O SUB out1.fea ref1.fea - \   | feafunc -fBSD_dif -f- -FABS - dif1.feathen    rm -f tmp.fea    `get_esps_base`/bin/select -o tmp.fea \	    -q'max(BSD_dif) > 1.0e-5' dif1.fea 2>/dev/null 1>&2    n=`hditem -i ndrec tmp.fea`    if test "$n" -ne 0    then	echo "* * * ERROR: BSD disagrees with ref in $n records"    fielse    echo "* * * ERROR: couldn't form BSD difference " \	 "between out1.fea and ref1.fea"fi## RUN PROGRAM (2) --- non-default command-line options except -mBSDecho 'Running command (2):'echo '    ./bs_dist -e81000 -mBSD -r2:8 -r3: \            tstA.bark tstB.bark out2.fea >log2.txt 2>err2.txt'./bs_dist -e81000 -mBSD -r2:8 -r3: \	tstA.bark tstB.bark out2.fea >log2.txt 2>err2.txtgrep -v 'tags mismatch' err2.txt## CHECK OUTPUT (2)## --- STDOUT OUTPUT (2)echo '... checking stdout output'x=`cat log2.txt`case "$x" in'') : ;;*) echo "* * * ERROR: output to stdout";;esac## --- FEA OUTPUT (2)## --- Make FEA comparison file (2)echo '... making comparison file ref2.fea'esig2fea - ref2.fea <<aArDvArKEsignal   0.0B  ASCII     48  14446     -1Tag: LONG <r>BSD: FLOAT <r>nan: LONG 1 <g> [0]            7perceptual_weights: FLOAT 15 <g>   [0]       1.0005122      1.0014822      1.0030890      1.0055434  [4]       1.0091827      1.0145425      1.0224882      1.0344750  [8]       1.0530953      1.0833555      1.1360345      1.2380757  [12]       1.4722099      2.1588106      3.6894841src_sf: DOUBLE 1 <g> [0]        8000.000000000000distortion_type: SHORT 1 <g> [0]       1distortion_type.enumStrings: CHAR 3 5 <g>   [0][0]  "NONE\0"  [1][0]  "BSD\0\0"  [2][0]  "MBSD\0"start: LONG 2 <g>   [0]            2           3record_freq: DOUBLE 1 <g> [0]        500.0000000000000threshold: DOUBLE 1 <g> [0]        81000.00000000000start_time: DOUBLE 1 <g> [0]       0.4660000000000000recordFreq: DOUBLE <g>       500.0000000000000startTime: DOUBLE 1 <g> [0]       0.4660000000000000[Record 0]  [BSD]      0.125100796891321760742254  [Tag]         3697[Record 1]  [BSD]      0.732483504072416105093803  [Tag]         3713[Record 2]  [BSD]      0.150571254998363218451734  [Tag]         3729[Record 3]  [BSD]      0.400365376452316757398863  [Tag]         3745[Record 4]  [BSD]      0.166817687882281132201733  [Tag]         3761[Record 5]  [BSD]      0.103057459831735630700981  [Tag]         3777[Record 6]  [BSD]      0.397332098269955608145606  [Tag]         3793aArDvArK## --- Check FEA output (2)echo '... checking output'## --- Header (2)# tagged?if psps -D out2.fea | grep ' not  *tagged' >/dev/nullthen echo "* * * ERROR: file is not tagged; should be tagged"fi# generic string valuesgv_distortion_type="BSD"for i in \    distortion_typedo    x=`hditem -i $i out2.fea`    eval "pat=\$gv_$i"    case "$x" in    "$pat") : ;;    '') echo "* * * ERROR: header item $i is missing" ;;    *)  echo "* * * ERROR: header item $i is \"$x\"; should be \"$pat\"" ;;    esacdone# generic integer values    gv_nan="7"    gv_ndrec="7"    for i in \	nan         ndrec    do	x=`hditem -i $i out2.fea`	eval "pat=\$gv_$i"	case "$x" in	'') echo "* * * ERROR: header item $i is missing" ;;	*)	    case `echo "if ($x == $pat) \"OK\"" | bc` in	    OK) : ;;	    *)  echo "* * * ERROR: header item $i is $x; should be $pat" ;;	    esac	;;	esac    done    x=`hditem -i start out2.fea`    start_0=2    start_1=3    case "$x" in    '') echo "* * * ERROR: header item start is missing" ;;    *)	n=0	for i in $x	do	    n=`expr $n + 1`	done	if test $n -ne 2	then	    echo "* * * ERROR: header item start has wrong length"	else	    n=0	    for i in $x	    do		eval "y=\$start_$n"		if test $i -ne $y		then		    echo "* * * ERROR: header item start[$n] is $i;" \			 "should be $y"		fi		n=`expr $n + 1`	    done	fi	;;    esac    # generic floating-point values    gv_record_freq="500"

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?