Skip to content

Commit dc3579b

Browse files
committed
Test-case: Add to check-alsabat.sh additional audio test
This patch adds run of check_wav_file_snr.m script for the alsabat capture file to analyze with STFT spectra the audio quality. A drop in signal-to-noise ratio in a single FFT indicates presence of glitch. A low SNR result triggers run of additional glitch periodicity finder. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 02aafc0 commit dc3579b

File tree

2 files changed

+456
-1
lines changed

2 files changed

+456
-1
lines changed

test-case/check-alsabat.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
rm -f /tmp/bat.wav.*
2020

2121
# shellcheck source=case-lib/lib.sh
22-
source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh
22+
TESTDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
23+
source "$TESTDIR/case-lib/lib.sh"
2324

2425
OPT_NAME['p']='pcm_p' OPT_DESC['p']='pcm for playback. Example: hw:0,0'
2526
OPT_HAS_ARG['p']=1 OPT_VAL['p']=''
@@ -95,6 +96,20 @@ function __upload_wav_file
9596
done
9697
}
9798

99+
function check_wav_file_snr
100+
{
101+
for file in /tmp/bat.wav.*
102+
do
103+
if test -s "$file"; then
104+
dlogi "Checking wav file $file"
105+
cd "$TESTDIR"/tools
106+
octave --silent --no-gui --eval "check_wav_file_snr('$file', $frequency, '$LOG_ROOT/')" || {
107+
die "Error: Script check_wav_file_snr.m found issues in $file"
108+
}
109+
fi
110+
done
111+
}
112+
98113
# check the PCMs before alsabat test
99114
dlogi "check the PCMs before alsabat test"
100115
aplay -Dplug$pcm_p -d 1 /dev/zero -q || die "Failed to play on PCM: $pcm_p"
@@ -119,4 +134,6 @@ alsabat -C$pcm_c -c $channel_c -r $rate -f $format -F $frequency -k $sigmak || {
119134
exit 1
120135
}
121136

137+
check_wav_file_snr
138+
122139
wait $playPID

0 commit comments

Comments
 (0)