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

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