forked from google/visqol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculate_metric.sh
41 lines (29 loc) · 1003 Bytes
/
calculate_metric.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
echo start
# specify directory of files to evaluate
DIR_files="audio/to_evaluate"
# specify directory of original files
DIR_original="audio/original"
# fetch timestamp
dateofeval=`date +%Y%m%d_%H%M`
for file in `ls $DIR_files`
do
# what is the correct sound file?
sound=`cut -d "." -f 1 <<< "$file"`
sound=`echo "$sound" | rev | cut -d '_' -f 1 | rev`
# specify path to current signal
PATH_file=$DIR_files"/"$file
# specify path to original signal
PATH_original=$DIR_original"/original_$sound.wav"
# first upsample files and create correct header
ffmpeg -y -i $PATH_file -vn -ar 16000 -loglevel 24 $PATH_file
ffmpeg -y -i $PATH_original -vn -ar 16000 -loglevel 24 $PATH_original
# rename results file name to include time of evaluation
PATH_results="results/ViSQOL_scores_$dateofeval.csv"
# calculate ViSQOL metric
bazel-bin/visqol.exe \
--reference_file $PATH_original \
--degraded_file $PATH_file \
--use_speech_mode \
--results_csv $PATH_results
done