Skip to content

Commit a4a0a5b

Browse files
committed
ability to insert errors
1 parent 877e5ac commit a4a0a5b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

script/train_trellis.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ function listen() {
3737

3838
fullfile_out=$2
3939
vq_fn=$3
40-
40+
EbNodB=$4
41+
4142
sox $fullfile -t raw - | c2sim - --rateK --rateKout ${filename}.f32
4243

4344
echo "ratek=load_f32('../build_linux/${filename}.f32',20); vq_700c_eq; ratek_lim=limit_vec(ratek, 0, 40); save_f32('../build_linux/${filename}_lim.f32', ratek_lim); quit" | \
4445
octave -p ${CODEC2_PATH}/octave -qf
4546

46-
echo "pkg load statistics; vq_compare(action='vq_file', '${vq_fn}', EbNodB=100, '${filename}_lim.f32', '${filename}_test.f32'); quit" \ |
47+
echo "pkg load statistics; vq_compare(action='vq_file', '${vq_fn}', EbNodB=${EbNodB}, '${filename}_lim.f32', '${filename}_test.f32'); quit" \ |
4748
octave -p ${CODEC2_PATH}/octave -qf
4849

4950
sox $fullfile -t raw - | c2sim - --rateK --rateKin ${filename}_test.f32 -o - | sox -t .s16 -r 8000 -c 1 - ${fullfile_out}
@@ -53,7 +54,7 @@ function print_help {
5354
echo
5455
echo "Trellis/VQ optimisation support script"
5556
echo
56-
echo " usage ./train_trellis.sh [-d] [-t] [-v in.wav out.wav vq.f32]"
57+
echo " usage ./train_trellis.sh [-d] [-t] [-v in.wav out.wav vq.f32 EbNodB]"
5758
echo
5859
echo " -d debug mode; trace script execution"
5960
echo " -t train VQ and generate a fully quantised version of training vectors"
@@ -88,10 +89,12 @@ case $key in
8889
in_wav="$2"
8990
out_wav="$3"
9091
vq_fn="$4"
92+
EbNodB="$5"
9193
shift
9294
shift
9395
shift
9496
shift
97+
shift
9598
;;
9699
-h)
97100
print_help
@@ -109,5 +112,5 @@ if [ $do_train -eq 1 ]; then
109112
fi
110113

111114
if [ $do_vq -eq 1 ]; then
112-
listen ${in_wav} ${out_wav} ${vq_fn}
115+
listen ${in_wav} ${out_wav} ${vq_fn} ${EbNodB}
113116
fi

0 commit comments

Comments
 (0)