cst_synth.h 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*************************************************************************/
  2. /* */
  3. /* Language Technologies Institute */
  4. /* Carnegie Mellon University */
  5. /* Copyright (c) 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 2000 */
  35. /*************************************************************************/
  36. /* */
  37. /* General synth functions */
  38. /* */
  39. /*************************************************************************/
  40. #ifndef _SYNTH_H__
  41. #define _SYNTH_H__
  42. #include "cst_hrg.h"
  43. #include "cst_tokenstream.h"
  44. #include "cst_voice.h"
  45. #include "cst_wave.h"
  46. typedef int (*cst_breakfunc)(cst_tokenstream *ts,
  47. const char *token,
  48. cst_relation *tokens);
  49. CST_VAL_USER_FUNCPTR_DCLS(breakfunc,cst_breakfunc)
  50. int default_utt_break(cst_tokenstream *ts,
  51. const char *token, cst_relation *tokens);
  52. /* You must call utt_init before any of the others. */
  53. cst_utterance *utt_init(cst_utterance *u, cst_voice *vox);
  54. cst_utterance *utt_synth(cst_utterance *u);
  55. cst_utterance *utt_synth_phones(cst_utterance *u);
  56. cst_utterance *utt_synth_tokens(cst_utterance *u);
  57. cst_utterance *utt_synth_wave(cst_wave *w,cst_voice *v);
  58. typedef struct cst_dur_stats_struct {
  59. char *phone;
  60. float mean;
  61. float stddev;
  62. } dur_stat;
  63. typedef dur_stat *dur_stats; /* only one star, due to funky cst_val magic */
  64. CST_VAL_USER_TYPE_DCLS(dur_stats,dur_stats)
  65. cst_utterance *default_segmentanalysis(cst_utterance *u);
  66. cst_utterance *default_tokenization(cst_utterance *u);
  67. cst_utterance *default_textanalysis(cst_utterance *u);
  68. cst_val *default_tokentowords(cst_item *i);
  69. cst_utterance *default_phrasing(cst_utterance *u);
  70. cst_utterance *default_pos_tagger(cst_utterance *u);
  71. cst_utterance *default_lexical_insertion(cst_utterance *u);
  72. cst_utterance *default_pause_insertion(cst_utterance *u);
  73. cst_utterance *cart_intonation(cst_utterance *u);
  74. cst_utterance *cart_duration(cst_utterance *u);
  75. cst_utterance *flat_prosody(cst_utterance *u);
  76. typedef struct cst_synth_module_struct {
  77. const char *hookname;
  78. cst_uttfunc defhook;
  79. } cst_synth_module;
  80. cst_utterance *apply_synth_module(cst_utterance *u,
  81. const cst_synth_module *mod);
  82. cst_utterance *apply_synth_method(cst_utterance *u,
  83. const cst_synth_module meth[]);
  84. #endif