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 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/sh
  2. # Test a command for presence and ability to output the sha1 hash of a file.
  3. check_hashcmd() {
  4. which $1 &&
  5. $1 </dev/null 2>/dev/null |
  6. awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}'
  7. }
  8. # Test some common commands to find the correct one for the system being tested on.
  9. echo -n "checking for SHA1 hashing command ... "
  10. if check_hashcmd sha1sum; then
  11. sha1sum=sha1sum
  12. elif check_hashcmd sha1; then
  13. sha1sum=sha1
  14. elif check_hashcmd shasum; then
  15. sha1sum=shasum
  16. else
  17. echo "no"
  18. exit 1
  19. fi
  20. test_ssml_audio() {
  21. TEST_NAME=$1
  22. EXPECTED=$2
  23. TEST_TEXT=$3
  24. echo "testing ${TEST_NAME}"
  25. ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
  26. src/espeak-ng --stdout -m "${TEST_TEXT}" | \
  27. $sha1sum | awk '{ print $1 }' > actual.txt
  28. echo "${EXPECTED}" > expected.txt
  29. diff expected.txt actual.txt || exit 1
  30. }
  31. test_ssml() {
  32. INPUT=$1
  33. if [ "$2" = "punct" ]
  34. then
  35. PARAMETERS="--punct -x"
  36. else
  37. PARAMETERS="-v en-US --ipa=2"
  38. fi
  39. echo "testing ${INPUT}"
  40. cp $(dirname $INPUT)/$(basename ${INPUT%.*}).expected expected.txt
  41. ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
  42. src/espeak-ng -m -q $PARAMETERS -f ${INPUT} > actual.txt
  43. diff expected.txt actual.txt || exit 1
  44. }
  45. for i in `ls tests/ssml/*.ssml` ; do test_ssml $i; done
  46. for i in `ls tests/ssml/*.ssml2` ; do test_ssml $i punct; done
  47. 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>"
  48. # #410 is a bug in SSML. Sentence termination causes prosody stack to misfunction.
  49. # Hash 00879af is the buggy version and should fail:
  50. 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>"
  51. test_ssml_audio "<audio>" 5134c1db757b2d6b8d1f3f2416124462e401b4c6 "<speak>ha: <audio src=\"$PWD/phsource/h/ha.wav\"></audio></speak>"