| 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 ([email protected]) */ |
| 34 |
/* Date: April 2001 */ |
| 35 |
/*************************************************************************/ |
| 36 |
/* */ |
| 37 |
/* A simple clunits/ldom voice defintion */ |
| 38 |
/* */ |
| 39 |
/*************************************************************************/ |
| 40 |
|
| 41 |
#include <string.h> |
| 42 |
#include "flite.h" |
| 43 |
#include "cst_clunits.h" |
| 44 |
#include "usenglish.h" |
| 45 |
#include "cmu_lex.h" |
| 46 |
|
| 47 |
int cmu_syl_boundary(const cst_item *i,const cst_val *rest); |
| 48 |
|
| 49 |
static char *cmu_time_awb_unit_name(cst_item *s); |
| 50 |
|
| 51 |
extern cst_clunit_db cmu_time_awb_db; |
| 52 |
|
| 53 |
extern const int cmu_time_awb_lex_entry[]; |
| 54 |
extern const unsigned char cmu_time_awb_lex_data[]; |
| 55 |
extern const int cmu_time_awb_num_entries; |
| 56 |
extern const int cmu_time_awb_num_bytes; |
| 57 |
extern const char * const cmu_time_awb_lex_phone_table[36]; |
| 58 |
extern const char * const cmu_time_awb_lex_phones_huff_table[]; |
| 59 |
extern const char * const cmu_time_awb_lex_entries_huff_table[]; |
| 60 |
|
| 61 |
cst_lexicon cmu_time_awb_lex; |
| 62 |
|
| 63 |
cst_voice *cmu_time_awb_ldom = NULL; |
| 64 |
|
| 65 |
cst_voice *register_cmu_time_awb(const char *voxdir) |
| 66 |
{ |
| 67 |
cst_voice *v = new_voice(); |
| 68 |
|
| 69 |
v->name = "awb_time"; |
| 70 |
|
| 71 |
/* Sets up language specific parameters in the voice. */ |
| 72 |
usenglish_init(v); |
| 73 |
|
| 74 |
/* Things that weren't filled in already. */ |
| 75 |
flite_feat_set_string(v->features,"name","cmu_time_awb"); |
| 76 |
|
| 77 |
/* Lexicon */ |
| 78 |
cmu_time_awb_lex.name = "cmu_time_awb"; |
| 79 |
cmu_time_awb_lex.num_entries = cmu_time_awb_num_entries; |
| 80 |
cmu_time_awb_lex.num_bytes = cmu_time_awb_num_bytes; |
| 81 |
cmu_time_awb_lex.data = (unsigned char*) cmu_time_awb_lex_data; |
| 82 |
cmu_time_awb_lex.phone_table = (char**) cmu_time_awb_lex_phone_table; |
| 83 |
cmu_time_awb_lex.syl_boundary = cmu_syl_boundary; |
| 84 |
cmu_time_awb_lex.lts_rule_set = NULL; |
| 85 |
cmu_time_awb_lex.phone_hufftable = cmu_time_awb_lex_phones_huff_table; |
| 86 |
cmu_time_awb_lex.entry_hufftable = cmu_time_awb_lex_entries_huff_table; |
| 87 |
|
| 88 |
flite_feat_set(v->features,"lexicon",lexicon_val(&cmu_time_awb_lex)); |
| 89 |
|
| 90 |
/* Waveform synthesis */ |
| 91 |
flite_feat_set(v->features,"wave_synth_func",uttfunc_val(&clunits_synth)); |
| 92 |
flite_feat_set(v->features,"clunit_db",clunit_db_val(&cmu_time_awb_db)); |
| 93 |
flite_feat_set_int(v->features,"sample_rate",cmu_time_awb_db.sts->sample_rate); |
| 94 |
flite_feat_set_string(v->features,"join_type","simple_join"); |
| 95 |
flite_feat_set_string(v->features,"resynth_type","fixed"); |
| 96 |
|
| 97 |
/* Unit selection */ |
| 98 |
cmu_time_awb_db.unit_name_func = cmu_time_awb_unit_name; |
| 99 |
|
| 100 |
cmu_time_awb_ldom = v; |
| 101 |
|
| 102 |
return cmu_time_awb_ldom; |
| 103 |
} |
| 104 |
|
| 105 |
void unregister_cmu_time_awb(cst_voice *vox) |
| 106 |
{ |
| 107 |
if (vox != cmu_time_awb_ldom) |
| 108 |
return; |
| 109 |
delete_voice(vox); |
| 110 |
cmu_time_awb_ldom = NULL; |
| 111 |
} |
| 112 |
|
| 113 |
static char *cmu_time_awb_unit_name(cst_item *s) |
| 114 |
{ |
| 115 |
return clunits_ldom_phone_word(s); |
| 116 |
} |