eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ssml.test 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh
  2. # include common script
  3. . "`dirname $0`/common"
  4. # and run needed checks before
  5. is_hash
  6. test_ssml_audio() {
  7. TEST_NAME=$1
  8. EXPECTED=$2
  9. TEST_TEXT=$3
  10. echo "testing ${TEST_NAME}"
  11. ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
  12. src/espeak-ng --stdout -m "${TEST_TEXT}" | \
  13. $sha1sum | awk '{ print $1 }' > actual.txt
  14. echo "${EXPECTED}" > expected.txt
  15. diff expected.txt actual.txt || exit 1
  16. }
  17. test_ssml() {
  18. INPUT=$1
  19. if [ "$2" = "punct" ]
  20. then
  21. PARAMETERS="--punct -x"
  22. else
  23. PARAMETERS="-v en-US --ipa=2"
  24. fi
  25. echo "testing ${INPUT}"
  26. cp $(dirname $INPUT)/$(basename ${INPUT%.*}).expected expected.txt
  27. ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
  28. src/espeak-ng -m -q $PARAMETERS -f ${INPUT} > actual.txt
  29. diff expected.txt actual.txt || exit 1
  30. }
  31. for i in `ls tests/ssml/*.ssml` ; do test_ssml $i; done
  32. for i in `ls tests/ssml/*.ssml2` ; do test_ssml $i punct; done
  33. 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>"
  34. # #410 is a bug in SSML. Sentence termination causes prosody stack to misfunction.
  35. # Hash 00879af is the buggy version and should fail:
  36. 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>"
  37. test_ssml_audio "<audio>" 5134c1db757b2d6b8d1f3f2416124462e401b4c6 "<speak>ha: <audio src=\"$PWD/phsource/h/ha.wav\"></audio></speak>"