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.

mbrola.test 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. check_voice_folder() {
  9. voice_file=${1#mb-} # remove mb- prefix
  10. voice_file=${voice_file%+*} # remove variant suffix
  11. if [ -f "/usr/share/mbrola/$voice_file" ]; then
  12. voice_file="/usr/share/mbrola/$voice_file"
  13. elif [ -f "/usr/share/mbrola/$voice_file/$voice_file" ]; then
  14. voice_file="/usr/share/mbrola/$voice_file/$voice_file"
  15. elif [ -f "/usr/share/mbrola/voices/$voice_file" ]; then
  16. voice_file="/usr/share/mbrola/voices/$voice_file"
  17. else
  18. voice_file=""
  19. fi
  20. }
  21. test_voice () {
  22. MBVOICE=$1
  23. EXPECTED=$2
  24. TEST_TEXT=$3
  25. check_voice_folder $MBVOICE
  26. if [ "$voice_file" != "" ]; then
  27. echo "testing ${MBVOICE} ${TEST_TEXT} ... "
  28. ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
  29. src/espeak-ng --stdout -v ${MBVOICE} "${TEST_TEXT}" | \
  30. $sha1sum | awk '{ print $1 }' > actual.txt
  31. echo "${EXPECTED}" > expected.txt
  32. diff expected.txt actual.txt || exit 1
  33. else
  34. echo "$MBVOICE was not tested"
  35. fi
  36. }
  37. # Test some common commands to find the correct one for the system being tested on.
  38. echo -n "checking for SHA1 hashing command ... "
  39. if check_hashcmd sha1sum; then
  40. sha1sum=sha1sum
  41. elif check_hashcmd sha1; then
  42. sha1sum=sha1
  43. elif check_hashcmd shasum; then
  44. sha1sum=shasum
  45. else
  46. echo "no"
  47. exit 1
  48. fi
  49. echo -n "checking if MBROLA is installed ... "
  50. if [ "`which mbrola`" != "" ]; then
  51. echo "yes"
  52. else
  53. echo "no"
  54. exit
  55. fi
  56. test_voice mb-fr4 31fae066f45d4a9dc56289344f28dd00bce77875 "Bonjour"
  57. test_voice mb-fr4+announcer f62c9cad15df194ac7cedfcfb36b6d9ccc70a634 "Bonjour" # mbrola + variant