| 1 | /* ----------------------------------------------------------------- */ |
| 2 | /* The English TTS System "Flite+hts_engine" */ |
| 3 | /* developed by HTS Working Group */ |
| 4 | /* http://hts-engine.sourceforge.net/ */ |
| 5 | /* ----------------------------------------------------------------- */ |
| 6 | /* */ |
| 7 | /* Copyright (c) 2005-2013 Nagoya Institute of Technology */ |
| 8 | /* Department of Computer Science */ |
| 9 | /* */ |
| 10 | /* 2005-2008 Tokyo Institute of Technology */ |
| 11 | /* Interdisciplinary Graduate School of */ |
| 12 | /* Science and Engineering */ |
| 13 | /* */ |
| 14 | /* All rights reserved. */ |
| 15 | /* */ |
| 16 | /* Redistribution and use in source and binary forms, with or */ |
| 17 | /* without modification, are permitted provided that the following */ |
| 18 | /* conditions are met: */ |
| 19 | /* */ |
| 20 | /* - Redistributions of source code must retain the above copyright */ |
| 21 | /* notice, this list of conditions and the following disclaimer. */ |
| 22 | /* - Redistributions in binary form must reproduce the above */ |
| 23 | /* copyright notice, this list of conditions and the following */ |
| 24 | /* disclaimer in the documentation and/or other materials provided */ |
| 25 | /* with the distribution. */ |
| 26 | /* - Neither the name of the HTS working group nor the names of its */ |
| 27 | /* contributors may be used to endorse or promote products derived */ |
| 28 | /* from this software without specific prior written permission. */ |
| 29 | /* */ |
| 30 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ |
| 31 | /* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ |
| 32 | /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ |
| 33 | /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ |
| 34 | /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */ |
| 35 | /* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */ |
| 36 | /* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ |
| 37 | /* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ |
| 38 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */ |
| 39 | /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, */ |
| 40 | /* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY */ |
| 41 | /* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ |
| 42 | /* POSSIBILITY OF SUCH DAMAGE. */ |
| 43 | /* ----------------------------------------------------------------- */ |
| 44 | |
| 45 | #ifndef FLITE_HTS_ENGINE_H |
| 46 | #define FLITE_HTS_ENGINE_H |
| 47 | |
| 48 | #ifdef __cplusplus |
| 49 | #define FLITE_HTS_ENGINE_H_START extern "C" { |
| 50 | #define FLITE_HTS_ENGINE_H_END } |
| 51 | #else |
| 52 | #define FLITE_HTS_ENGINE_H_START |
| 53 | #define FLITE_HTS_ENGINE_H_END |
| 54 | #endif /* __CPLUSPLUS */ |
| 55 | |
| 56 | FLITE_HTS_ENGINE_H_START; |
| 57 | |
| 58 | #include "HTS_engine.h" |
| 59 | |
| 60 | typedef struct _Flite_HTS_Engine { |
| 61 | HTS_Engine engine; |
| 62 | } Flite_HTS_Engine; |
| 63 | |
| 64 | /* Flite_HTS_Engine_initialize: initialize system */ |
| 65 | void Flite_HTS_Engine_initialize(Flite_HTS_Engine * f); |
| 66 | |
| 67 | /* Flite_HTS_Engine_load: load HTS voice */ |
| 68 | HTS_Boolean Flite_HTS_Engine_load(Flite_HTS_Engine * f, const char *fn); |
| 69 | |
| 70 | /* Flite_HTS_Engine_set_sampling_frequency: set sampling frequency */ |
| 71 | void Flite_HTS_Engine_set_sampling_frequency(Flite_HTS_Engine * f, size_t i); |
| 72 | |
| 73 | /* Flite_HTS_Engine_set_fperiod: set frame period */ |
| 74 | void Flite_HTS_Engine_set_fperiod(Flite_HTS_Engine * f, size_t i); |
| 75 | |
| 76 | /* Flite_HTS_Engine_set_audio_buff_size: set audio buffer size */ |
| 77 | void Flite_HTS_Engine_set_audio_buff_size(Flite_HTS_Engine * engine, size_t i); |
| 78 | |
| 79 | /* Flite_HTS_Engine_set_alpha: set alpha */ |
| 80 | void Flite_HTS_Engine_set_alpha(Flite_HTS_Engine * f, double d); |
| 81 | |
| 82 | /* Flite_HTS_Engine_set_beta: set beta */ |
| 83 | void Flite_HTS_Engine_set_beta(Flite_HTS_Engine * f, double d); |
| 84 | |
| 85 | /* Flite_HTS_Engine_add_half_tone: add half-tone */ |
| 86 | void Flite_HTS_Engine_add_half_tone(Flite_HTS_Engine * f, double d); |
| 87 | |
| 88 | /* Flite_HTS_Engine_set_msd_threshold: set MSD threshold */ |
| 89 | void Flite_HTS_Engine_set_msd_threshold(Flite_HTS_Engine * f, size_t stream_index, double d); |
| 90 | |
| 91 | /* Flite_HTS_Engine_set_gv_weight: set GV weight */ |
| 92 | void Flite_HTS_Engine_set_gv_weight(Flite_HTS_Engine * f, size_t stream_index, double d); |
| 93 | |
| 94 | /* Flite_HTS_Engine_set_speed: set speech speed */ |
| 95 | void Flite_HTS_Engine_set_speed(Flite_HTS_Engine * engine, double f); |
| 96 | |
| 97 | /* Flite_HTS_Engine_synthesize: synthesize speech */ |
| 98 | HTS_Boolean Flite_HTS_Engine_synthesize(Flite_HTS_Engine * f, const char *txt, const char *wav); |
| 99 | |
| 100 | HTS_Boolean Flite_HTS_Engine_synthesize_samples_mono16(Flite_HTS_Engine * f, const char *txt, |
| 101 | void** samples, int* sampleCount, int* sampleRate); |
| 102 | |
| 103 | /* Flite_HTS_Engine_clear: free system */ |
| 104 | void Flite_HTS_Engine_clear(Flite_HTS_Engine * f); |
| 105 | |
| 106 | typedef struct _Flite_Text_Analyzer { |
| 107 | void *pointer; |
| 108 | } Flite_Text_Analyzer; |
| 109 | |
| 110 | /* Flite_Text_Analyzer_initialize: initialize flite front-end */ |
| 111 | void Flite_Text_Analyzer_initialize(Flite_Text_Analyzer * analyzer); |
| 112 | |
| 113 | /* Flite_Text_Analyzer_analysis: text analysis */ |
| 114 | void Flite_Text_Analyzer_analysis(Flite_Text_Analyzer * analyzer, const char *text); |
| 115 | |
| 116 | /* Flite_Text_Analyzer_get_nphoneme_in_utterance: get number of phonemes */ |
| 117 | int Flite_Text_Analyzer_get_nphoneme_in_utterance(Flite_Text_Analyzer * analyzer); |
| 118 | |
| 119 | /* Flite_Text_Analyzer_get_phoneme: get phoneme identity */ |
| 120 | const char *Flite_Text_Analyzer_get_phoneme(Flite_Text_Analyzer * analyzer, int phoneme_index); |
| 121 | |
| 122 | /* Flite_Text_Analyzer_get_word: get word */ |
| 123 | const char *Flite_Text_Analyzer_get_word(Flite_Text_Analyzer * analyzer, int phoneme_index); |
| 124 | |
| 125 | /* Flite_Text_Analyzer_get_nphoneme_in_syllable: get number of phonemes in syllable */ |
| 126 | int Flite_Text_Analyzer_get_nphoneme_in_syllable(Flite_Text_Analyzer * analyzer, int phoneme_index); |
| 127 | |
| 128 | /* Flite_Text_Analayzer_get_nsyllable_in_word: get number of syllables in word */ |
| 129 | int Flite_Text_Analyzer_get_nsyllable_in_word(Flite_Text_Analyzer * analyzer, int phoneme_index); |
| 130 | |
| 131 | /* Flite_Text_Analyzer_get_nword_in_phrase: get number of words in phrase */ |
| 132 | int Flite_Text_Analyzer_get_nword_in_phrase(Flite_Text_Analyzer * analyzer, int phoneme_index); |
| 133 | |
| 134 | /* Flite_Text_Analyzer_get_nphrase_in_utterance: get number of phrases in utterance */ |
| 135 | int Flite_Text_Analyzer_get_nphrase_in_utterance(Flite_Text_Analyzer * analyzer, int phoneme_index); |
| 136 | |
| 137 | /* Flite_Text_Analyzer_get_accent: get accent */ |
| 138 | int Flite_Text_Analyzer_get_accent(Flite_Text_Analyzer * analyzer, int phoneme_index); |
| 139 | |
| 140 | /* Flite_Text_Analyzer_get_stress: get stress */ |
| 141 | int Flite_Text_Analyzer_get_stress(Flite_Text_Analyzer * analyzer, int phoneme_index); |
| 142 | |
| 143 | /* Flite_Text_Analyzer_clear: finalize flite front-end */ |
| 144 | void Flite_Text_Analyzer_clear(Flite_Text_Analyzer * analyzer); |
| 145 | |
| 146 | FLITE_HTS_ENGINE_H_END; |
| 147 | |
| 148 | #endif /* FLITE_HTS_ENGINE_H */ |