test_SpeechSynthesizer.praat 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # test_SpeechSynthesizer.praat
  2. # djmw 20120130, 20120522, 20160524, 20171103
  3. appendInfoLine: "SpeechSynthesizer test..."
  4. voiceslist = Extract espeak data: "Voices properties"
  5. numberOfVoices = Get number of rows
  6. languageslist = Extract espeak data: "Language properties"
  7. numberOfLanguages = Get number of rows
  8. numberOfSounds = 0
  9. for ilang to numberOfLanguages
  10. selectObject: languageslist
  11. language$ = Get value: ilang, "name"
  12. appendInfo: tab$, language$, ":"
  13. for ivoice to 3
  14. selectObject: voiceslist
  15. voice$ = Get value: randomInteger (1, numberOfVoices), "name"
  16. appendInfo: " ", voice$
  17. # some voices have spaces!
  18. ss = Create SpeechSynthesizer: language$, voice$
  19. sound = To Sound: "a e u", "no"
  20. ;Play
  21. removeObject: ss, sound
  22. numberOfSounds += 1
  23. endfor
  24. appendInfo: newline$
  25. endfor
  26. appendInfoLine: tab$, numberOfLanguages, " languages, ", numberOfSounds, " sounds created/removed"
  27. appendInfoLine: tab$, "Writing and reading..."
  28. ss = Create SpeechSynthesizer: language$, voice$
  29. Save as text file: "kanweg.SpeechSynthesizer"
  30. ss2 = Read from file: "kanweg.SpeechSynthesizer"
  31. appendInfoLine: tab$, "Compatibility:"
  32. ss3 = Create SpeechSynthesizer: "Default", "default"
  33. ss4 = Create SpeechSynthesizer: "English", "f1"
  34. removeObject: voiceslist, languageslist, ss, ss2, ss3, ss4
  35. appendInfoLine: "SpeechSynthesizer test OK"