| 1 | /* |
| 2 | * Copyright (C) 2005 to 2014 by Jonathan Duddington |
| 3 | * email: [email protected] |
| 4 | * Copyright (C) 2015-2017 Reece H. Dunn |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, see: <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #ifndef ESPEAK_NG_SYNTHESIZE_H |
| 21 | #define ESPEAK_NG_SYNTHESIZE_Hcxx . . $ `external/espeak/synthesize.h:21:9`! |
| 22 | |
| 23 | #ifdef __cpluspluscxx . . $ `<built-in>:470:9`! |
| 24 | extern "C" |
| 25 | { |
| 26 | #endif |
| 27 | |
| 28 | #include <stdint.h> |
| 29 | #include <stdbool.h> |
| 30 | #include "espeak_ng.h"cxx . . $ `<file>/external/espeak/espeak_ng.h`/ |
| 31 | #include "phoneme.h"cxx . . $ `<file>/external/espeak/phoneme.h`/ // for PHONEME_TAB, N_PHONEME_TAB |
| 32 | |
| 33 | #define espeakINITIALIZE_PHONEME_IPAcxx . . $ `external/espeak/synthesize.h:33:9`! 0x0002 // move this to speak_lib.h, after eSpeak version 1.46.02 |
| 34 | |
| 35 | #define N_PHONEME_LISTcxx . . $ `external/espeak/synthesize.h:35:9`! 1000 // enough for source[N_TR_SOURCE] full of text, else it will truncate |
| 36 | |
| 37 | #define N_SEQ_FRAMEScxx . . $ `external/espeak/synthesize.h:37:9`! 25 // max frames in a spectrum sequence (real max is ablut 8) |
| 38 | #define STEPSIZEcxx . . $ `external/espeak/synthesize.h:38:9`! 64 // 2.9mS at 22 kHz sample rate |
| 39 | |
| 40 | // flags set for frames within a spectrum sequence |
| 41 | #define FRFLAG_KLATTcxx . . $ `external/espeak/synthesize.h:41:9`! 0x01 // this frame includes extra data for Klatt synthesizer |
| 42 | #define FRFLAG_VOWEL_CENTREcxx . . $ `external/espeak/synthesize.h:42:9`! 0x02 // centre point of vowel |
| 43 | #define FRFLAG_LEN_MODcxx . . $ `external/espeak/synthesize.h:43:9`! 0x04 // reduce effect of length adjustment |
| 44 | #define FRFLAG_BREAK_LFcxx . . $ `external/espeak/synthesize.h:44:9`! 0x08 // but keep f3 upwards |
| 45 | #define FRFLAG_BREAKcxx . . $ `external/espeak/synthesize.h:45:9`! 0x10 // don't merge with next frame |
| 46 | #define FRFLAG_FORMANT_RATEcxx . . $ `external/espeak/synthesize.h:46:9`! 0x20 // Flag5 allow increased rate of change of formant freq |
| 47 | #define FRFLAG_MODULATEcxx . . $ `external/espeak/synthesize.h:47:9`! 0x40 // Flag6 modulate amplitude of some cycles to give trill |
| 48 | #define FRFLAG_DEFER_WAVcxx . . $ `external/espeak/synthesize.h:48:9`! 0x80 // Flag7 defer mixing WAV until the next frame |
| 49 | #define FRFLAG_LEN_MOD2cxx . . $ `external/espeak/synthesize.h:49:9`! 0x4000 // reduce effect of length adjustment, used for the start of a vowel |
| 50 | #define FRFLAG_COPIEDcxx . . $ `external/espeak/synthesize.h:50:9`! 0x8000 // This frame has been copied into temporary rw memory |
| 51 | |
| 52 | #define SFLAG_SEQCONTINUEcxx . . $ `external/espeak/synthesize.h:52:9`! 0x01 // a liquid or nasal after a vowel, but not followed by a vowel |
| 53 | #define SFLAG_EMBEDDEDcxx . . $ `external/espeak/synthesize.h:53:9`! 0x02 // there are embedded commands before this phoneme |
| 54 | #define SFLAG_SYLLABLEcxx . . $ `external/espeak/synthesize.h:54:9`! 0x04 // vowel or syllabic consonant |
| 55 | #define SFLAG_LENGTHENcxx . . $ `external/espeak/synthesize.h:55:9`! 0x08 // lengthen symbol : included after this phoneme |
| 56 | #define SFLAG_DICTIONARYcxx . . $ `external/espeak/synthesize.h:56:9`! 0x10 // the pronunciation of this word was listed in the xx_list dictionary |
| 57 | #define SFLAG_SWITCHED_LANGcxx . . $ `external/espeak/synthesize.h:57:9`! 0x20 // this word uses phonemes from a different language |
| 58 | #define SFLAG_PROMOTE_STRESScxx . . $ `external/espeak/synthesize.h:58:9`! 0x40 // this unstressed word can be promoted to stressed |
| 59 | |
| 60 | #define SFLAG_NEXT_PAUSEcxx . . $ `external/espeak/synthesize.h:60:9`! 0x2000 // consider next phoneme as pause |
| 61 | |
| 62 | // embedded command numbers |
| 63 | #define EMBED_Pcxx . . $ `external/espeak/synthesize.h:63:9`! 1 // pitch |
| 64 | #define EMBED_Scxx . . $ `external/espeak/synthesize.h:64:9`! 2 // speed (used in setlengths) |
| 65 | #define EMBED_Acxx . . $ `external/espeak/synthesize.h:65:9`! 3 // amplitude/volume |
| 66 | #define EMBED_Rcxx . . $ `external/espeak/synthesize.h:66:9`! 4 // pitch range/expression |
| 67 | #define EMBED_Hcxx . . $ `external/espeak/synthesize.h:67:9`! 5 // echo/reverberation |
| 68 | #define EMBED_Tcxx . . $ `external/espeak/synthesize.h:68:9`! 6 // different tone for announcing punctuation (not used) |
| 69 | #define EMBED_Icxx . . $ `external/espeak/synthesize.h:69:9`! 7 // sound icon |
| 70 | #define EMBED_S2cxx . . $ `external/espeak/synthesize.h:70:9`! 8 // speed (used in synthesize) |
| 71 | #define EMBED_Ycxx . . $ `external/espeak/synthesize.h:71:9`! 9 // say-as commands |
| 72 | #define EMBED_Mcxx . . $ `external/espeak/synthesize.h:72:9`! 10 // mark name |
| 73 | #define EMBED_Ucxx . . $ `external/espeak/synthesize.h:73:9`! 11 // audio uri |
| 74 | #define EMBED_Bcxx . . $ `external/espeak/synthesize.h:74:9`! 12 // break |
| 75 | #define EMBED_Fcxx . . $ `external/espeak/synthesize.h:75:9`! 13 // emphasis |
| 76 | |
| 77 | #define N_EMBEDDED_VALUEScxx . . $ `external/espeak/synthesize.h:77:9`! 15 |
| 78 | extern int embedded_value[N_EMBEDDED_VALUEScxx . . $ `external/espeak/synthesize.h:77:9`!]; |
| 79 | extern const int embedded_default[N_EMBEDDED_VALUEScxx . . $ `external/espeak/synthesize.h:77:9`!]; |
| 80 | |
| 81 | #define N_KLATTPcxx . . $ `external/espeak/synthesize.h:81:9`! 10 // this affects the phoneme data file format |
| 82 | #define N_KLATTP2cxx . . $ `external/espeak/synthesize.h:82:9`! 14 // used in vowel files, with extra parameters for future extensions |
| 83 | |
| 84 | #define KLATT_AVcxx . . $ `external/espeak/synthesize.h:84:9`! 0 |
| 85 | #define KLATT_FNZcxx . . $ `external/espeak/synthesize.h:85:9`! 1 // nasal zero freq |
| 86 | #define KLATT_Tiltcxx . . $ `external/espeak/synthesize.h:86:9`! 2 |
| 87 | #define KLATT_Asprcxx . . $ `external/espeak/synthesize.h:87:9`! 3 |
| 88 | #define KLATT_Skewcxx . . $ `external/espeak/synthesize.h:88:9`! 4 |
| 89 | |
| 90 | #define KLATT_Kopencxx . . $ `external/espeak/synthesize.h:90:9`! 5 |
| 91 | #define KLATT_AVpcxx . . $ `external/espeak/synthesize.h:91:9`! 6 |
| 92 | #define KLATT_Friccxx . . $ `external/espeak/synthesize.h:92:9`! 7 |
| 93 | #define KLATT_FricBPcxx . . $ `external/espeak/synthesize.h:93:9`! 8 |
| 94 | #define KLATT_Turbcxx . . $ `external/espeak/synthesize.h:94:9`! 9 |
| 95 | |
| 96 | typedef struct { // 64 bytes |
| 97 | short frflags; |
| 98 | short ffreq[7]; |
| 99 | unsigned char length; |
| 100 | unsigned char rms; |
| 101 | unsigned char fheight[8]; |
| 102 | unsigned char fwidth[6]; // width/4 f0-5 |
| 103 | unsigned char fright[3]; // width/4 f0-2 |
| 104 | unsigned char bw[4]; // Klatt bandwidth BNZ /2, f1,f2,f3 |
| 105 | unsigned char klattp[5]; // AV, FNZ, Tilt, Aspr, Skew |
| 106 | unsigned char klattp2[5]; // continuation of klattp[], Avp, Fric, FricBP, Turb |
| 107 | unsigned char klatt_ap[7]; // Klatt parallel amplitude |
| 108 | unsigned char klatt_bp[7]; // Klatt parallel bandwidth /2 |
| 109 | unsigned char spare; // pad to multiple of 4 bytes |
| 110 | } frame_t; // with extra Klatt parameters for parallel resonators |
| 111 | |
| 112 | typedef struct { // 44 bytes |
| 113 | short frflags; |
| 114 | short ffreq[7]; |
| 115 | unsigned char length; |
| 116 | unsigned char rms; |
| 117 | unsigned char fheight[8]; |
| 118 | unsigned char fwidth[6]; // width/4 f0-5 |
| 119 | unsigned char fright[3]; // width/4 f0-2 |
| 120 | unsigned char bw[4]; // Klatt bandwidth BNZ /2, f1,f2,f3 |
| 121 | unsigned char klattp[5]; // AV, FNZ, Tilt, Aspr, Skew |
| 122 | } frame_t2; // without the extra Klatt parameters |
| 123 | |
| 124 | typedef struct { |
| 125 | const unsigned char *pitch_env; |
| 126 | int pitch; // pitch Hz*256 |
| 127 | int pitch_ix; // index into pitch envelope (*256) |
| 128 | int pitch_inc; // increment to pitch_ix |
| 129 | int pitch_base; // Hz*256 low, before modified by envelope |
| 130 | int pitch_range; // Hz*256 range of envelope |
| 131 | |
| 132 | unsigned char *mix_wavefile; // wave file to be added to synthesis |
| 133 | int n_mix_wavefile; // length in bytes |
| 134 | int mix_wave_scale; // 0=2 byte samples |
| 135 | int mix_wave_amp; |
| 136 | int mix_wavefile_ix; |
| 137 | int mix_wavefile_max; // length of available WAV data (in bytes) |
| 138 | int mix_wavefile_offset; |
| 139 | |
| 140 | int amplitude; |
| 141 | int amplitude_v; |
| 142 | int amplitude_fmt; // percentage amplitude adjustment for formant synthesis |
| 143 | } WGEN_DATA; |
| 144 | |
| 145 | typedef struct { |
| 146 | double a; |
| 147 | double b; |
| 148 | double c; |
| 149 | double x1; |
| 150 | double x2; |
| 151 | } RESONATOR; |
| 152 | |
| 153 | typedef struct { |
| 154 | short length_total; // not used |
| 155 | unsigned char n_frames; |
| 156 | unsigned char sqflags; |
| 157 | frame_t2 frame[N_SEQ_FRAMEScxx . . $ `external/espeak/synthesize.h:37:9`!]; // max. frames in a spectrum sequence |
| 158 | } SPECT_SEQ; // sequence of espeak formant frames |
| 159 | |
| 160 | typedef struct { |
| 161 | short length_total; // not used |
| 162 | unsigned char n_frames; |
| 163 | unsigned char sqflags; |
| 164 | frame_t frame[N_SEQ_FRAMEScxx . . $ `external/espeak/synthesize.h:37:9`!]; // max. frames in a spectrum sequence |
| 165 | } SPECT_SEQK; // sequence of klatt formants frames |
| 166 | |
| 167 | typedef struct { |
| 168 | short length; |
| 169 | short frflags; |
| 170 | frame_t *frame; |
| 171 | } frameref_t; |
| 172 | |
| 173 | // a clause translated into phoneme codes (first stage) |
| 174 | typedef struct { |
| 175 | unsigned short synthflags; // NOTE Put shorts on 32bit boundaries, because of RISC OS compiler bug? |
| 176 | unsigned char phcode; |
| 177 | unsigned char stresslevel; |
| 178 | unsigned short sourceix; // ix into the original source text string, only set at the start of a word |
| 179 | unsigned char wordstress; // the highest level stress in this word |
| 180 | unsigned char tone_ph; // tone phoneme to use with this vowel |
| 181 | } PHONEME_LIST2; |
| 182 | |
| 183 | #define PHLIST_START_OF_WORDcxx . . $ `external/espeak/synthesize.h:183:9`! 1 |
| 184 | #define PHLIST_END_OF_CLAUSEcxx . . $ `external/espeak/synthesize.h:184:9`! 2 |
| 185 | #define PHLIST_START_OF_SENTENCEcxx . . $ `external/espeak/synthesize.h:185:9`! 4 |
| 186 | #define PHLIST_START_OF_CLAUSEcxx . . $ `external/espeak/synthesize.h:186:9`! 8 |
| 187 | |
| 188 | typedef struct { |
| 189 | // The first section is a copy of PHONEME_LIST2 |
| 190 | unsigned short synthflags; |
| 191 | unsigned char phcode; |
| 192 | unsigned char stresslevel; |
| 193 | unsigned short sourceix; // ix into the original source text string, only set at the start of a word |
| 194 | unsigned char wordstress; // the highest level stress in this word |
| 195 | unsigned char tone_ph; // tone phoneme to use with this vowel |
| 196 | |
| 197 | PHONEME_TAB *ph; |
| 198 | unsigned int length; // length_mod |
| 199 | unsigned char env; // pitch envelope number |
| 200 | unsigned char type; |
| 201 | unsigned char prepause; |
| 202 | unsigned char amp; |
| 203 | unsigned char newword; // bit flags, see PHLIST_(START|END)_OF_* |
| 204 | unsigned char pitch1; |
| 205 | unsigned char pitch2; |
| 206 | unsigned char std_length; |
| 207 | unsigned int phontab_addr; |
| 208 | int sound_param; |
| 209 | } PHONEME_LIST; |
| 210 | |
| 211 | #define pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`! 0 |
| 212 | #define pd_WAVcxx . . $ `external/espeak/synthesize.h:212:9`! 1 |
| 213 | #define pd_VWLSTARTcxx . . $ `external/espeak/synthesize.h:213:9`! 2 |
| 214 | #define pd_VWLENDcxx . . $ `external/espeak/synthesize.h:214:9`! 3 |
| 215 | #define pd_ADDWAVcxx . . $ `external/espeak/synthesize.h:215:9`! 4 |
| 216 | |
| 217 | #define N_PHONEME_DATA_PARAMcxx . . $ `external/espeak/synthesize.h:217:9`! 16 |
| 218 | #define pd_INSERTPHONEMEcxx . . $ `external/espeak/synthesize.h:218:9`! i_INSERT_PHONEME |
| 219 | #define pd_APPENDPHONEMEcxx . . $ `external/espeak/synthesize.h:219:9`! i_APPEND_PHONEME |
| 220 | #define pd_CHANGEPHONEMEcxx . . $ `external/espeak/synthesize.h:220:9`! i_CHANGE_PHONEME |
| 221 | #define pd_CHANGE_NEXTPHONEMEcxx . . $ `external/espeak/synthesize.h:221:9`! i_REPLACE_NEXT_PHONEME |
| 222 | #define pd_LENGTHMODcxx . . $ `external/espeak/synthesize.h:222:9`! i_SET_LENGTH |
| 223 | |
| 224 | #define pd_FORNEXTPHcxx . . $ `external/espeak/synthesize.h:224:9`! 0x2 |
| 225 | #define pd_DONTLENGTHENcxx . . $ `external/espeak/synthesize.h:225:9`! 0x4 |
| 226 | |
| 227 | typedef struct { |
| 228 | int pd_control; |
| 229 | int pd_param[N_PHONEME_DATA_PARAMcxx . . $ `external/espeak/synthesize.h:217:9`!]; // set from group 0 instructions |
| 230 | int sound_addr[5]; |
| 231 | int sound_param[5]; |
| 232 | int vowel_transition[4]; |
| 233 | int pitch_env; |
| 234 | int amp_env; |
| 235 | char ipa_string[18]; |
| 236 | } PHONEME_DATA; |
| 237 | |
| 238 | typedef struct { |
| 239 | int fmt_control; |
| 240 | int use_vowelin; |
| 241 | int fmt_addr; |
| 242 | int fmt_length; |
| 243 | int fmt_amp; |
| 244 | int fmt2_addr; |
| 245 | int fmt2_lenadj; |
| 246 | int wav_addr; |
| 247 | int wav_amp; |
| 248 | int transition0; |
| 249 | int transition1; |
| 250 | int std_length; |
| 251 | } FMT_PARAMS; |
| 252 | |
| 253 | typedef struct { |
| 254 | PHONEME_LIST prev_vowel; |
| 255 | } WORD_PH_DATA; |
| 256 | |
| 257 | // instructions |
| 258 | |
| 259 | #define INSTN_RETURNcxx . . $ `external/espeak/synthesize.h:259:9`! 0x0001 |
| 260 | #define INSTN_CONTINUEcxx . . $ `external/espeak/synthesize.h:260:9`! 0x0002 |
| 261 | |
| 262 | // Group 0 instructions with 8 bit operand. These values go into bits 8-15 of the instruction |
| 263 | #define i_CHANGE_PHONEMEcxx . . $ `external/espeak/synthesize.h:263:9`! 0x01 |
| 264 | #define i_REPLACE_NEXT_PHONEMEcxx . . $ `external/espeak/synthesize.h:264:9`! 0x02 |
| 265 | #define i_INSERT_PHONEMEcxx . . $ `external/espeak/synthesize.h:265:9`! 0x03 |
| 266 | #define i_APPEND_PHONEMEcxx . . $ `external/espeak/synthesize.h:266:9`! 0x04 |
| 267 | #define i_APPEND_IFNEXTVOWELcxx . . $ `external/espeak/synthesize.h:267:9`! 0x05 |
| 268 | #define i_VOICING_SWITCHcxx . . $ `external/espeak/synthesize.h:268:9`! 0x06 |
| 269 | #define i_PAUSE_BEFOREcxx . . $ `external/espeak/synthesize.h:269:9`! 0x07 |
| 270 | #define i_PAUSE_AFTERcxx . . $ `external/espeak/synthesize.h:270:9`! 0x08 |
| 271 | #define i_LENGTH_MODcxx . . $ `external/espeak/synthesize.h:271:9`! 0x09 |
| 272 | #define i_SET_LENGTHcxx . . $ `external/espeak/synthesize.h:272:9`! 0x0a |
| 273 | #define i_LONG_LENGTHcxx . . $ `external/espeak/synthesize.h:273:9`! 0x0b |
| 274 | #define i_ADD_LENGTHcxx . . $ `external/espeak/synthesize.h:274:9`! 0x0c |
| 275 | #define i_IPA_NAMEcxx . . $ `external/espeak/synthesize.h:275:9`! 0x0d |
| 276 | |
| 277 | #define i_CHANGE_IFcxx . . $ `external/espeak/synthesize.h:277:9`! 0x10 // 0x10 to 0x14 |
| 278 | |
| 279 | // conditions and jumps |
| 280 | #define i_CONDITIONcxx . . $ `external/espeak/synthesize.h:280:9`! 0x2000 |
| 281 | #define i_ORcxx . . $ `external/espeak/synthesize.h:281:9`! 0x1000 // added to i_CONDITION |
| 282 | #define i_NOTcxx . . $ `external/espeak/synthesize.h:282:9`! 0x0003 |
| 283 | |
| 284 | #define i_JUMPcxx . . $ `external/espeak/synthesize.h:284:9`! 0x6000 |
| 285 | #define i_JUMP_FALSEcxx . . $ `external/espeak/synthesize.h:285:9`! 0x6800 |
| 286 | #define i_SWITCH_NEXTVOWELcxx . . $ `external/espeak/synthesize.h:286:9`! 0x6a00 |
| 287 | #define i_SWITCH_PREVVOWELcxx . . $ `external/espeak/synthesize.h:287:9`! 0x6c00 |
| 288 | #define MAX_JUMPcxx . . $ `external/espeak/synthesize.h:288:9`! 255 // max jump distance |
| 289 | |
| 290 | // multi-word instructions |
| 291 | #define i_CALLPHcxx . . $ `external/espeak/synthesize.h:291:9`! 0x9100 |
| 292 | #define i_PITCHENVcxx . . $ `external/espeak/synthesize.h:292:9`! 0x9200 |
| 293 | #define i_AMPENVcxx . . $ `external/espeak/synthesize.h:293:9`! 0x9300 |
| 294 | #define i_VOWELINcxx . . $ `external/espeak/synthesize.h:294:9`! 0xa100 |
| 295 | #define i_VOWELOUTcxx . . $ `external/espeak/synthesize.h:295:9`! 0xa200 |
| 296 | #define i_FMTcxx . . $ `external/espeak/synthesize.h:296:9`! 0xb000 |
| 297 | #define i_WAVcxx . . $ `external/espeak/synthesize.h:297:9`! 0xc000 |
| 298 | #define i_VWLSTARTcxx . . $ `external/espeak/synthesize.h:298:9`! 0xd000 |
| 299 | #define i_VWLENDINGcxx . . $ `external/espeak/synthesize.h:299:9`! 0xe000 |
| 300 | #define i_WAVADDcxx . . $ `external/espeak/synthesize.h:300:9`! 0xf000 |
| 301 | |
| 302 | // conditions |
| 303 | #define CONDITION_IS_PHONEME_TYPEcxx . . $ `external/espeak/synthesize.h:303:9`! 0x00 |
| 304 | #define CONDITION_IS_PLACE_OF_ARTICULATIONcxx . . $ `external/espeak/synthesize.h:304:9`! 0x20 |
| 305 | #define CONDITION_IS_PHFLAG_SETcxx . . $ `external/espeak/synthesize.h:305:9`! 0x40 |
| 306 | #define CONDITION_IS_OTHERcxx . . $ `external/espeak/synthesize.h:306:9`! 0x80 |
| 307 | |
| 308 | // other conditions (stress) |
| 309 | #define STRESS_IS_DIMINISHEDcxx . . $ `external/espeak/synthesize.h:309:9`! 0 // diminished, unstressed within a word |
| 310 | #define STRESS_IS_UNSTRESSEDcxx . . $ `external/espeak/synthesize.h:310:9`! 1 // unstressed, weak |
| 311 | #define STRESS_IS_NOT_STRESSEDcxx . . $ `external/espeak/synthesize.h:311:9`! 2 // default, not stressed |
| 312 | #define STRESS_IS_SECONDARYcxx . . $ `external/espeak/synthesize.h:312:9`! 3 // secondary stress |
| 313 | #define STRESS_IS_PRIMARYcxx . . $ `external/espeak/synthesize.h:313:9`! 4 // primary (main) stress |
| 314 | #define STRESS_IS_PRIORITYcxx . . $ `external/espeak/synthesize.h:314:9`! 5 // replaces primary markers |
| 315 | |
| 316 | // other conditions |
| 317 | #define isAfterStresscxx . . $ `external/espeak/synthesize.h:317:9`! 9 |
| 318 | #define isNotVowelcxx . . $ `external/espeak/synthesize.h:318:9`! 10 |
| 319 | #define isFinalVowelcxx . . $ `external/espeak/synthesize.h:319:9`! 11 |
| 320 | #define isVoicedcxx . . $ `external/espeak/synthesize.h:320:9`! 12 // voiced consonant, or vowel |
| 321 | #define isFirstVowelcxx . . $ `external/espeak/synthesize.h:321:9`! 13 |
| 322 | #define isSecondVowelcxx . . $ `external/espeak/synthesize.h:322:9`! 14 |
| 323 | #define isTranslationGivencxx . . $ `external/espeak/synthesize.h:323:9`! 16 // phoneme translation given in **_list or as [[...]] |
| 324 | #define isBreakcxx . . $ `external/espeak/synthesize.h:324:9`! 17 // pause phoneme or (stop/vstop/vfric not followed by vowel or (liquid in same word)) |
| 325 | #define isWordStartcxx . . $ `external/espeak/synthesize.h:325:9`! 18 |
| 326 | #define isWordEndcxx . . $ `external/espeak/synthesize.h:326:9`! 19 |
| 327 | |
| 328 | #define i_StressLevelcxx . . $ `external/espeak/synthesize.h:328:9`! 0x800 |
| 329 | |
| 330 | typedef struct { |
| 331 | int pause_factor; |
| 332 | int clause_pause_factor; |
| 333 | unsigned int min_pause; |
| 334 | int wav_factor; |
| 335 | int lenmod_factor; |
| 336 | int lenmod2_factor; |
| 337 | int min_sample_len; |
| 338 | int fast_settings; // TODO: rename this variable to better explain the purpose, or delete if there is none |
| 339 | } SPEED_FACTORS; |
| 340 | |
| 341 | typedef struct { |
| 342 | char name[12]; |
| 343 | unsigned char flags[4]; |
| 344 | signed char head_extend[8]; |
| 345 | |
| 346 | unsigned char prehead_start; |
| 347 | unsigned char prehead_end; |
| 348 | unsigned char stressed_env; |
| 349 | unsigned char stressed_drop; |
| 350 | unsigned char secondary_drop; |
| 351 | unsigned char unstressed_shape; |
| 352 | |
| 353 | unsigned char onset; |
| 354 | unsigned char head_start; |
| 355 | unsigned char head_end; |
| 356 | unsigned char head_last; |
| 357 | |
| 358 | unsigned char head_max_steps; |
| 359 | unsigned char n_head_extend; |
| 360 | |
| 361 | signed char unstr_start[3]; // for: onset, head, last |
| 362 | signed char unstr_end[3]; |
| 363 | |
| 364 | unsigned char nucleus0_env; // pitch envelope, tonic syllable is at end, no tail |
| 365 | unsigned char nucleus0_max; |
| 366 | unsigned char nucleus0_min; |
| 367 | |
| 368 | unsigned char nucleus1_env; // when followed by a tail |
| 369 | unsigned char nucleus1_max; |
| 370 | unsigned char nucleus1_min; |
| 371 | unsigned char tail_start; |
| 372 | unsigned char tail_end; |
| 373 | |
| 374 | unsigned char split_nucleus_env; |
| 375 | unsigned char split_nucleus_max; |
| 376 | unsigned char split_nucleus_min; |
| 377 | unsigned char split_tail_start; |
| 378 | unsigned char split_tail_end; |
| 379 | unsigned char split_tune; |
| 380 | |
| 381 | unsigned char spare[8]; |
| 382 | int spare2; // the struct length should be a multiple of 4 bytes |
| 383 | } TUNE; |
| 384 | |
| 385 | |
| 386 | |
| 387 | // phoneme table |
| 388 | extern PHONEME_TAB *phoneme_tab[N_PHONEME_TABcxx . . $ `external/espeak/phoneme.h:228:9`!]; |
| 389 | |
| 390 | // list of phonemes in a clause |
| 391 | extern int n_phoneme_list; |
| 392 | extern PHONEME_LIST phoneme_list[N_PHONEME_LISTcxx . . $ `external/espeak/synthesize.h:35:9`!+1]; |
| 393 | extern unsigned int embedded_list[]; |
| 394 | |
| 395 | extern const unsigned char env_fall[128]; |
| 396 | |
| 397 | // queue of commands for wavegen |
| 398 | #define WCMD_KLATTcxx . . $ `external/espeak/synthesize.h:398:9`! 1 |
| 399 | #define WCMD_KLATT2cxx . . $ `external/espeak/synthesize.h:399:9`! 2 |
| 400 | #define WCMD_SPECTcxx . . $ `external/espeak/synthesize.h:400:9`! 3 |
| 401 | #define WCMD_SPECT2cxx . . $ `external/espeak/synthesize.h:401:9`! 4 |
| 402 | #define WCMD_PAUSEcxx . . $ `external/espeak/synthesize.h:402:9`! 5 |
| 403 | #define WCMD_WAVEcxx . . $ `external/espeak/synthesize.h:403:9`! 6 |
| 404 | #define WCMD_WAVE2cxx . . $ `external/espeak/synthesize.h:404:9`! 7 |
| 405 | #define WCMD_AMPLITUDEcxx . . $ `external/espeak/synthesize.h:405:9`! 8 |
| 406 | #define WCMD_PITCHcxx . . $ `external/espeak/synthesize.h:406:9`! 9 |
| 407 | #define WCMD_MARKERcxx . . $ `external/espeak/synthesize.h:407:9`! 10 |
| 408 | #define WCMD_VOICEcxx . . $ `external/espeak/synthesize.h:408:9`! 11 |
| 409 | #define WCMD_EMBEDDEDcxx . . $ `external/espeak/synthesize.h:409:9`! 12 |
| 410 | #define WCMD_MBROLA_DATAcxx . . $ `external/espeak/synthesize.h:410:9`! 13 |
| 411 | #define WCMD_FMT_AMPLITUDEcxx . . $ `external/espeak/synthesize.h:411:9`! 14 |
| 412 | #define WCMD_SONIC_SPEEDcxx . . $ `external/espeak/synthesize.h:412:9`! 15 |
| 413 | #define WCMD_PHONEME_ALIGNMENTcxx . . $ `external/espeak/synthesize.h:413:9`! 16 |
| 414 | |
| 415 | #define N_WCMDQcxx . . $ `external/espeak/synthesize.h:415:9`! 170 // normally 170 |
| 416 | #define MIN_WCMDQcxx . . $ `external/espeak/synthesize.h:416:9`! 25 // need this many free entries before adding new phoneme |
| 417 | |
| 418 | extern intptr_tcxx . . $ intptr_t# wcmdq[N_WCMDQcxx . . $ `external/espeak/synthesize.h:415:9`!][4]; |
| 419 | extern int wcmdq_head; |
| 420 | extern int wcmdq_tail; |
| 421 | |
| 422 | void MarkerEvent(int type, unsigned int char_position, int value, int value2, unsigned char *out_ptr); |
| 423 | |
| 424 | extern unsigned char *wavefile_data; |
| 425 | extern int samplerate; |
| 426 | |
| 427 | #define N_ECHO_BUFcxx . . $ `external/espeak/synthesize.h:427:9`! 5500 // max of 250mS at 22050 Hz |
| 428 | extern int echo_head; |
| 429 | extern int echo_tail; |
| 430 | extern int echo_amp; |
| 431 | extern short echo_buf[N_ECHO_BUFcxx . . $ `external/espeak/synthesize.h:427:9`!]; |
| 432 | |
| 433 | void SynthesizeInit(void); |
| 434 | int Generate(PHONEME_LIST *phoneme_list, int *n_ph, bool resume); |
| 435 | int SpeakNextClause(int control); |
| 436 | void SetSpeed(int control); |
| 437 | void SetEmbedded(int control, int value); |
| 438 | int FormantTransition2(frameref_t *seq, int *n_frames, unsigned int data1, unsigned int data2, PHONEME_TAB *other_ph, int which); |
| 439 | |
| 440 | void Write4Bytes(FILE *f, int value); |
| 441 | |
| 442 | #if USE_LIBSONIC |
| 443 | void DoSonicSpeed(int value); |
| 444 | #endif |
| 445 | |
| 446 | #define ENV_LENcxx . . $ `external/espeak/synthesize.h:446:9`! 128 // length of pitch envelopes |
| 447 | #define PITCHfallcxx . . $ `external/espeak/synthesize.h:447:9`! 0 // standard pitch envelopes |
| 448 | #define PITCHrisecxx . . $ `external/espeak/synthesize.h:448:9`! 2 |
| 449 | #define N_ENVELOPE_DATAcxx . . $ `external/espeak/synthesize.h:449:9`! 20 |
| 450 | extern const unsigned char *const envelope_data[N_ENVELOPE_DATAcxx . . $ `external/espeak/synthesize.h:449:9`!]; |
| 451 | |
| 452 | extern int formant_rate[]; // max rate of change of each formant |
| 453 | extern SPEED_FACTORS speed; |
| 454 | |
| 455 | extern unsigned char *out_ptr; |
| 456 | extern unsigned char *out_end; |
| 457 | extern espeak_EVENTcxx . . $ espeak_EVENT# *event_list; |
| 458 | extern const int version_phdata; |
| 459 | |
| 460 | void DoEmbedded(int *embix, int sourceix); |
| 461 | void DoMarker(int type, int char_posn, int length, int value); |
| 462 | void DoPhonemeMarker(int type, int char_posn, int length, char *name); |
| 463 | int DoSample3(PHONEME_DATA *phdata, int length_mod, int amp); |
| 464 | int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_LIST *plist, int modulation); |
| 465 | int PauseLength(int pause, int control); |
| 466 | const char *WordToString(char buf[5], unsigned int word); |
| 467 | |
| 468 | #ifdef __cpluspluscxx . . $ `<built-in>:470:9`! |
| 469 | } |
| 470 | #endif |
| 471 | |
| 472 | #endif |