VOICE_ldom.c 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*************************************************************************/
  2. /* */
  3. /* Language Technologies Institute */
  4. /* Carnegie Mellon University */
  5. /* Copyright (c) 1999-2000 */
  6. /* All Rights Reserved. */
  7. /* */
  8. /* Permission is hereby granted, free of charge, to use and distribute */
  9. /* this software and its documentation without restriction, including */
  10. /* without limitation the rights to use, copy, modify, merge, publish, */
  11. /* distribute, sublicense, and/or sell copies of this work, and to */
  12. /* permit persons to whom this work is furnished to do so, subject to */
  13. /* the following conditions: */
  14. /* 1. The code must retain the above copyright notice, this list of */
  15. /* conditions and the following disclaimer. */
  16. /* 2. Any modifications must be clearly marked as such. */
  17. /* 3. Original authors' names are not deleted. */
  18. /* 4. The authors' names are not used to endorse or promote products */
  19. /* derived from this software without specific prior written */
  20. /* permission. */
  21. /* */
  22. /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
  23. /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
  24. /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
  25. /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
  26. /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
  27. /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
  28. /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
  29. /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
  30. /* THIS SOFTWARE. */
  31. /* */
  32. /*************************************************************************/
  33. /* Author: Alan W Black (awb@cs.cmu.edu) */
  34. /* Date: September 2002 */
  35. /*************************************************************************/
  36. /* */
  37. /* A simple ldom voice defintion */
  38. /* */
  39. /*************************************************************************/
  40. #include <string.h>
  41. #include "flite.h"
  42. #include "cst_clunits.h"
  43. #include "usenglish.h"
  44. #include "cmulex.h"
  45. static char *__VOICENAME___unit_name(cst_item *s);
  46. extern cst_clunit_db __VOICENAME___db;
  47. cst_voice *__VOICENAME___clunits = NULL;
  48. cst_voice *register___VOICENAME__(const char *voxdir)
  49. {
  50. cst_voice *v = new_voice();
  51. v->name = "__NICKNAME__";
  52. /* Sets up language specific parameters in the __VOICENAME__. */
  53. usenglish_init(v);
  54. /* Things that weren't filled in already. */
  55. feat_set_string(v->features,"name","__VOICENAME__");
  56. /* Lexicon */
  57. cmu_lex_init();
  58. feat_set(v->features,"lexicon",lexicon_val(&cmu_lex));
  59. /* Waveform synthesis */
  60. feat_set(v->features,"wave_synth_func",uttfunc_val(&clunits_synth));
  61. feat_set(v->features,"clunit_db",clunit_db_val(&__VOICENAME___db));
  62. feat_set_int(v->features,"sample_rate",__VOICENAME___db.sts->sample_rate);
  63. feat_set_string(v->features,"join_type","simple_join");
  64. feat_set_string(v->features,"resynth_type","fixed");
  65. /* Unit selection */
  66. __VOICENAME___db.unit_name_func = __VOICENAME___unit_name;
  67. __VOICENAME___clunits = v;
  68. return __VOICENAME___clunits;
  69. }
  70. void unregister___VOICENAME__(cst_voice *vox)
  71. {
  72. if (vox != __VOICENAME___clunits)
  73. return;
  74. delete_voice(vox);
  75. __VOICENAME___clunits = NULL;
  76. }
  77. static char *__VOICENAME___unit_name(cst_item *s)
  78. {
  79. return clunits_ldom_phone_word(s);
  80. }