mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
tests: add tests for ssml <prosody> and <audio>
SSML logic has a bug (#410) where speech parameters are not changed when there's a sentence elogic nd. The prosody bug test should fail.
This commit is contained in:
@@ -1,5 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Test a command for presence and ability to output the sha1 hash of a file.
|
||||
check_hashcmd() {
|
||||
which $1 &&
|
||||
$1 </dev/null 2>/dev/null |
|
||||
awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}'
|
||||
}
|
||||
|
||||
# Test some common commands to find the correct one for the system being tested on.
|
||||
echo -n "checking for SHA1 hashing command ... "
|
||||
if check_hashcmd sha1sum; then
|
||||
sha1sum=sha1sum
|
||||
elif check_hashcmd sha1; then
|
||||
sha1sum=sha1
|
||||
elif check_hashcmd shasum; then
|
||||
sha1sum=shasum
|
||||
else
|
||||
echo "no"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
test_ssml_audio() {
|
||||
TEST_NAME=$1
|
||||
EXPECTED=$2
|
||||
TEST_TEXT=$3
|
||||
|
||||
echo "testing ${TEST_NAME}"
|
||||
ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
|
||||
src/espeak-ng --stdout -m "${TEST_TEXT}" | \
|
||||
$sha1sum | awk '{ print $1 }' > actual.txt
|
||||
echo "${EXPECTED}" > expected.txt
|
||||
diff expected.txt actual.txt || exit 1
|
||||
}
|
||||
|
||||
test_ssml() {
|
||||
INPUT=$1
|
||||
|
||||
@@ -20,3 +53,8 @@ test_ssml() {
|
||||
for i in `ls tests/ssml/*.ssml` ; do test_ssml $i; done
|
||||
for i in `ls tests/ssml/*.ssml2` ; do test_ssml $i punct; done
|
||||
|
||||
test_ssml_audio "<prosody>" fcb28f00670959980038171ceda3c6bdec61b884 "<speak><prosody rate=\"x-slow\" pitch=\"low\"> Slow and low </prosody><prosody rate=\"x-fast\" pitch=\"x-high\"> Fast and high.</prosody></speak>"
|
||||
# #410 is a bug in SSML. Sentence termination causes prosody stack to misfunction.
|
||||
# Hash 00879af is the buggy version and should fail:
|
||||
test_ssml_audio "<prosody> bug #410" 00879aff11dc28a352736ca397ce9567e6f39029 "<speak><prosody rate=\"x-slow\" pitch=\"low\"> Slow and low. </prosody><prosody rate=\"x-fast\" pitch=\"x-high\"> Fast and high.</prosody></speak>"
|
||||
test_ssml_audio "<audio>" 5134c1db757b2d6b8d1f3f2416124462e401b4c6 "<speak>ha: <audio src=\"$PWD/phsource/h/ha.wav\"></audio></speak>"
|
||||
|
||||
Reference in New Issue
Block a user