| 1 |
#!/bin/sh |
| 2 |
# include common script |
| 3 |
. "`dirname $0`/common" |
| 4 |
# and run needed checks before |
| 5 |
is_hash |
| 6 |
|
| 7 |
test_ssml_audio() { |
| 8 |
TEST_NAME=$1 |
| 9 |
EXPECTED=$2 |
| 10 |
TEST_TEXT=$3 |
| 11 |
OPTS=$4 |
| 12 |
|
| 13 |
echo "testing ${TEST_NAME}" |
| 14 |
RESULT=$( |
| 15 |
ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ |
| 16 |
$VALGRIND src/espeak-ng --stdout -m "${TEST_TEXT}" ${OPTS} | $sha1sum | awk '{ print $1 }' || exit 1 |
| 17 |
) |
| 18 |
if [ "x$RESULT" != "x$EXPECTED" ] ; then |
| 19 |
echo "$RESULT != $EXPECTED" |
| 20 |
exit 1 |
| 21 |
fi |
| 22 |
} |
| 23 |
|
| 24 |
test_ssml() { |
| 25 |
INPUT=$1 |
| 26 |
|
| 27 |
if [ "$2" = "punct" ] |
| 28 |
then |
| 29 |
PARAMETERS="--punct -x" |
| 30 |
else |
| 31 |
PARAMETERS="-v en-US --ipa=2" |
| 32 |
fi |
| 33 |
|
| 34 |
echo "testing ${INPUT}" |
| 35 |
EXPECTED=$(cat $(dirname $INPUT)/$(basename ${INPUT%.*}).expected) |
| 36 |
RESULT=$( |
| 37 |
ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ |
| 38 |
$VALGRIND src/espeak-ng -m -q $PARAMETERS -f ${INPUT} || exit 1 |
| 39 |
) |
| 40 |
if [ "x$RESULT" != "x$EXPECTED" ] ; then |
| 41 |
echo "$RESULT != $EXPECTED" |
| 42 |
exit 1 |
| 43 |
fi |
| 44 |
} |
| 45 |
|
| 46 |
for i in `dirname $0`/ssml/*.ssml ; do test_ssml $i; done |
| 47 |
for i in `dirname $0`/ssml/*.ssml2 ; do test_ssml $i punct; done |
| 48 |
|
| 49 |
test_ssml_audio "<prosody>" 88fccb35536158f25f4ae44a03fb005fef95c99b "<speak><prosody rate=\"x-slow\" pitch=\"low\"> Slow and low </prosody><prosody rate=\"x-fast\" pitch=\"x-high\"> Fast and high.</prosody></speak>" |
| 50 |
# #410 is a bug in SSML. Sentence termination causes prosody stack to misfunction. |
| 51 |
# Hash 8d3bace is the buggy version and should fail: |
| 52 |
test_ssml_audio "<prosody> bug #410" 8d3bace9548ae73c4770a73c88c6f65e848b45cf "<speak><prosody rate=\"x-slow\" pitch=\"low\"> Slow and low. </prosody><prosody rate=\"x-fast\" pitch=\"x-high\"> Fast and high.</prosody></speak>" |
| 53 |
test_ssml_audio "<audio>" 5134c1db757b2d6b8d1f3f2416124462e401b4c6 "<speak>ha: <audio src=\"$PWD/phsource/h/ha.wav\"></audio></speak>" |
| 54 |
|
| 55 |
test_ssml_audio "<break> at start" 949ad49d180108b30c1f0f16bef6ca2f3b6199cd "<speak><break time=\"1000ms\"/>test</speak>" |
| 56 |
|
| 57 |
# Test SSML breaks inside prosody (#1512) |
| 58 |
test_ssml_audio "<prosody 50%><break 1000ms>" bc47aac0142243b31dd1930e3462abe541c1d9ff "<speak><prosody rate=\"50%\">Break<break time=\"1000ms\"/>test</prosody></speak>" |
| 59 |
test_ssml_audio "<prosody 100%><break 1000ms>" c7b3e92d90063761e9744b40b17bc9204fe7d25b "<speak><prosody rate=\"100%\">Break<break time=\"1000ms\"/>test</prosody></speak>" |
| 60 |
test_ssml_audio "<prosody 200%><break 1000ms>" 64213dbaf593b139b0b21840ba938cf597f7ad35 "<speak><prosody rate=\"200%\">Break<break time=\"1000ms\"/>test</prosody></speak>" |
| 61 |
|
| 62 |
# Three cases following: HEAD#6a16cb3, libsonic 0.2.0-12, and --without-libsonic |
| 63 |
( test_ssml_audio "<prosody 260%><break 1000ms>" 4b4e30a2cfff1889972f013e514e81c1108283a4 "<speak><prosody rate=\"260%\">Break<break time=\"1000ms\"/>test</prosody></speak>" ) || \ |
| 64 |
( test_ssml_audio "<prosody 260%><break 1000ms>" 9849f0d27f5641db6da1a8aea82578e83656d323 "<speak><prosody rate=\"260%\">Break<break time=\"1000ms\"/>test</prosody></speak>" ) || \ |
| 65 |
( test_ssml_audio "<prosody 260%><break 1000ms>" 32a9c2887ec5b7d9d33d5503518ac0d384e43448 "<speak><prosody rate=\"260%\">Break<break time=\"1000ms\"/>test</prosody></speak>" ) || exit 1 |
| 66 |
|
| 67 |
# Test break multiplier |
| 68 |
test_ssml_audio "<break 1000ms> mul=10" 9f3b0f34eb605fcecfc573fc215626f634b46756 "<speak>Break<break time=\"1000ms\"/>test</speak>" "--ssml-break=10" |