Debian Codegraph @

lang/cmu_us_rms/cmu_us_rms.c

raw
1 /*************************************************************************/
2 /* */
3 /* Language Technologies Institute */
4 /* Carnegie Mellon University */
5 /* Copyright (c) 1999-2007 */
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 ([email protected]) */
34 /* Date: November 2007 */
35 /*************************************************************************/
36 /* */
37 /* A clustergen voice defintion */
38 /* */
39 /*************************************************************************/
40
41 #include <string.h>
42 #include "flite.h"
43 #include "cst_cg.h"
44
45 /* This isn't language independent .. */
46 #include "usenglish.h"
47 #include "cmu_lex.h"
48
49 extern cst_cg_db cmu_us_rms_cg_db;
50 cst_voice *cmu_us_rms_cg = NULL;
51
52 cst_voice *register_cmu_us_rms(const char *voxdir)
53 {
54 cst_voice *vox;
55 cst_lexicon *lex;
56
57 if (cmu_us_rms_cg)
58 return cmu_us_rms_cg; /* Already registered */
59
60 vox = new_voice();
61 vox->name = "rms";
62
63 /* Sets up language specific parameters in the cmu_us_rms. */
64 usenglish_init(vox);
65
66 /* Things that weren't filled in already. */
67 flite_feat_set_string(vox->features,"name","cmu_us_rms");
68
69 /* Lexicon */
70 lex = cmu_lex_init();
71 flite_feat_set(vox->features,"lexicon",lexicon_val(lex));
72 flite_feat_set(vox->features,"postlex_func",uttfunc_val(lex->postlex));
73
74 /* No standard segment durations are needed as its done at the */
75 /* HMM state level */
76 flite_feat_set_string(vox->features,"no_segment_duration_model","1");
77 flite_feat_set_string(vox->features,"no_f0_target_model","1");
78
79 /* Waveform synthesis */
80 flite_feat_set(vox->features,"wave_synth_func",uttfunc_val(&cg_synth));
81 flite_feat_set(vox->features,"cg_db",cg_db_val(&cmu_us_rms_cg_db));
82 flite_feat_set_int(vox->features,"sample_rate",cmu_us_rms_cg_db.sample_rate);
83
84 cmu_us_rms_cg = vox;
85
86 return cmu_us_rms_cg;
87 }
88
89 void unregister_cmu_us_rms(cst_voice *vox)
90 {
91 if (vox != cmu_us_rms_cg)
92 return;
93 delete_voice(vox);
94 cmu_us_rms_cg = NULL;
95 }
96