Skip to content

Commit 8dc6052

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 alsabat capture file to analyze with STFT spectra the audio quality. Dropped 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 ba2f6c5 commit 8dc6052

File tree

2 files changed

+391
-1
lines changed

2 files changed

+391
-1
lines changed

test-case/check-alsabat.sh

Lines changed: 20 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,22 @@ 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+
die "Failed to enter directory tools"
107+
}
108+
octave --silent --no-gui --eval "check_wav_file_snr('$file', $frequency, '$LOG_ROOT/')" || {
109+
die "Error: Script check_wav_file_snr.m found issues in $file"
110+
}
111+
fi
112+
done
113+
}
114+
98115
# check the PCMs before alsabat test
99116
dlogi "check the PCMs before alsabat test"
100117
aplay -Dplug$pcm_p -d 1 /dev/zero -q || die "Failed to play on PCM: $pcm_p"
@@ -119,4 +136,6 @@ alsabat -C$pcm_c -c $channel_c -r $rate -f $format -F $frequency -k $sigmak || {
119136
exit 1
120137
}
121138

139+
check_wav_file_snr
140+
122141
wait $playPID

0 commit comments

Comments
 (0)