| 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 |  | 
| 43 | #include "cst_hrg.h" | 
| 44 | #include "cst_tokenstream.h" | 
| 45 | #include "cst_voice.h" | 
| 46 | #include "cst_wave.h" | 
| 47 |  | 
| 48 | typedef int (*cst_breakfunc)(cst_tokenstream *ts,  | 
| 49 | 		             const char *token,  | 
| 50 | 			     cst_relation *tokens); | 
| 51 | CST_VAL_USER_FUNCPTR_DCLS(breakfunc,cst_breakfunc) | 
| 52 | int default_utt_break(cst_tokenstream *ts, | 
| 53 | 		      const char *token, cst_relation *tokens); | 
| 54 |  | 
| 55 | /* You must call utt_init before any of the others. */ | 
| 56 | cst_utterance *utt_init(cst_utterance *u, cst_voice *vox); | 
| 57 | cst_utterance *utt_synth(cst_utterance *u); | 
| 58 | cst_utterance *utt_synth_phones(cst_utterance *u); | 
| 59 | cst_utterance *utt_synth_tokens(cst_utterance *u); | 
| 60 | cst_utterance *utt_synth_wave(cst_wave *w,cst_voice *v); | 
| 61 |  | 
| 62 | typedef struct cst_dur_stats_struct { | 
| 63 |     const char *phone; | 
| 64 |     float mean; | 
| 65 |     float stddev; | 
| 66 | } dur_stat; | 
| 67 | typedef dur_stat *dur_stats; /* only one star, due to funky cst_val magic */ | 
| 68 | CST_VAL_USER_TYPE_DCLS(dur_stats,dur_stats) | 
| 69 |  | 
| 70 | cst_utterance *default_segmentanalysis(cst_utterance *u); | 
| 71 |  | 
| 72 | cst_utterance *default_tokenization(cst_utterance *u); | 
| 73 | cst_utterance *default_textanalysis(cst_utterance *u); | 
| 74 | cst_val *default_tokentowords(cst_item *i); | 
| 75 | cst_utterance *default_phrasing(cst_utterance *u); | 
| 76 | cst_utterance *default_pos_tagger(cst_utterance *u); | 
| 77 | cst_utterance *default_lexical_insertion(cst_utterance *u); | 
| 78 | cst_utterance *default_pause_insertion(cst_utterance *u); | 
| 79 |  | 
| 80 | cst_utterance *cart_intonation(cst_utterance *u); | 
| 81 | cst_utterance *cart_duration(cst_utterance *u); | 
| 82 |  | 
| 83 | cst_utterance *flat_prosody(cst_utterance *u); | 
| 84 |  | 
| 85 | typedef struct cst_synth_module_struct { | 
| 86 |     const char *hookname; | 
| 87 |     cst_uttfunc defhook; | 
| 88 | } cst_synth_module; | 
| 89 |  | 
| 90 | cst_utterance *apply_synth_module(cst_utterance *u, | 
| 91 | 				  const cst_synth_module *mod); | 
| 92 | cst_utterance *apply_synth_method(cst_utterance *u, | 
| 93 | 				  const cst_synth_module meth[]); | 
| 94 | #endif | 
| 95 |  | 
| 96 |  |