| 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 | #include "espeak__config.h"cxx . . $ `<file>/external/espeak/espeak__config.h`/ |
| 21 | |
| 22 | #include <ctype.h> |
| 23 | #include <errno.h> |
| 24 | #include <math.h> |
| 25 | #include <stdbool.h> |
| 26 | #include <stdint.h> |
| 27 | #include <stdio.h> |
| 28 | #include <stdlib.h> |
| 29 | #include <string.h> |
| 30 | |
| 31 | #include "espeak_ng.h"cxx . . $ `<file>/external/espeak/espeak_ng.h`/ |
| 32 | #include "speak_lib.h"cxx . . $ `<file>/external/espeak/speak_lib.h`/ |
| 33 | #include "encoding.h"cxx . . $ `<file>/external/espeak/encoding.h`/ |
| 34 | |
| 35 | #include "synthesize.h"cxx . . $ `<file>/external/espeak/synthesize.h`/ |
| 36 | #include "dictionary.h"cxx . . $ `<file>/external/espeak/dictionary.h`/ // for WritePhMnemonic, GetTranslatedPhone... |
| 37 | #include "intonation.h"cxx . . $ `<file>/external/espeak/intonation.h`/ // for CalcPitches |
| 38 | #include "mbrola.h"cxx . . $ `<file>/external/espeak/mbrola.h`/ // for MbrolaGenerate, mbrola_name |
| 39 | #include "phoneme.h"cxx . . $ `<file>/external/espeak/phoneme.h`/ // for PHONEME_TAB, phVOWEL, phLIQUID, phN... |
| 40 | #include "setlengths.h"cxx . . $ `<file>/external/espeak/setlengths.h`/ // for CalcLengths |
| 41 | #include "soundicon.h"cxx . . $ `<file>/external/espeak/soundicon.h`/ // for soundicon_tab, n_soundicon |
| 42 | #include "synthdata.h"cxx . . $ `<file>/external/espeak/synthdata.h`/ // for InterpretPhoneme, GetEnvelope, Inte... |
| 43 | #include "translate.h"cxx . . $ `<file>/external/espeak/translate.h`/ // for translator, LANGUAGE_OPTIONS, Trans... |
| 44 | #include "voice.h"cxx . . $ `<file>/external/espeak/voice.h`/ // for voice_t, voice, LoadVoiceVariant |
| 45 | #include "wavegen.h"cxx . . $ `<file>/external/espeak/wavegen.h`/ // for WcmdqInc, WcmdqFree, WcmdqStop |
| 46 | #include "speech.h"cxx . . $ `<file>/external/espeak/speech.h`/ // for MAKE_MEM_UNDEFINED |
| 47 | |
| 48 | static void SmoothSpectcxx . . $ SmoothSpect(49f6e7a06ebc5aa8).(void); |
| 49 | |
| 50 | // list of phonemes in a clause |
| 51 | int n_phoneme_listcxx . . $ n_phoneme_list. = 0; |
| 52 | PHONEME_LIST phoneme_listcxx . . $ phoneme_list.[N_PHONEME_LISTcxx . . $ `external/espeak/synthesize.h:35:9`!+1]; |
| 53 | |
| 54 | SPEED_FACTORS speedcxx . . $ speed.; |
| 55 | |
| 56 | static int last_pitch_cmdcxx . . $ last_pitch_cmd.; |
| 57 | static int last_amp_cmdcxx . . $ last_amp_cmd.; |
| 58 | static frame_t *last_framecxx . . $ last_frame.; |
| 59 | static int last_wcmdqcxx . . $ last_wcmdq.; |
| 60 | static int pitch_lengthcxx . . $ pitch_length.; |
| 61 | static int amp_lengthcxx . . $ amp_length.; |
| 62 | static int modn_flagscxx . . $ modn_flags.; |
| 63 | static int fmt_amplitudecxx . . $ fmt_amplitude. = 0; |
| 64 | |
| 65 | static int syllable_startcxx . . $ syllable_start.; |
| 66 | static int syllable_endcxx . . $ syllable_end.; |
| 67 | static int syllable_centrecxx . . $ syllable_centre.; |
| 68 | |
| 69 | static voice_t *new_voicecxx . . $ new_voice. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 70 | |
| 71 | static int (*phoneme_callbackcxx . . $ phoneme_callback.)(const char *) = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 72 | |
| 73 | #define RMS_GLOTTAL1cxx . . $ `external/espeak/synthesize.cpp:73:9`! 35 // vowel before glottal stop |
| 74 | #define RMS_STARTcxx . . $ `external/espeak/synthesize.cpp:74:9`! 28 // 28 |
| 75 | #define VOWEL_FRONT_LENGTHcxx . . $ `external/espeak/synthesize.cpp:75:9`! 50 |
| 76 | |
| 77 | const char *WordToStringcxx . . $ WordToString(d172961b102a89a5).(char buf[5], unsigned int word) |
| 78 | { |
| 79 | // Convert a phoneme mnemonic word into a string |
| 80 | int ix; |
| 81 | |
| 82 | for (ix = 0; ix < 4; ix++) |
| 83 | buf[ix] = word >> (ix*8); |
| 84 | buf[4] = 0; |
| 85 | return buf; |
| 86 | } |
| 87 | |
| 88 | void SynthesizeInitcxx . . $ SynthesizeInit(49f6e7a06ebc5aa8).(void) |
| 89 | { |
| 90 | last_pitch_cmdcxx . . $ last_pitch_cmd. = 0; |
| 91 | last_amp_cmdcxx . . $ last_amp_cmd. = 0; |
| 92 | last_framecxx . . $ last_frame. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 93 | syllable_centrecxx . . $ syllable_centre. = -1; |
| 94 | } |
| 95 | |
| 96 | static void EndAmplitudecxx . . $ EndAmplitude(49f6e7a06ebc5aa8).(void) |
| 97 | { |
| 98 | if (amp_lengthcxx . . $ amp_length. > 0) { |
| 99 | if (wcmdq[last_amp_cmdcxx . . $ last_amp_cmd.][1] == 0) |
| 100 | wcmdq[last_amp_cmdcxx . . $ last_amp_cmd.][1] = amp_lengthcxx . . $ amp_length.; |
| 101 | amp_lengthcxx . . $ amp_length. = 0; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | static void EndPitchcxx . . $ EndPitch(d4f767463ce0a6b3).(int voice_break) |
| 106 | { |
| 107 | // possible end of pitch envelope, fill in the length |
| 108 | if ((pitch_lengthcxx . . $ pitch_length. > 0) && (last_pitch_cmdcxx . . $ last_pitch_cmd. >= 0)) { |
| 109 | if (wcmdq[last_pitch_cmdcxx . . $ last_pitch_cmd.][1] == 0) |
| 110 | wcmdq[last_pitch_cmdcxx . . $ last_pitch_cmd.][1] = pitch_lengthcxx . . $ pitch_length.; |
| 111 | pitch_lengthcxx . . $ pitch_length. = 0; |
| 112 | } |
| 113 | |
| 114 | if (voice_break) { |
| 115 | last_wcmdqcxx . . $ last_wcmdq. = -1; |
| 116 | last_framecxx . . $ last_frame. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 117 | syllable_endcxx . . $ syllable_end. = wcmdq_tail; |
| 118 | SmoothSpectcxx . . $ SmoothSpect(49f6e7a06ebc5aa8).(); |
| 119 | syllable_centrecxx . . $ syllable_centre. = -1; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | static void DoAmplitudecxx . . $ DoAmplitude(b7d66bc82a610c46).(int amp, const unsigned char *amp_env) |
| 124 | { |
| 125 | intptr_tcxx . . $ intptr_t# *q; |
| 126 | |
| 127 | last_amp_cmdcxx . . $ last_amp_cmd. = wcmdq_tail; |
| 128 | amp_lengthcxx . . $ amp_length. = 0; // total length of vowel with this amplitude envelope |
| 129 | |
| 130 | q = wcmdq[wcmdq_tail]; |
| 131 | q[0] = WCMD_AMPLITUDEcxx . . $ `external/espeak/synthesize.h:405:9`!; |
| 132 | q[1] = 0; // fill in later from amp_length |
| 133 | q[2] = (intptr_tcxx . . $ intptr_t#)amp_env; |
| 134 | q[3] = amp; |
| 135 | WcmdqInc(); |
| 136 | } |
| 137 | |
| 138 | static void DoPhonemeAlignmentcxx . . $ DoPhonemeAlignment(a07d8cccb7673f5a).(char* pho, int type) |
| 139 | { |
| 140 | wcmdq[wcmdq_tail][0] = WCMD_PHONEME_ALIGNMENTcxx . . $ `external/espeak/synthesize.h:413:9`!; |
| 141 | wcmdq[wcmdq_tail][1] = (intptr_tcxx . . $ intptr_t#)pho; |
| 142 | wcmdq[wcmdq_tail][2] = type; |
| 143 | WcmdqInc(); |
| 144 | } |
| 145 | |
| 146 | static void DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(const unsigned char *env, int pitch1, int pitch2) |
| 147 | { |
| 148 | intptr_tcxx . . $ intptr_t# *q; |
| 149 | |
| 150 | EndPitchcxx . . $ EndPitch(d4f767463ce0a6b3).(0); |
| 151 | |
| 152 | if (pitch1 == 255) { |
| 153 | // pitch was not set |
| 154 | pitch1 = 55; |
| 155 | pitch2 = 76; |
| 156 | env = envelope_data[PITCHfallcxx . . $ `external/espeak/synthesize.h:447:9`!]; |
| 157 | } |
| 158 | last_pitch_cmdcxx . . $ last_pitch_cmd. = wcmdq_tail; |
| 159 | pitch_lengthcxx . . $ pitch_length. = 0; // total length of spect with this pitch envelope |
| 160 | |
| 161 | if (pitch2 < 0) |
| 162 | pitch2 = 0; |
| 163 | |
| 164 | q = wcmdq[wcmdq_tail]; |
| 165 | q[0] = WCMD_PITCHcxx . . $ `external/espeak/synthesize.h:406:9`!; |
| 166 | q[1] = 0; // length, fill in later from pitch_length |
| 167 | q[2] = (intptr_tcxx . . $ intptr_t#)env; |
| 168 | q[3] = (pitch1 << 16) + pitch2; |
| 169 | WcmdqInc(); |
| 170 | } |
| 171 | |
| 172 | int PauseLengthcxx . . $ PauseLength(9b79fb6aee4c0440).(int pause, int control) |
| 173 | { |
| 174 | unsigned int len; |
| 175 | |
| 176 | if (control == 0) { |
| 177 | if (pause >= 200) |
| 178 | len = (pause * speedcxx . . $ speed..clause_pause_factor)/256; |
| 179 | else |
| 180 | len = (pause * speedcxx . . $ speed..pause_factor)/256; |
| 181 | } else |
| 182 | len = (pause * speedcxx . . $ speed..wav_factor)/256; |
| 183 | |
| 184 | if (len < speedcxx . . $ speed..min_pause) |
| 185 | len = speedcxx . . $ speed..min_pause; // mS, limit the amount to which pauses can be shortened |
| 186 | return len; |
| 187 | } |
| 188 | |
| 189 | static void DoPausecxx . . $ DoPause(3e454b8ccf442868).(int length, int control) |
| 190 | { |
| 191 | // length in nominal mS |
| 192 | // control = 1, less shortening at fast speeds |
| 193 | |
| 194 | unsigned int len; |
| 195 | |
| 196 | if (length == 0) |
| 197 | len = 0; |
| 198 | else { |
| 199 | len = PauseLengthcxx . . $ PauseLength(9b79fb6aee4c0440).(length, control); |
| 200 | |
| 201 | if (len < 90000) |
| 202 | len = (len * samplerate) / 1000; // convert from mS to number of samples |
| 203 | else { |
| 204 | int srate2 = samplerate / 25; // avoid overflow |
| 205 | len = (len * srate2) / 40; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | EndPitchcxx . . $ EndPitch(d4f767463ce0a6b3).(1); |
| 210 | wcmdq[wcmdq_tail][0] = WCMD_PAUSEcxx . . $ `external/espeak/synthesize.h:402:9`!; |
| 211 | wcmdq[wcmdq_tail][1] = len; |
| 212 | WcmdqInc(); |
| 213 | last_framecxx . . $ last_frame. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 214 | |
| 215 | if (fmt_amplitudecxx . . $ fmt_amplitude. != 0) { |
| 216 | wcmdq[wcmdq_tail][0] = WCMD_FMT_AMPLITUDEcxx . . $ `external/espeak/synthesize.h:411:9`!; |
| 217 | wcmdq[wcmdq_tail][1] = fmt_amplitudecxx . . $ fmt_amplitude. = 0; |
| 218 | WcmdqInc(); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | extern int seq_len_adjustcxx . . $ seq_len_adjust.; // temporary fix to advance the start point for playing the wav sample |
| 223 | |
| 224 | static int DoSample2cxx . . $ DoSample2(4ccc28f389ac356e).(int index, int which, int std_length, int control, int length_mod, int amp) |
| 225 | { |
| 226 | int length; |
| 227 | int wav_length; |
| 228 | int wav_scale; |
| 229 | int min_length; |
| 230 | int x; |
| 231 | int len4; |
| 232 | intptr_tcxx . . $ intptr_t# *q; |
| 233 | unsigned char *p; |
| 234 | |
| 235 | index = index & 0x7fffff; |
| 236 | p = &wavefile_data[index]; |
| 237 | wav_scale = p[2]; |
| 238 | wav_length = (p[1] * 256); |
| 239 | wav_length += p[0]; // length in bytes |
| 240 | |
| 241 | if (wav_length == 0) |
| 242 | return 0; |
| 243 | |
| 244 | min_length = speedcxx . . $ speed..min_sample_len; |
| 245 | |
| 246 | if (wav_scale == 0) |
| 247 | min_length *= 2; // 16 bit samples |
| 248 | |
| 249 | if (std_length > 0) { |
| 250 | std_length = (std_length * samplerate)/1000; |
| 251 | if (wav_scale == 0) |
| 252 | std_length *= 2; |
| 253 | |
| 254 | x = (min_length * std_length)/wav_length; |
| 255 | if (x > min_length) |
| 256 | min_length = x; |
| 257 | } else { |
| 258 | // no length specified, use the length of the stored sound |
| 259 | std_length = wav_length; |
| 260 | } |
| 261 | |
| 262 | if (length_mod > 0) |
| 263 | std_length = (std_length * length_mod)/256; |
| 264 | |
| 265 | length = (std_length * speedcxx . . $ speed..wav_factor)/256; |
| 266 | |
| 267 | if (control & pd_DONTLENGTHENcxx . . $ `external/espeak/synthesize.h:225:9`!) { |
| 268 | // this option is used for Stops, with short noise bursts. |
| 269 | // Don't change their length much. |
| 270 | if (length > std_length) { |
| 271 | // don't let length exceed std_length |
| 272 | length = std_length; |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | if (length < min_length) |
| 277 | length = min_length; |
| 278 | |
| 279 | |
| 280 | if (wav_scale == 0) { |
| 281 | // 16 bit samples |
| 282 | length /= 2; |
| 283 | wav_length /= 2; |
| 284 | } |
| 285 | |
| 286 | if (amp < 0) |
| 287 | return length; |
| 288 | |
| 289 | len4 = wav_length / 4; |
| 290 | |
| 291 | index += 4; |
| 292 | |
| 293 | if (which & 0x100) { |
| 294 | // mix this with synthesised wave |
| 295 | last_wcmdqcxx . . $ last_wcmdq. = wcmdq_tail; |
| 296 | q = wcmdq[wcmdq_tail]; |
| 297 | q[0] = WCMD_WAVE2cxx . . $ `external/espeak/synthesize.h:404:9`!; |
| 298 | q[1] = length | (wav_length << 16); // length in samples |
| 299 | q[2] = (intptr_tcxx . . $ intptr_t#)(&wavefile_data[index]); |
| 300 | q[3] = wav_scale + (amp << 8); |
| 301 | WcmdqInc(); |
| 302 | return length; |
| 303 | } |
| 304 | |
| 305 | if (length > wav_length) { |
| 306 | x = len4*3; |
| 307 | length -= x; |
| 308 | } else { |
| 309 | x = length; |
| 310 | length = 0; |
| 311 | } |
| 312 | |
| 313 | last_wcmdqcxx . . $ last_wcmdq. = wcmdq_tail; |
| 314 | q = wcmdq[wcmdq_tail]; |
| 315 | q[0] = WCMD_WAVEcxx . . $ `external/espeak/synthesize.h:403:9`!; |
| 316 | q[1] = x; // length in samples |
| 317 | q[2] = (intptr_tcxx . . $ intptr_t#)(&wavefile_data[index]); |
| 318 | q[3] = wav_scale + (amp << 8); |
| 319 | WcmdqInc(); |
| 320 | |
| 321 | while (length > len4*3) { |
| 322 | x = len4; |
| 323 | if (wav_scale == 0) |
| 324 | x *= 2; |
| 325 | |
| 326 | last_wcmdqcxx . . $ last_wcmdq. = wcmdq_tail; |
| 327 | q = wcmdq[wcmdq_tail]; |
| 328 | q[0] = WCMD_WAVEcxx . . $ `external/espeak/synthesize.h:403:9`!; |
| 329 | q[1] = len4*2; // length in samples |
| 330 | q[2] = (intptr_tcxx . . $ intptr_t#)(&wavefile_data[index+x]); |
| 331 | q[3] = wav_scale + (amp << 8); |
| 332 | WcmdqInc(); |
| 333 | |
| 334 | length -= len4*2; |
| 335 | } |
| 336 | |
| 337 | if (length > 0) { |
| 338 | x = wav_length - length; |
| 339 | if (wav_scale == 0) |
| 340 | x *= 2; |
| 341 | last_wcmdqcxx . . $ last_wcmdq. = wcmdq_tail; |
| 342 | q = wcmdq[wcmdq_tail]; |
| 343 | q[0] = WCMD_WAVEcxx . . $ `external/espeak/synthesize.h:403:9`!; |
| 344 | q[1] = length; // length in samples |
| 345 | q[2] = (intptr_tcxx . . $ intptr_t#)(&wavefile_data[index+x]); |
| 346 | q[3] = wav_scale + (amp << 8); |
| 347 | WcmdqInc(); |
| 348 | } |
| 349 | |
| 350 | return length; |
| 351 | } |
| 352 | |
| 353 | int DoSample3cxx . . $ DoSample3(f192ba95c962b3da).(PHONEME_DATA *phdata, int length_mod, int amp) |
| 354 | { |
| 355 | int amp2; |
| 356 | int len; |
| 357 | EndPitchcxx . . $ EndPitch(d4f767463ce0a6b3).(1); |
| 358 | |
| 359 | if (amp == -1) { |
| 360 | // just get the length, don't produce sound |
| 361 | amp2 = amp; |
| 362 | } else { |
| 363 | amp2 = phdata->sound_param[pd_WAVcxx . . $ `external/espeak/synthesize.h:212:9`!]; |
| 364 | if (amp2 == 0) |
| 365 | amp2 = 100; |
| 366 | amp2 = (amp2 * 32)/100; |
| 367 | } |
| 368 | |
| 369 | seq_len_adjustcxx . . $ seq_len_adjust. = 0; |
| 370 | |
| 371 | if (phdata->sound_addr[pd_WAVcxx . . $ `external/espeak/synthesize.h:212:9`!] == 0) |
| 372 | len = 0; |
| 373 | else |
| 374 | len = DoSample2cxx . . $ DoSample2(4ccc28f389ac356e).(phdata->sound_addr[pd_WAVcxx . . $ `external/espeak/synthesize.h:212:9`!], 2, phdata->pd_param[pd_LENGTHMODcxx . . $ `external/espeak/synthesize.h:222:9`!]*2, phdata->pd_control, length_mod, amp2); |
| 375 | last_framecxx . . $ last_frame. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 376 | return len; |
| 377 | } |
| 378 | |
| 379 | static frame_t *AllocFramecxx . . $ AllocFrame(45661555277abc0e).(void) |
| 380 | { |
| 381 | // Allocate a temporary spectrum frame for the wavegen queue. Use a pool which is big |
| 382 | // enough to use a round-robin without checks. |
| 383 | // Only needed for modifying spectra for blending to consonants |
| 384 | |
| 385 | #define N_FRAME_POOLcxx . . $ `external/espeak/synthesize.cpp:385:10`! N_WCMDQcxx . . $ `external/espeak/synthesize.h:415:9`! |
| 386 | static int ix = 0; |
| 387 | static frame_t frame_pool[N_FRAME_POOLcxx . . $ `external/espeak/synthesize.cpp:385:10`!]; |
| 388 | |
| 389 | ix++; |
| 390 | if (ix >= N_FRAME_POOLcxx . . $ `external/espeak/synthesize.cpp:385:10`!) |
| 391 | ix = 0; |
| 392 | |
| 393 | MAKE_MEM_UNDEFINEDcxx . . $ `external/espeak/speech.h:39:13`!(&frame_pool[ix], sizeof(frame_pool[ix])); |
| 394 | return &frame_pool[ix]; |
| 395 | } |
| 396 | |
| 397 | static void set_frame_rmscxx . . $ set_frame_rms(e8bba93476472e99).(frame_t *fr, int new_rms) |
| 398 | { |
| 399 | // Each frame includes its RMS amplitude value, so to set a new |
| 400 | // RMS just adjust the formant amplitudes by the appropriate ratio |
| 401 | |
| 402 | int x; |
| 403 | int ix; |
| 404 | |
| 405 | static const short sqrt_tab[200] = { |
| 406 | 0, 64, 90, 110, 128, 143, 156, 169, 181, 192, 202, 212, 221, 230, 239, 247, |
| 407 | 256, 263, 271, 278, 286, 293, 300, 306, 313, 320, 326, 332, 338, 344, 350, 356, |
| 408 | 362, 367, 373, 378, 384, 389, 394, 399, 404, 409, 414, 419, 424, 429, 434, 438, |
| 409 | 443, 448, 452, 457, 461, 465, 470, 474, 478, 483, 487, 491, 495, 499, 503, 507, |
| 410 | 512, 515, 519, 523, 527, 531, 535, 539, 543, 546, 550, 554, 557, 561, 565, 568, |
| 411 | 572, 576, 579, 583, 586, 590, 593, 596, 600, 603, 607, 610, 613, 617, 620, 623, |
| 412 | 627, 630, 633, 636, 640, 643, 646, 649, 652, 655, 658, 662, 665, 668, 671, 674, |
| 413 | 677, 680, 683, 686, 689, 692, 695, 698, 701, 704, 706, 709, 712, 715, 718, 721, |
| 414 | 724, 726, 729, 732, 735, 738, 740, 743, 746, 749, 751, 754, 757, 759, 762, 765, |
| 415 | 768, 770, 773, 775, 778, 781, 783, 786, 789, 791, 794, 796, 799, 801, 804, 807, |
| 416 | 809, 812, 814, 817, 819, 822, 824, 827, 829, 832, 834, 836, 839, 841, 844, 846, |
| 417 | 849, 851, 853, 856, 858, 861, 863, 865, 868, 870, 872, 875, 877, 879, 882, 884, |
| 418 | 886, 889, 891, 893, 896, 898, 900, 902 |
| 419 | }; |
| 420 | |
| 421 | if (voice->klattv[0]) { |
| 422 | if (new_rms == -1) |
| 423 | fr->klattp[KLATT_AVcxx . . $ `external/espeak/synthesize.h:84:9`!] = 50; |
| 424 | return; |
| 425 | } |
| 426 | |
| 427 | if (fr->rms == 0) return; // check for divide by zero |
| 428 | x = (new_rms * 64)/fr->rms; |
| 429 | if (x >= 200) x = 199; |
| 430 | |
| 431 | x = sqrt_tab[x]; // sqrt(new_rms/fr->rms)*0x200; |
| 432 | |
| 433 | for (ix = 0; ix < 8; ix++) { |
| 434 | int h; |
| 435 | h = fr->fheight[ix] * x; |
| 436 | fr->fheight[ix] = h/0x200; |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | static void formants_reduce_hfcxx . . $ formants_reduce_hf(e8bba93476472e99).(frame_t *fr, int level) |
| 441 | { |
| 442 | // change height of peaks 2 to 8, percentage |
| 443 | if (voice->klattv[0]) |
| 444 | return; |
| 445 | |
| 446 | for (int ix = 2; ix < 8; ix++) { |
| 447 | int x; |
| 448 | x = fr->fheight[ix] * level; |
| 449 | fr->fheight[ix] = x/100; |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | static frame_t *CopyFramecxx . . $ CopyFrame(598b57aa678ed870).(frame_t *frame1, int copy) |
| 454 | { |
| 455 | // create a copy of the specified frame in temporary buffer |
| 456 | |
| 457 | frame_t *frame2; |
| 458 | |
| 459 | if ((copy == 0) && (frame1->frflags & FRFLAG_COPIEDcxx . . $ `external/espeak/synthesize.h:50:9`!)) { |
| 460 | // this frame has already been copied in temporary rw memory |
| 461 | return frame1; |
| 462 | } |
| 463 | |
| 464 | frame2 = AllocFramecxx . . $ AllocFrame(45661555277abc0e).(); |
| 465 | if (frame2 != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 466 | memcpy(frame2, frame1, sizeof(frame_t)); |
| 467 | frame2->length = 0; |
| 468 | frame2->frflags |= FRFLAG_COPIEDcxx . . $ `external/espeak/synthesize.h:50:9`!; |
| 469 | } |
| 470 | return frame2; |
| 471 | } |
| 472 | |
| 473 | static frame_t *DuplicateLastFramecxx . . $ DuplicateLastFrame(d91015187d1cca01).(frameref_t *seq, int n_frames, int length) |
| 474 | { |
| 475 | frame_t *fr; |
| 476 | |
| 477 | seq[n_frames-1].length = length; |
| 478 | fr = CopyFramecxx . . $ CopyFrame(598b57aa678ed870).(seq[n_frames-1].frame, 1); |
| 479 | seq[n_frames].frame = fr; |
| 480 | seq[n_frames].length = 0; |
| 481 | return fr; |
| 482 | } |
| 483 | |
| 484 | static void AdjustFormantscxx . . $ AdjustFormants(27e198cf523d464b).(frame_t *fr, int target, int min, int max, int f1_adj, int f3_adj, int hf_reduce, int flags) |
| 485 | { |
| 486 | int x; |
| 487 | |
| 488 | target = (target * voice->formant_factor)/256; |
| 489 | |
| 490 | x = (target - fr->ffreq[2]) / 2; |
| 491 | if (x > max) x = max; |
| 492 | if (x < min) x = min; |
| 493 | fr->ffreq[2] += x; |
| 494 | fr->ffreq[3] += f3_adj; |
| 495 | |
| 496 | if (flags & 0x20) |
| 497 | f3_adj = -f3_adj; // reverse direction for f4,f5 change |
| 498 | fr->ffreq[4] += f3_adj; |
| 499 | fr->ffreq[5] += f3_adj; |
| 500 | |
| 501 | if (f1_adj == 1) { |
| 502 | x = (235 - fr->ffreq[1]); |
| 503 | if (x < -100) x = -100; |
| 504 | if (x > -60) x = -60; |
| 505 | fr->ffreq[1] += x; |
| 506 | } |
| 507 | if (f1_adj == 2) { |
| 508 | x = (235 - fr->ffreq[1]); |
| 509 | if (x < -300) x = -300; |
| 510 | if (x > -150) x = -150; |
| 511 | fr->ffreq[1] += x; |
| 512 | fr->ffreq[0] += x; |
| 513 | } |
| 514 | if (f1_adj == 3) { |
| 515 | x = (100 - fr->ffreq[1]); |
| 516 | if (x < -400) x = -400; |
| 517 | if (x > -300) x = -400; |
| 518 | fr->ffreq[1] += x; |
| 519 | fr->ffreq[0] += x; |
| 520 | } |
| 521 | formants_reduce_hfcxx . . $ formants_reduce_hf(e8bba93476472e99).(fr, hf_reduce); |
| 522 | } |
| 523 | |
| 524 | static int VowelClosenesscxx . . $ VowelCloseness(26fb9f656a76ae70).(frame_t *fr) |
| 525 | { |
| 526 | // return a value 0-3 depending on the vowel's f1 |
| 527 | int f1; |
| 528 | |
| 529 | if ((f1 = fr->ffreq[1]) < 300) |
| 530 | return 3; |
| 531 | if (f1 < 400) |
| 532 | return 2; |
| 533 | if (f1 < 500) |
| 534 | return 1; |
| 535 | return 0; |
| 536 | } |
| 537 | |
| 538 | int FormantTransition2cxx . . $ FormantTransition2(2d744d92c23eeb6b).(frameref_t *seq, int *n_frames, unsigned int data1, unsigned int data2, PHONEME_TAB *other_ph, int which) |
| 539 | { |
| 540 | int len; |
| 541 | int rms; |
| 542 | int f1; |
| 543 | int f2; |
| 544 | int f2_min; |
| 545 | int f2_max; |
| 546 | int f3_adj; |
| 547 | int f3_amp; |
| 548 | int flags; |
| 549 | int vcolour; |
| 550 | |
| 551 | #define N_VCOLOURcxx . . $ `external/espeak/synthesize.cpp:551:10`! 2 |
| 552 | // percentage change for each formant in 256ths |
| 553 | static const short vcolouring[N_VCOLOURcxx . . $ `external/espeak/synthesize.cpp:551:10`!][5] = { |
| 554 | { 243, 272, 256, 256, 256 }, // palatal consonant follows |
| 555 | { 256, 256, 240, 240, 240 }, // retroflex |
| 556 | }; |
| 557 | |
| 558 | frame_t *fr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 559 | |
| 560 | if (*n_frames < 2) |
| 561 | return 0; |
| 562 | |
| 563 | len = (data1 & 0x3f) * 2; |
| 564 | rms = (data1 >> 6) & 0x3f; |
| 565 | flags = (data1 >> 12); |
| 566 | |
| 567 | f2 = (data2 & 0x3f) * 50; |
| 568 | f2_min = (((data2 >> 6) & 0x1f) - 15) * 50; |
| 569 | f2_max = (((data2 >> 11) & 0x1f) - 15) * 50; |
| 570 | f3_adj = (((data2 >> 16) & 0x1f) - 15) * 50; |
| 571 | f3_amp = ((data2 >> 21) & 0x1f) * 8; |
| 572 | f1 = ((data2 >> 26) & 0x7); |
| 573 | vcolour = (data2 >> 29); |
| 574 | |
| 575 | if ((other_ph != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) && (other_ph->mnemonic == '?')) |
| 576 | flags |= 8; |
| 577 | |
| 578 | if (which == 1) { |
| 579 | // entry to vowel |
| 580 | fr = CopyFramecxx . . $ CopyFrame(598b57aa678ed870).(seq[0].frame, 0); |
| 581 | seq[0].frame = fr; |
| 582 | seq[0].length = VOWEL_FRONT_LENGTHcxx . . $ `external/espeak/synthesize.cpp:75:9`!; |
| 583 | if (len > 0) |
| 584 | seq[0].length = len; |
| 585 | seq[0].frflags |= FRFLAG_LEN_MOD2cxx . . $ `external/espeak/synthesize.h:49:9`!; // reduce length modification |
| 586 | fr->frflags |= FRFLAG_LEN_MOD2cxx . . $ `external/espeak/synthesize.h:49:9`!; |
| 587 | |
| 588 | int next_rms = seq[1].frame->rms; |
| 589 | |
| 590 | if (voice->klattv[0]) |
| 591 | fr->klattp[KLATT_AVcxx . . $ `external/espeak/synthesize.h:84:9`!] = seq[1].frame->klattp[KLATT_AVcxx . . $ `external/espeak/synthesize.h:84:9`!] - 4; |
| 592 | if (f2 != 0) { |
| 593 | if (rms & 0x20) |
| 594 | set_frame_rmscxx . . $ set_frame_rms(e8bba93476472e99).(fr, (next_rms * (rms & 0x1f))/30); |
| 595 | AdjustFormantscxx . . $ AdjustFormants(27e198cf523d464b).(fr, f2, f2_min, f2_max, f1, f3_adj, f3_amp, flags); |
| 596 | |
| 597 | if ((rms & 0x20) == 0) |
| 598 | set_frame_rmscxx . . $ set_frame_rms(e8bba93476472e99).(fr, rms*2); |
| 599 | } else { |
| 600 | if (flags & 8) |
| 601 | set_frame_rmscxx . . $ set_frame_rms(e8bba93476472e99).(fr, (next_rms*24)/32); |
| 602 | else |
| 603 | set_frame_rmscxx . . $ set_frame_rms(e8bba93476472e99).(fr, RMS_STARTcxx . . $ `external/espeak/synthesize.cpp:74:9`!); |
| 604 | } |
| 605 | |
| 606 | if (flags & 8) |
| 607 | modn_flagscxx . . $ modn_flags. = 0x800 + (VowelClosenesscxx . . $ VowelCloseness(26fb9f656a76ae70).(fr) << 8); |
| 608 | } else { |
| 609 | // exit from vowel |
| 610 | rms = rms*2; |
| 611 | if ((f2 != 0) || (flags != 0)) { |
| 612 | |
| 613 | if (flags & 8) { |
| 614 | fr = CopyFramecxx . . $ CopyFrame(598b57aa678ed870).(seq[*n_frames-1].frame, 0); |
| 615 | seq[*n_frames-1].frame = fr; |
| 616 | rms = RMS_GLOTTAL1cxx . . $ `external/espeak/synthesize.cpp:73:9`!; |
| 617 | |
| 618 | // degree of glottal-stop effect depends on closeness of vowel (indicated by f1 freq) |
| 619 | modn_flagscxx . . $ modn_flags. = 0x400 + (VowelClosenesscxx . . $ VowelCloseness(26fb9f656a76ae70).(fr) << 8); |
| 620 | } else { |
| 621 | fr = DuplicateLastFramecxx . . $ DuplicateLastFrame(d91015187d1cca01).(seq, (*n_frames)++, len); |
| 622 | if (len > 36) |
| 623 | seq_len_adjustcxx . . $ seq_len_adjust. += (len - 36); |
| 624 | |
| 625 | if (f2 != 0) |
| 626 | AdjustFormantscxx . . $ AdjustFormants(27e198cf523d464b).(fr, f2, f2_min, f2_max, f1, f3_adj, f3_amp, flags); |
| 627 | } |
| 628 | |
| 629 | set_frame_rmscxx . . $ set_frame_rms(e8bba93476472e99).(fr, rms); |
| 630 | |
| 631 | if ((vcolour > 0) && (vcolour <= N_VCOLOURcxx . . $ `external/espeak/synthesize.cpp:551:10`!)) { |
| 632 | for (int ix = 0; ix < *n_frames; ix++) { |
| 633 | fr = CopyFramecxx . . $ CopyFrame(598b57aa678ed870).(seq[ix].frame, 0); |
| 634 | seq[ix].frame = fr; |
| 635 | |
| 636 | for (int formant = 1; formant <= 5; formant++) { |
| 637 | int x; |
| 638 | x = fr->ffreq[formant] * vcolouring[vcolour-1][formant-1]; |
| 639 | fr->ffreq[formant] = x / 256; |
| 640 | } |
| 641 | } |
| 642 | } |
| 643 | } |
| 644 | } |
| 645 | |
| 646 | if (fr != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 647 | if (flags & 4) |
| 648 | fr->frflags |= FRFLAG_FORMANT_RATEcxx . . $ `external/espeak/synthesize.h:46:9`!; |
| 649 | if (flags & 2) |
| 650 | fr->frflags |= FRFLAG_BREAKcxx . . $ `external/espeak/synthesize.h:45:9`!; // don't merge with next frame |
| 651 | } |
| 652 | |
| 653 | if (flags & 0x40) |
| 654 | DoPausecxx . . $ DoPause(3e454b8ccf442868).(20, 0); // add a short pause after the consonant |
| 655 | |
| 656 | if (flags & 16) |
| 657 | return len; |
| 658 | return 0; |
| 659 | } |
| 660 | |
| 661 | static void SmoothSpectcxx . . $ SmoothSpect(49f6e7a06ebc5aa8).(void) |
| 662 | { |
| 663 | // Limit the rate of frequence change of formants, to reduce chirping |
| 664 | |
| 665 | intptr_tcxx . . $ intptr_t# *q; |
| 666 | frame_t *frame; |
| 667 | frame_t *frame2; |
| 668 | frame_t *frame1; |
| 669 | frame_t *frame_centre; |
| 670 | int ix; |
| 671 | int len; |
| 672 | int pk; |
| 673 | bool modified; |
| 674 | int allowed; |
| 675 | int diff; |
| 676 | |
| 677 | if (syllable_startcxx . . $ syllable_start. == syllable_endcxx . . $ syllable_end.) |
| 678 | return; |
| 679 | |
| 680 | if ((syllable_centrecxx . . $ syllable_centre. < 0) || (syllable_centrecxx . . $ syllable_centre. == syllable_startcxx . . $ syllable_start.)) { |
| 681 | syllable_startcxx . . $ syllable_start. = syllable_endcxx . . $ syllable_end.; |
| 682 | return; |
| 683 | } |
| 684 | |
| 685 | q = wcmdq[syllable_centrecxx . . $ syllable_centre.]; |
| 686 | frame_centre = (frame_t *)q[2]; |
| 687 | |
| 688 | // backwards |
| 689 | ix = syllable_centrecxx . . $ syllable_centre. -1; |
| 690 | frame = frame2 = frame_centre; |
| 691 | for (;;) { |
| 692 | if (ix < 0) ix = N_WCMDQcxx . . $ `external/espeak/synthesize.h:415:9`!-1; |
| 693 | q = wcmdq[ix]; |
| 694 | |
| 695 | if (q[0] == WCMD_PAUSEcxx . . $ `external/espeak/synthesize.h:402:9`! || q[0] == WCMD_WAVEcxx . . $ `external/espeak/synthesize.h:403:9`!) |
| 696 | break; |
| 697 | |
| 698 | if (q[0] <= WCMD_SPECT2cxx . . $ `external/espeak/synthesize.h:401:9`!) { |
| 699 | len = q[1] & 0xffff; |
| 700 | |
| 701 | frame1 = (frame_t *)q[3]; |
| 702 | if (frame1 == frame) { |
| 703 | q[3] = (intptr_tcxx . . $ intptr_t#)frame2; |
| 704 | frame1 = frame2; |
| 705 | } else |
| 706 | break; // doesn't follow on from previous frame |
| 707 | |
| 708 | frame = frame2 = (frame_t *)q[2]; |
| 709 | modified = false; |
| 710 | |
| 711 | if (frame->frflags & FRFLAG_BREAKcxx . . $ `external/espeak/synthesize.h:45:9`!) |
| 712 | break; |
| 713 | |
| 714 | if (frame->frflags & FRFLAG_FORMANT_RATEcxx . . $ `external/espeak/synthesize.h:46:9`!) |
| 715 | len = (len * 12)/10; // allow slightly greater rate of change for this frame (was 12/10) |
| 716 | |
| 717 | for (pk = 0; pk < 6; pk++) { |
| 718 | int f1, f2; |
| 719 | |
| 720 | if ((frame->frflags & FRFLAG_BREAK_LFcxx . . $ `external/espeak/synthesize.h:44:9`!) && (pk < 3)) |
| 721 | continue; |
| 722 | |
| 723 | f1 = frame1->ffreq[pk]; |
| 724 | f2 = frame->ffreq[pk]; |
| 725 | |
| 726 | // backwards |
| 727 | if ((diff = f2 - f1) > 0) |
| 728 | allowed = f1*2 + f2; |
| 729 | else |
| 730 | allowed = f1 + f2*2; |
| 731 | |
| 732 | // the allowed change is specified as percentage (%*10) of the frequency |
| 733 | // take "frequency" as 1/3 from the lower freq |
| 734 | allowed = (allowed * formant_rate[pk])/3000; |
| 735 | allowed = (allowed * len)/256; |
| 736 | |
| 737 | if (diff > allowed) { |
| 738 | if (modified == false) { |
| 739 | frame2 = CopyFramecxx . . $ CopyFrame(598b57aa678ed870).(frame, 0); |
| 740 | modified = true; |
| 741 | } |
| 742 | frame2->ffreq[pk] = frame1->ffreq[pk] + allowed; |
| 743 | q[2] = (intptr_tcxx . . $ intptr_t#)frame2; |
| 744 | } else if (diff < -allowed) { |
| 745 | if (modified == false) { |
| 746 | frame2 = CopyFramecxx . . $ CopyFrame(598b57aa678ed870).(frame, 0); |
| 747 | modified = true; |
| 748 | } |
| 749 | frame2->ffreq[pk] = frame1->ffreq[pk] - allowed; |
| 750 | q[2] = (intptr_tcxx . . $ intptr_t#)frame2; |
| 751 | } |
| 752 | } |
| 753 | } |
| 754 | |
| 755 | if (ix == syllable_startcxx . . $ syllable_start.) |
| 756 | break; |
| 757 | ix--; |
| 758 | } |
| 759 | |
| 760 | // forwards |
| 761 | ix = syllable_centrecxx . . $ syllable_centre.; |
| 762 | |
| 763 | frame = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 764 | for (;;) { |
| 765 | q = wcmdq[ix]; |
| 766 | |
| 767 | if (q[0] == WCMD_PAUSEcxx . . $ `external/espeak/synthesize.h:402:9`! || q[0] == WCMD_WAVEcxx . . $ `external/espeak/synthesize.h:403:9`!) |
| 768 | break; |
| 769 | |
| 770 | if (q[0] <= WCMD_SPECT2cxx . . $ `external/espeak/synthesize.h:401:9`!) { |
| 771 | len = q[1] & 0xffff; |
| 772 | |
| 773 | frame1 = (frame_t *)q[2]; |
| 774 | if (frame != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 775 | if (frame1 == frame) { |
| 776 | q[2] = (intptr_tcxx . . $ intptr_t#)frame2; |
| 777 | frame1 = frame2; |
| 778 | } else |
| 779 | break; // doesn't follow on from previous frame |
| 780 | } |
| 781 | |
| 782 | frame = frame2 = (frame_t *)q[3]; |
| 783 | modified = false; |
| 784 | |
| 785 | if (frame1->frflags & FRFLAG_BREAKcxx . . $ `external/espeak/synthesize.h:45:9`!) |
| 786 | break; |
| 787 | |
| 788 | if (frame1->frflags & FRFLAG_FORMANT_RATEcxx . . $ `external/espeak/synthesize.h:46:9`!) |
| 789 | len = (len *6)/5; // allow slightly greater rate of change for this frame |
| 790 | |
| 791 | for (pk = 0; pk < 6; pk++) { |
| 792 | int f1, f2; |
| 793 | f1 = frame1->ffreq[pk]; |
| 794 | f2 = frame->ffreq[pk]; |
| 795 | |
| 796 | // forwards |
| 797 | if ((diff = f2 - f1) > 0) |
| 798 | allowed = f1*2 + f2; |
| 799 | else |
| 800 | allowed = f1 + f2*2; |
| 801 | allowed = (allowed * formant_rate[pk])/3000; |
| 802 | allowed = (allowed * len)/256; |
| 803 | |
| 804 | if (diff > allowed) { |
| 805 | if (modified == false) { |
| 806 | frame2 = CopyFramecxx . . $ CopyFrame(598b57aa678ed870).(frame, 0); |
| 807 | modified = true; |
| 808 | } |
| 809 | frame2->ffreq[pk] = frame1->ffreq[pk] + allowed; |
| 810 | q[3] = (intptr_tcxx . . $ intptr_t#)frame2; |
| 811 | } else if (diff < -allowed) { |
| 812 | if (modified == false) { |
| 813 | frame2 = CopyFramecxx . . $ CopyFrame(598b57aa678ed870).(frame, 0); |
| 814 | modified = true; |
| 815 | } |
| 816 | frame2->ffreq[pk] = frame1->ffreq[pk] - allowed; |
| 817 | q[3] = (intptr_tcxx . . $ intptr_t#)frame2; |
| 818 | } |
| 819 | } |
| 820 | } |
| 821 | |
| 822 | ix++; |
| 823 | if (ix >= N_WCMDQcxx . . $ `external/espeak/synthesize.h:415:9`!) ix = 0; |
| 824 | if (ix == syllable_endcxx . . $ syllable_end.) |
| 825 | break; |
| 826 | } |
| 827 | |
| 828 | syllable_startcxx . . $ syllable_start. = syllable_endcxx . . $ syllable_end.; |
| 829 | } |
| 830 | |
| 831 | static void StartSyllablecxx . . $ StartSyllable(49f6e7a06ebc5aa8).(void) |
| 832 | { |
| 833 | // start of syllable, if not already started |
| 834 | if (syllable_endcxx . . $ syllable_end. == syllable_startcxx . . $ syllable_start.) |
| 835 | syllable_endcxx . . $ syllable_end. = wcmdq_tail; |
| 836 | } |
| 837 | |
| 838 | int DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_LIST *plist, int modulation) |
| 839 | { |
| 840 | // which: 0 not a vowel, 1 start of vowel, 2 body and end of vowel |
| 841 | // length_mod: 256 = 100% |
| 842 | // modulation: -1 = don't write to wcmdq |
| 843 | |
| 844 | int n_frames; |
| 845 | frameref_t *frames; |
| 846 | int frameix; |
| 847 | frame_t *frame1; |
| 848 | frame_t *frame2; |
| 849 | intptr_tcxx . . $ intptr_t# *q; |
| 850 | int len; |
| 851 | int length_mod; |
| 852 | int length_sum; |
| 853 | int length_min; |
| 854 | int total_len = 0; |
| 855 | static int wave_flag = 0; |
| 856 | int wcmd_spect = WCMD_SPECTcxx . . $ `external/espeak/synthesize.h:400:9`!; |
| 857 | int frame_lengths[N_SEQ_FRAMEScxx . . $ `external/espeak/synthesize.h:37:9`!]; |
| 858 | |
| 859 | if (fmt_params->fmt_addr == 0) |
| 860 | return 0; |
| 861 | |
| 862 | length_mod = plist->length; |
| 863 | if (length_mod == 0) length_mod = 256; |
| 864 | |
| 865 | length_min = (samplerate/70); // greater than one cycle at low pitch (Hz) |
| 866 | if (which == 2) { |
| 867 | if ((translator->langopts.param[LOPT_LONG_VOWEL_THRESHOLDcxx . . $ `external/espeak/translate.h:341:9`!] > 0) && ((this_ph->std_length >= translator->langopts.param[LOPT_LONG_VOWEL_THRESHOLDcxx . . $ `external/espeak/translate.h:341:9`!]) || (plist->synthflags & SFLAG_LENGTHENcxx . . $ `external/espeak/synthesize.h:55:9`!) || (this_ph->phflags & phLONGcxx . . $ `external/espeak/phoneme.h:189:9`!))) |
| 868 | length_min *= 2; // ensure long vowels are longer |
| 869 | } |
| 870 | |
| 871 | if (which == 1) { |
| 872 | // limit the shortening of sonorants before shortened (eg. unstressed vowels) |
| 873 | if ((this_ph->type == phLIQUIDcxx . . $ `external/espeak/phoneme.h:135:9`!) || (plist[-1].type == phLIQUIDcxx . . $ `external/espeak/phoneme.h:135:9`!) || (plist[-1].type == phNASALcxx . . $ `external/espeak/phoneme.h:140:9`!)) { |
| 874 | if (length_mod < (len = translator->langopts.param[LOPT_SONORANT_MINcxx . . $ `external/espeak/translate.h:308:9`!])) |
| 875 | length_mod = len; |
| 876 | } |
| 877 | } |
| 878 | |
| 879 | modn_flagscxx . . $ modn_flags. = 0; |
| 880 | frames = LookupSpect(this_ph, which, fmt_params, &n_frames, plist); |
| 881 | if (frames == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 882 | return 0; // not found |
| 883 | |
| 884 | if (fmt_params->fmt_amp != fmt_amplitudecxx . . $ fmt_amplitude.) { |
| 885 | // an amplitude adjustment is specified for this sequence |
| 886 | q = wcmdq[wcmdq_tail]; |
| 887 | q[0] = WCMD_FMT_AMPLITUDEcxx . . $ `external/espeak/synthesize.h:411:9`!; |
| 888 | q[1] = fmt_amplitudecxx . . $ fmt_amplitude. = fmt_params->fmt_amp; |
| 889 | WcmdqInc(); |
| 890 | } |
| 891 | |
| 892 | frame1 = frames[0].frame; |
| 893 | if (voice->klattv[0]) |
| 894 | wcmd_spect = WCMD_KLATTcxx . . $ `external/espeak/synthesize.h:398:9`!; |
| 895 | |
| 896 | if (fmt_params->wav_addr == 0) { |
| 897 | if (wave_flag) { |
| 898 | // cancel any wavefile that was playing previously |
| 899 | wcmd_spect = WCMD_SPECT2cxx . . $ `external/espeak/synthesize.h:401:9`!; |
| 900 | if (voice->klattv[0]) |
| 901 | wcmd_spect = WCMD_KLATT2cxx . . $ `external/espeak/synthesize.h:399:9`!; |
| 902 | wave_flag = 0; |
| 903 | } else { |
| 904 | wcmd_spect = WCMD_SPECTcxx . . $ `external/espeak/synthesize.h:400:9`!; |
| 905 | if (voice->klattv[0]) |
| 906 | wcmd_spect = WCMD_KLATTcxx . . $ `external/espeak/synthesize.h:398:9`!; |
| 907 | } |
| 908 | } |
| 909 | |
| 910 | if (last_framecxx . . $ last_frame. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 911 | if (((last_framecxx . . $ last_frame.->length < 2) || (last_framecxx . . $ last_frame.->frflags & FRFLAG_VOWEL_CENTREcxx . . $ `external/espeak/synthesize.h:42:9`!)) |
| 912 | && !(last_framecxx . . $ last_frame.->frflags & FRFLAG_BREAKcxx . . $ `external/espeak/synthesize.h:45:9`!)) { |
| 913 | // last frame of previous sequence was zero-length, replace with first of this sequence |
| 914 | wcmdq[last_wcmdqcxx . . $ last_wcmdq.][3] = (intptr_tcxx . . $ intptr_t#)frame1; |
| 915 | |
| 916 | if (last_framecxx . . $ last_frame.->frflags & FRFLAG_BREAK_LFcxx . . $ `external/espeak/synthesize.h:44:9`!) { |
| 917 | // but flag indicates keep HF peaks in last segment |
| 918 | frame_t *fr; |
| 919 | fr = CopyFramecxx . . $ CopyFrame(598b57aa678ed870).(frame1, 1); |
| 920 | for (int ix = 3; ix < 8; ix++) { |
| 921 | if (ix < 7) |
| 922 | fr->ffreq[ix] = last_framecxx . . $ last_frame.->ffreq[ix]; |
| 923 | fr->fheight[ix] = last_framecxx . . $ last_frame.->fheight[ix]; |
| 924 | } |
| 925 | wcmdq[last_wcmdqcxx . . $ last_wcmdq.][3] = (intptr_tcxx . . $ intptr_t#)fr; |
| 926 | } |
| 927 | } |
| 928 | } |
| 929 | |
| 930 | if ((this_ph->type == phVOWELcxx . . $ `external/espeak/phoneme.h:134:9`!) && (which == 2)) { |
| 931 | SmoothSpectcxx . . $ SmoothSpect(49f6e7a06ebc5aa8).(); // process previous syllable |
| 932 | |
| 933 | // remember the point in the output queue of the centre of the vowel |
| 934 | syllable_centrecxx . . $ syllable_centre. = wcmdq_tail; |
| 935 | } |
| 936 | |
| 937 | length_sum = 0; |
| 938 | for (frameix = 1; frameix < n_frames; frameix++) { |
| 939 | int length_factor = length_mod; |
| 940 | if (frames[frameix-1].frflags & FRFLAG_LEN_MODcxx . . $ `external/espeak/synthesize.h:43:9`!) // reduce effect of length mod |
| 941 | length_factor = (length_mod*(256-speedcxx . . $ speed..lenmod_factor) + 256*speedcxx . . $ speed..lenmod_factor)/256; |
| 942 | else if (frames[frameix-1].frflags & FRFLAG_LEN_MOD2cxx . . $ `external/espeak/synthesize.h:49:9`!) // reduce effect of length mod, used for the start of a vowel |
| 943 | length_factor = (length_mod*(256-speedcxx . . $ speed..lenmod2_factor) + 256*speedcxx . . $ speed..lenmod2_factor)/256; |
| 944 | |
| 945 | int frame_length = frames[frameix-1].length; |
| 946 | len = (frame_length * samplerate)/1000; |
| 947 | len = (len * length_factor)/256; |
| 948 | length_sum += len; |
| 949 | frame_lengths[frameix] = len; |
| 950 | } |
| 951 | |
| 952 | if ((length_sum > 0) && (length_sum < length_min)) { |
| 953 | // lengthen, so that the sequence is greater than one cycle at low pitch |
| 954 | for (frameix = 1; frameix < n_frames; frameix++) |
| 955 | frame_lengths[frameix] = (frame_lengths[frameix] * length_min) / length_sum; |
| 956 | } |
| 957 | |
| 958 | for (frameix = 1; frameix < n_frames; frameix++) { |
| 959 | frame2 = frames[frameix].frame; |
| 960 | |
| 961 | if ((fmt_params->wav_addr != 0) && ((frame1->frflags & FRFLAG_DEFER_WAVcxx . . $ `external/espeak/synthesize.h:48:9`!) == 0)) { |
| 962 | // there is a wave file to play along with this synthesis |
| 963 | seq_len_adjustcxx . . $ seq_len_adjust. = 0; |
| 964 | |
| 965 | int wavefile_amp; |
| 966 | if (fmt_params->wav_amp == 0) |
| 967 | wavefile_amp = 32; |
| 968 | else |
| 969 | wavefile_amp = (fmt_params->wav_amp * 32)/100; |
| 970 | |
| 971 | DoSample2cxx . . $ DoSample2(4ccc28f389ac356e).(fmt_params->wav_addr, which+0x100, 0, fmt_params->fmt_control, 0, wavefile_amp); |
| 972 | wave_flag = 1; |
| 973 | fmt_params->wav_addr = 0; |
| 974 | } |
| 975 | |
| 976 | if (modulation >= 0) { |
| 977 | if (frame1->frflags & FRFLAG_MODULATEcxx . . $ `external/espeak/synthesize.h:47:9`!) |
| 978 | modulation = 6; |
| 979 | if ((frameix == n_frames-1) && (modn_flagscxx . . $ modn_flags. & 0xf00)) |
| 980 | modulation |= modn_flagscxx . . $ modn_flags.; // before or after a glottal stop |
| 981 | } |
| 982 | |
| 983 | len = frame_lengths[frameix]; |
| 984 | pitch_lengthcxx . . $ pitch_length. += len; |
| 985 | amp_lengthcxx . . $ amp_length. += len; |
| 986 | |
| 987 | if (len == 0) { |
| 988 | last_framecxx . . $ last_frame. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 989 | frame1 = frame2; |
| 990 | } else { |
| 991 | last_wcmdqcxx . . $ last_wcmdq. = wcmdq_tail; |
| 992 | |
| 993 | if (modulation >= 0) { |
| 994 | q = wcmdq[wcmdq_tail]; |
| 995 | q[0] = wcmd_spect; |
| 996 | q[1] = len + (modulation << 16); |
| 997 | q[2] = (intptr_tcxx . . $ intptr_t#)frame1; |
| 998 | q[3] = (intptr_tcxx . . $ intptr_t#)frame2; |
| 999 | |
| 1000 | WcmdqInc(); |
| 1001 | } |
| 1002 | last_framecxx . . $ last_frame. = frame1 = frame2; |
| 1003 | total_len += len; |
| 1004 | } |
| 1005 | } |
| 1006 | |
| 1007 | if ((which != 1) && (fmt_amplitudecxx . . $ fmt_amplitude. != 0)) { |
| 1008 | q = wcmdq[wcmdq_tail]; |
| 1009 | q[0] = WCMD_FMT_AMPLITUDEcxx . . $ `external/espeak/synthesize.h:411:9`!; |
| 1010 | q[1] = fmt_amplitudecxx . . $ fmt_amplitude. = 0; |
| 1011 | WcmdqInc(); |
| 1012 | } |
| 1013 | |
| 1014 | return total_len; |
| 1015 | } |
| 1016 | |
| 1017 | void DoMarkercxx . . $ DoMarker(748afa4755bc9595).(int type, int char_posn, int length, int value) |
| 1018 | { |
| 1019 | // This could be used to return an index to the word currently being spoken |
| 1020 | // Type 1=word, 2=sentence, 3=named marker, 4=play audio, 5=end |
| 1021 | |
| 1022 | if (WcmdqFree() > 5) { |
| 1023 | wcmdq[wcmdq_tail][0] = WCMD_MARKERcxx . . $ `external/espeak/synthesize.h:407:9`! + (type << 8); |
| 1024 | wcmdq[wcmdq_tail][1] = (char_posn & 0xffffff) | (length << 24); |
| 1025 | wcmdq[wcmdq_tail][2] = value; |
| 1026 | WcmdqInc(); |
| 1027 | } |
| 1028 | } |
| 1029 | |
| 1030 | void DoPhonemeMarkercxx . . $ DoPhonemeMarker(bb9e92bb7fdaa1cf).(int type, int char_posn, int length, char *name) |
| 1031 | { |
| 1032 | // This could be used to return an index to the word currently being spoken |
| 1033 | // Type 7=phoneme |
| 1034 | |
| 1035 | if (WcmdqFree() > 5) { |
| 1036 | wcmdq[wcmdq_tail][0] = WCMD_MARKERcxx . . $ `external/espeak/synthesize.h:407:9`! + (type << 8); |
| 1037 | wcmdq[wcmdq_tail][1] = (char_posn & 0xffffff) | (length << 24); |
| 1038 | memcpy(&wcmdq[wcmdq_tail][2], name, 8); // up to 8 bytes of UTF8 characters, either in 2 or in 2 and 3 // ppgb-espeak: potentially endian-specific |
| 1039 | WcmdqInc(); |
| 1040 | } |
| 1041 | } |
| 1042 | |
| 1043 | #if USE_LIBSONIC |
| 1044 | void DoSonicSpeed(int value) |
| 1045 | { |
| 1046 | // value, multiplier * 1024 |
| 1047 | wcmdq[wcmdq_tail][0] = WCMD_SONIC_SPEED; |
| 1048 | wcmdq[wcmdq_tail][1] = value; |
| 1049 | WcmdqInc(); |
| 1050 | } |
| 1051 | #endif |
| 1052 | |
| 1053 | espeak_ng_STATUS DoVoiceChangecxx . . $ DoVoiceChange(879fb63f5b5c051).(voice_t *v) |
| 1054 | { |
| 1055 | // allocate memory for a copy of the voice data, and free it in wavegenfill() |
| 1056 | voice_t *v2; |
| 1057 | if ((v2 = (voice_t *)malloccxx . . $ malloc(9f008b2a9698428b).(sizeof(voice_t))) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 1058 | return static_cast<espeak_ng_STATUS> (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!); |
| 1059 | memcpy(v2, v, sizeof(voice_t)); |
| 1060 | wcmdq[wcmdq_tail][0] = WCMD_VOICEcxx . . $ `external/espeak/synthesize.h:408:9`!; |
| 1061 | wcmdq[wcmdq_tail][2] = (intptr_tcxx . . $ intptr_t#)v2; |
| 1062 | WcmdqInc(); |
| 1063 | return ENS_OK; |
| 1064 | } |
| 1065 | |
| 1066 | void DoEmbeddedcxx . . $ DoEmbedded(621ccea12ecf5b06).(int *embix, int sourceix) |
| 1067 | { |
| 1068 | // There were embedded commands in the text at this point |
| 1069 | unsigned int word; // bit 7=last command for this word, bits 5,6 sign, bits 0-4 command |
| 1070 | |
| 1071 | do { |
| 1072 | unsigned int value; |
| 1073 | int command; |
| 1074 | |
| 1075 | word = embedded_list[*embix]; |
| 1076 | value = word >> 8; |
| 1077 | command = word & 0x7f; |
| 1078 | |
| 1079 | if (command == 0) |
| 1080 | return; // error |
| 1081 | |
| 1082 | (*embix)++; |
| 1083 | |
| 1084 | switch (command & 0x1f) |
| 1085 | { |
| 1086 | case EMBED_Scxx . . $ `external/espeak/synthesize.h:64:9`!: // speed |
| 1087 | SetEmbedded((command & 0x60) + EMBED_S2cxx . . $ `external/espeak/synthesize.h:70:9`!, value); // adjusts embedded_value[EMBED_S2] |
| 1088 | SetSpeed(2); |
| 1089 | break; |
| 1090 | case EMBED_Icxx . . $ `external/espeak/synthesize.h:69:9`!: // play dynamically loaded wav data (sound icon) |
| 1091 | if ((int)value < n_soundicon_tab) { |
| 1092 | if (soundicon_tab[value].length != 0) { |
| 1093 | DoPausecxx . . $ DoPause(3e454b8ccf442868).(10, 0); // ensure a break in the speech |
| 1094 | wcmdq[wcmdq_tail][0] = WCMD_WAVEcxx . . $ `external/espeak/synthesize.h:403:9`!; |
| 1095 | wcmdq[wcmdq_tail][1] = soundicon_tab[value].length; |
| 1096 | wcmdq[wcmdq_tail][2] = (intptr_tcxx . . $ intptr_t#)soundicon_tab[value].data + 44; // skip WAV header |
| 1097 | wcmdq[wcmdq_tail][3] = 0x1500; // 16 bit data, amp=21 |
| 1098 | WcmdqInc(); |
| 1099 | } |
| 1100 | } |
| 1101 | break; |
| 1102 | case EMBED_Mcxx . . $ `external/espeak/synthesize.h:72:9`!: // named marker |
| 1103 | DoMarkercxx . . $ DoMarker(748afa4755bc9595).(espeakEVENT_MARKcxx . . $ espeakEVENT_MARK., (sourceix & 0x7ff) + clause_start_char, 0, value); |
| 1104 | break; |
| 1105 | case EMBED_Ucxx . . $ `external/espeak/synthesize.h:73:9`!: // play sound |
| 1106 | DoMarkercxx . . $ DoMarker(748afa4755bc9595).(espeakEVENT_PLAYcxx . . $ espeakEVENT_PLAY., count_characters+1, 0, value); // always occurs at end of clause |
| 1107 | break; |
| 1108 | default: |
| 1109 | DoPausecxx . . $ DoPause(3e454b8ccf442868).(10, 0); // ensure a break in the speech |
| 1110 | wcmdq[wcmdq_tail][0] = WCMD_EMBEDDEDcxx . . $ `external/espeak/synthesize.h:409:9`!; |
| 1111 | wcmdq[wcmdq_tail][1] = command; |
| 1112 | wcmdq[wcmdq_tail][2] = value; |
| 1113 | WcmdqInc(); |
| 1114 | break; |
| 1115 | } |
| 1116 | } while ((word & 0x80) == 0); |
| 1117 | } |
| 1118 | |
| 1119 | extern espeak_ng_OUTPUT_HOOKS* output_hookscxx . . $ output_hooks.; |
| 1120 | |
| 1121 | int Generatecxx . . $ Generate(4116149b899eea69).(PHONEME_LIST *phonemeList, int *n_ph, bool resume) |
| 1122 | { |
| 1123 | static int ix; |
| 1124 | static int embedded_ix; |
| 1125 | static int word_count; |
| 1126 | PHONEME_LIST *p; |
| 1127 | bool released; |
| 1128 | int stress; |
| 1129 | int modulation; |
| 1130 | bool pre_voiced; |
| 1131 | int free_min; |
| 1132 | int value; |
| 1133 | const unsigned char *pitch_env = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1134 | const unsigned char *amp_env; |
| 1135 | PHONEME_TAB *ph; |
| 1136 | int use_ipa = 0; |
| 1137 | int vowelstart_prev; |
| 1138 | char phoneme_name[16]; |
| 1139 | static int sourceix = 0; |
| 1140 | |
| 1141 | PHONEME_DATA phdata; |
| 1142 | PHONEME_DATA phdata_prev; |
| 1143 | PHONEME_DATA phdata_next; |
| 1144 | PHONEME_DATA phdata_tone; |
| 1145 | FMT_PARAMS fmtp; |
| 1146 | static WORD_PH_DATA worddata; |
| 1147 | |
| 1148 | if (option_phoneme_events & espeakINITIALIZE_PHONEME_IPAcxx . . $ `external/espeak/synthesize.h:33:9`!) |
| 1149 | use_ipa = 1; |
| 1150 | |
| 1151 | #if USE_MBROLAcxx . . $ `external/espeak/espeak__config.h:18:9`! |
| 1152 | if (mbrola_name[0] != 0) |
| 1153 | return MbrolaGenerate(phonemeList, n_ph, resume); |
| 1154 | #endif |
| 1155 | |
| 1156 | if (resume == false) { |
| 1157 | ix = 1; |
| 1158 | embedded_ix = 0; |
| 1159 | word_count = 0; |
| 1160 | pitch_lengthcxx . . $ pitch_length. = 0; |
| 1161 | amp_lengthcxx . . $ amp_length. = 0; |
| 1162 | last_framecxx . . $ last_frame. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1163 | last_wcmdqcxx . . $ last_wcmdq. = -1; |
| 1164 | syllable_startcxx . . $ syllable_start. = wcmdq_tail; |
| 1165 | syllable_endcxx . . $ syllable_end. = wcmdq_tail; |
| 1166 | syllable_centrecxx . . $ syllable_centre. = -1; |
| 1167 | last_pitch_cmdcxx . . $ last_pitch_cmd. = -1; |
| 1168 | memset(&worddata, 0, sizeof(worddata)); |
| 1169 | DoPausecxx . . $ DoPause(3e454b8ccf442868).(0, 0); // isolate from the previous clause |
| 1170 | } |
| 1171 | |
| 1172 | while ((ix < (*n_ph)) && (ix < N_PHONEME_LISTcxx . . $ `external/espeak/synthesize.h:35:9`!-2)) { |
| 1173 | p = &phonemeList[ix]; |
| 1174 | |
| 1175 | if(output_hookscxx . . $ output_hooks. && output_hookscxx . . $ output_hooks.->outputPhoSymbol) |
| 1176 | { |
| 1177 | char buf[30]; |
| 1178 | int dummy=0; |
| 1179 | WritePhMnemonic(buf, p->ph, p, 0, &dummy); |
| 1180 | DoPhonemeAlignmentcxx . . $ DoPhonemeAlignment(a07d8cccb7673f5a).(strdup(buf),p->type); |
| 1181 | } |
| 1182 | |
| 1183 | if (p->type == phPAUSEcxx . . $ `external/espeak/phoneme.h:132:9`!) |
| 1184 | free_min = 10; |
| 1185 | else if (p->type != phVOWELcxx . . $ `external/espeak/phoneme.h:134:9`!) |
| 1186 | free_min = 15; // we need less Q space for non-vowels, and we need to generate phonemes after a vowel so that the pitch_length is filled in |
| 1187 | else |
| 1188 | free_min = MIN_WCMDQcxx . . $ `external/espeak/synthesize.h:416:9`!; |
| 1189 | |
| 1190 | if (WcmdqFree() <= free_min) |
| 1191 | return 1; // wait |
| 1192 | |
| 1193 | PHONEME_LIST *prev; |
| 1194 | PHONEME_LIST *next; |
| 1195 | PHONEME_LIST *next2; |
| 1196 | |
| 1197 | prev = &phonemeList[ix-1]; |
| 1198 | next = &phonemeList[ix+1]; |
| 1199 | next2 = &phonemeList[ix+2]; |
| 1200 | |
| 1201 | if (p->synthflags & SFLAG_EMBEDDEDcxx . . $ `external/espeak/synthesize.h:53:9`!) |
| 1202 | DoEmbeddedcxx . . $ DoEmbedded(621ccea12ecf5b06).(&embedded_ix, p->sourceix); |
| 1203 | |
| 1204 | if (p->newword) { |
| 1205 | if (((p->type == phVOWELcxx . . $ `external/espeak/phoneme.h:134:9`!) && (translator->langopts.param[LOPT_WORD_MERGEcxx . . $ `external/espeak/translate.h:311:9`!] & 1)) || |
| 1206 | (p->ph->phflags & phNOPAUSEcxx . . $ `external/espeak/phoneme.h:192:9`!)) { |
| 1207 | } else |
| 1208 | last_framecxx . . $ last_frame. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1209 | |
| 1210 | sourceix = (p->sourceix & 0x7ff) + clause_start_char; |
| 1211 | |
| 1212 | if (p->newword & PHLIST_START_OF_SENTENCEcxx . . $ `external/espeak/synthesize.h:185:9`!) |
| 1213 | DoMarkercxx . . $ DoMarker(748afa4755bc9595).(espeakEVENT_SENTENCEcxx . . $ espeakEVENT_SENTENCE., sourceix, 0, count_sentences); // start of sentence |
| 1214 | |
| 1215 | if (p->newword & PHLIST_START_OF_WORDcxx . . $ `external/espeak/synthesize.h:183:9`!) |
| 1216 | DoMarkercxx . . $ DoMarker(748afa4755bc9595).(espeakEVENT_WORDcxx . . $ espeakEVENT_WORD., sourceix, p->sourceix >> 11, clause_start_word + word_count++); // NOTE, this count doesn't include multiple-word pronunciations in *_list. eg (of a) |
| 1217 | } |
| 1218 | |
| 1219 | EndAmplitudecxx . . $ EndAmplitude(49f6e7a06ebc5aa8).(); |
| 1220 | |
| 1221 | if ((p->prepause > 0) && !(p->ph->phflags & phPREVOICEcxx . . $ `external/espeak/phoneme.h:193:9`!)) |
| 1222 | DoPausecxx . . $ DoPause(3e454b8ccf442868).(p->prepause, 1); |
| 1223 | |
| 1224 | bool done_phoneme_marker = false; |
| 1225 | if (option_phoneme_events && (p->ph->code != phonEND_WORDcxx . . $ `external/espeak/phoneme.h:213:9`!)) { |
| 1226 | if ((p->type == phVOWELcxx . . $ `external/espeak/phoneme.h:134:9`!) && (prev->type == phLIQUIDcxx . . $ `external/espeak/phoneme.h:135:9`! || prev->type == phNASALcxx . . $ `external/espeak/phoneme.h:140:9`!)) { |
| 1227 | // For vowels following a liquid or nasal, do the phoneme event after the vowel-start |
| 1228 | } else { |
| 1229 | WritePhMnemonic(phoneme_name, p->ph, p, use_ipa, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1230 | DoPhonemeMarkercxx . . $ DoPhonemeMarker(bb9e92bb7fdaa1cf).(espeakEVENT_PHONEMEcxx . . $ espeakEVENT_PHONEME., sourceix, 0, phoneme_name); |
| 1231 | done_phoneme_marker = true; |
| 1232 | } |
| 1233 | } |
| 1234 | |
| 1235 | switch (p->type) |
| 1236 | { |
| 1237 | case phPAUSEcxx . . $ `external/espeak/phoneme.h:132:9`!: |
| 1238 | DoPausecxx . . $ DoPause(3e454b8ccf442868).(p->length, 0); |
| 1239 | p->std_length = p->ph->std_length; |
| 1240 | break; |
| 1241 | case phSTOPcxx . . $ `external/espeak/phoneme.h:136:9`!: |
| 1242 | released = false; |
| 1243 | ph = p->ph; |
| 1244 | if (next->type == phVOWELcxx . . $ `external/espeak/phoneme.h:134:9`!) |
| 1245 | released = true; |
| 1246 | else if (!next->newword) { |
| 1247 | if (next->type == phLIQUIDcxx . . $ `external/espeak/phoneme.h:135:9`!) released = true; |
| 1248 | } |
| 1249 | if (released == false) |
| 1250 | p->synthflags |= SFLAG_NEXT_PAUSEcxx . . $ `external/espeak/synthesize.h:60:9`!; |
| 1251 | |
| 1252 | if (ph->phflags & phPREVOICEcxx . . $ `external/espeak/phoneme.h:193:9`!) { |
| 1253 | // a period of voicing before the release |
| 1254 | memset(&fmtp, 0, sizeof(fmtp)); |
| 1255 | InterpretPhoneme(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0x01, p, &phdata, &worddata); |
| 1256 | fmtp.fmt_addr = phdata.sound_addr[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1257 | fmtp.fmt_amp = phdata.sound_param[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1258 | |
| 1259 | if (last_pitch_cmdcxx . . $ last_pitch_cmd. < 0) { |
| 1260 | DoAmplitudecxx . . $ DoAmplitude(b7d66bc82a610c46).(next->amp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1261 | DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(envelope_data[p->env], next->pitch1, next->pitch2); |
| 1262 | } |
| 1263 | |
| 1264 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(ph, 0, &fmtp, p, 0); |
| 1265 | } |
| 1266 | |
| 1267 | InterpretPhoneme(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0, p, &phdata, &worddata); |
| 1268 | phdata.pd_control |= pd_DONTLENGTHENcxx . . $ `external/espeak/synthesize.h:225:9`!; |
| 1269 | DoSample3cxx . . $ DoSample3(f192ba95c962b3da).(&phdata, 0, 0); |
| 1270 | break; |
| 1271 | case phFRICATIVEcxx . . $ `external/espeak/phoneme.h:138:9`!: |
| 1272 | InterpretPhoneme(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0, p, &phdata, &worddata); |
| 1273 | |
| 1274 | if (p->synthflags & SFLAG_LENGTHENcxx . . $ `external/espeak/synthesize.h:55:9`!) |
| 1275 | DoSample3cxx . . $ DoSample3(f192ba95c962b3da).(&phdata, p->length, 0); // play it twice for [s:] etc. |
| 1276 | DoSample3cxx . . $ DoSample3(f192ba95c962b3da).(&phdata, p->length, 0); |
| 1277 | break; |
| 1278 | case phVSTOPcxx . . $ `external/espeak/phoneme.h:137:9`!: |
| 1279 | ph = p->ph; |
| 1280 | memset(&fmtp, 0, sizeof(fmtp)); |
| 1281 | fmtp.fmt_control = pd_DONTLENGTHENcxx . . $ `external/espeak/synthesize.h:225:9`!; |
| 1282 | |
| 1283 | pre_voiced = false; |
| 1284 | if (next->type == phVOWELcxx . . $ `external/espeak/phoneme.h:134:9`!) { |
| 1285 | DoAmplitudecxx . . $ DoAmplitude(b7d66bc82a610c46).(p->amp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1286 | DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(envelope_data[p->env], p->pitch1, p->pitch2); |
| 1287 | pre_voiced = true; |
| 1288 | } else if ((next->type == phLIQUIDcxx . . $ `external/espeak/phoneme.h:135:9`!) && !next->newword) { |
| 1289 | DoAmplitudecxx . . $ DoAmplitude(b7d66bc82a610c46).(next->amp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1290 | DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(envelope_data[next->env], next->pitch1, next->pitch2); |
| 1291 | pre_voiced = true; |
| 1292 | } else { |
| 1293 | if (last_pitch_cmdcxx . . $ last_pitch_cmd. < 0) { |
| 1294 | DoAmplitudecxx . . $ DoAmplitude(b7d66bc82a610c46).(next->amp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1295 | DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(envelope_data[p->env], p->pitch1, p->pitch2); |
| 1296 | } |
| 1297 | } |
| 1298 | |
| 1299 | if ((prev->type == phVOWELcxx . . $ `external/espeak/phoneme.h:134:9`!) || (ph->phflags & phPREVOICEcxx . . $ `external/espeak/phoneme.h:193:9`!)) { |
| 1300 | // a period of voicing before the release |
| 1301 | InterpretPhoneme(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0x01, p, &phdata, &worddata); |
| 1302 | fmtp.fmt_addr = phdata.sound_addr[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1303 | fmtp.fmt_amp = phdata.sound_param[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1304 | |
| 1305 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(ph, 0, &fmtp, p, 0); |
| 1306 | if (p->synthflags & SFLAG_LENGTHENcxx . . $ `external/espeak/synthesize.h:55:9`!) { |
| 1307 | DoPausecxx . . $ DoPause(3e454b8ccf442868).(25, 1); |
| 1308 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(ph, 0, &fmtp, p, 0); |
| 1309 | } |
| 1310 | } else { |
| 1311 | if (p->synthflags & SFLAG_LENGTHENcxx . . $ `external/espeak/synthesize.h:55:9`!) |
| 1312 | DoPausecxx . . $ DoPause(3e454b8ccf442868).(50, 0); |
| 1313 | } |
| 1314 | |
| 1315 | if (pre_voiced) { |
| 1316 | // followed by a vowel, or liquid + vowel |
| 1317 | StartSyllablecxx . . $ StartSyllable(49f6e7a06ebc5aa8).(); |
| 1318 | } else |
| 1319 | p->synthflags |= SFLAG_NEXT_PAUSEcxx . . $ `external/espeak/synthesize.h:60:9`!; |
| 1320 | InterpretPhoneme(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0, p, &phdata, &worddata); |
| 1321 | fmtp.fmt_addr = phdata.sound_addr[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1322 | fmtp.fmt_amp = phdata.sound_param[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1323 | fmtp.wav_addr = phdata.sound_addr[pd_ADDWAVcxx . . $ `external/espeak/synthesize.h:215:9`!]; |
| 1324 | fmtp.wav_amp = phdata.sound_param[pd_ADDWAVcxx . . $ `external/espeak/synthesize.h:215:9`!]; |
| 1325 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(ph, 0, &fmtp, p, 0); |
| 1326 | |
| 1327 | if ((p->newword == 0) && (next2->newword == 0)) { |
| 1328 | if (next->type == phVFRICATIVEcxx . . $ `external/espeak/phoneme.h:139:9`!) |
| 1329 | DoPausecxx . . $ DoPause(3e454b8ccf442868).(20, 0); |
| 1330 | if (next->type == phFRICATIVEcxx . . $ `external/espeak/phoneme.h:138:9`!) |
| 1331 | DoPausecxx . . $ DoPause(3e454b8ccf442868).(12, 0); |
| 1332 | } |
| 1333 | break; |
| 1334 | case phVFRICATIVEcxx . . $ `external/espeak/phoneme.h:139:9`!: |
| 1335 | if (next->type == phVOWELcxx . . $ `external/espeak/phoneme.h:134:9`!) { |
| 1336 | DoAmplitudecxx . . $ DoAmplitude(b7d66bc82a610c46).(p->amp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1337 | DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(envelope_data[p->env], p->pitch1, p->pitch2); |
| 1338 | } else if (next->type == phLIQUIDcxx . . $ `external/espeak/phoneme.h:135:9`!) { |
| 1339 | DoAmplitudecxx . . $ DoAmplitude(b7d66bc82a610c46).(next->amp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1340 | DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(envelope_data[next->env], next->pitch1, next->pitch2); |
| 1341 | } else { |
| 1342 | if (last_pitch_cmdcxx . . $ last_pitch_cmd. < 0) { |
| 1343 | DoAmplitudecxx . . $ DoAmplitude(b7d66bc82a610c46).(p->amp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1344 | DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(envelope_data[p->env], p->pitch1, p->pitch2); |
| 1345 | } |
| 1346 | } |
| 1347 | |
| 1348 | if ((next->type == phVOWELcxx . . $ `external/espeak/phoneme.h:134:9`!) || ((next->type == phLIQUIDcxx . . $ `external/espeak/phoneme.h:135:9`!) && (next->newword == 0))) // ?? test 14.Aug.2007 |
| 1349 | StartSyllablecxx . . $ StartSyllable(49f6e7a06ebc5aa8).(); |
| 1350 | else |
| 1351 | p->synthflags |= SFLAG_NEXT_PAUSEcxx . . $ `external/espeak/synthesize.h:60:9`!; |
| 1352 | InterpretPhoneme(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0, p, &phdata, &worddata); |
| 1353 | memset(&fmtp, 0, sizeof(fmtp)); |
| 1354 | fmtp.std_length = phdata.pd_param[i_SET_LENGTHcxx . . $ `external/espeak/synthesize.h:272:9`!]*2; |
| 1355 | fmtp.fmt_addr = phdata.sound_addr[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1356 | fmtp.fmt_amp = phdata.sound_param[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1357 | fmtp.wav_addr = phdata.sound_addr[pd_ADDWAVcxx . . $ `external/espeak/synthesize.h:215:9`!]; |
| 1358 | fmtp.wav_amp = phdata.sound_param[pd_ADDWAVcxx . . $ `external/espeak/synthesize.h:215:9`!]; |
| 1359 | |
| 1360 | if (p->synthflags & SFLAG_LENGTHENcxx . . $ `external/espeak/synthesize.h:55:9`!) |
| 1361 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(p->ph, 0, &fmtp, p, 0); |
| 1362 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(p->ph, 0, &fmtp, p, 0); |
| 1363 | break; |
| 1364 | case phNASALcxx . . $ `external/espeak/phoneme.h:140:9`!: |
| 1365 | memset(&fmtp, 0, sizeof(fmtp)); |
| 1366 | if (!(p->synthflags & SFLAG_SEQCONTINUEcxx . . $ `external/espeak/synthesize.h:52:9`!)) { |
| 1367 | DoAmplitudecxx . . $ DoAmplitude(b7d66bc82a610c46).(p->amp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1368 | DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(envelope_data[p->env], p->pitch1, p->pitch2); |
| 1369 | } |
| 1370 | |
| 1371 | if (prev->type == phNASALcxx . . $ `external/espeak/phoneme.h:140:9`!) |
| 1372 | last_framecxx . . $ last_frame. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1373 | |
| 1374 | InterpretPhoneme(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0, p, &phdata, &worddata); |
| 1375 | fmtp.std_length = phdata.pd_param[i_SET_LENGTHcxx . . $ `external/espeak/synthesize.h:272:9`!]*2; |
| 1376 | fmtp.fmt_addr = phdata.sound_addr[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1377 | fmtp.fmt_amp = phdata.sound_param[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1378 | |
| 1379 | if (next->type == phVOWELcxx . . $ `external/espeak/phoneme.h:134:9`!) { |
| 1380 | StartSyllablecxx . . $ StartSyllable(49f6e7a06ebc5aa8).(); |
| 1381 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(p->ph, 0, &fmtp, p, 0); |
| 1382 | } else if (prev->type == phVOWELcxx . . $ `external/espeak/phoneme.h:134:9`! && (p->synthflags & SFLAG_SEQCONTINUEcxx . . $ `external/espeak/synthesize.h:52:9`!)) |
| 1383 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(p->ph, 0, &fmtp, p, 0); |
| 1384 | else { |
| 1385 | last_framecxx . . $ last_frame. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; // only for nasal ? |
| 1386 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(p->ph, 0, &fmtp, p, 0); |
| 1387 | last_framecxx . . $ last_frame. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1388 | } |
| 1389 | |
| 1390 | break; |
| 1391 | case phLIQUIDcxx . . $ `external/espeak/phoneme.h:135:9`!: |
| 1392 | memset(&fmtp, 0, sizeof(fmtp)); |
| 1393 | modulation = 0; |
| 1394 | if (p->ph->phflags & phTRILLcxx . . $ `external/espeak/phoneme.h:185:9`!) |
| 1395 | modulation = 5; |
| 1396 | |
| 1397 | if (!(p->synthflags & SFLAG_SEQCONTINUEcxx . . $ `external/espeak/synthesize.h:52:9`!)) { |
| 1398 | DoAmplitudecxx . . $ DoAmplitude(b7d66bc82a610c46).(p->amp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1399 | DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(envelope_data[p->env], p->pitch1, p->pitch2); |
| 1400 | } |
| 1401 | |
| 1402 | if (prev->type == phNASALcxx . . $ `external/espeak/phoneme.h:140:9`!) |
| 1403 | last_framecxx . . $ last_frame. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1404 | |
| 1405 | if (next->type == phVOWELcxx . . $ `external/espeak/phoneme.h:134:9`!) |
| 1406 | StartSyllablecxx . . $ StartSyllable(49f6e7a06ebc5aa8).(); |
| 1407 | InterpretPhoneme(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0, p, &phdata, &worddata); |
| 1408 | |
| 1409 | if ((value = (phdata.pd_param[i_PAUSE_BEFOREcxx . . $ `external/espeak/synthesize.h:269:9`!] - p->prepause)) > 0) |
| 1410 | DoPausecxx . . $ DoPause(3e454b8ccf442868).(value, 1); |
| 1411 | fmtp.std_length = phdata.pd_param[i_SET_LENGTHcxx . . $ `external/espeak/synthesize.h:272:9`!]*2; |
| 1412 | fmtp.fmt_addr = phdata.sound_addr[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1413 | fmtp.fmt_amp = phdata.sound_param[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1414 | fmtp.wav_addr = phdata.sound_addr[pd_ADDWAVcxx . . $ `external/espeak/synthesize.h:215:9`!]; |
| 1415 | fmtp.wav_amp = phdata.sound_param[pd_ADDWAVcxx . . $ `external/espeak/synthesize.h:215:9`!]; |
| 1416 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(p->ph, 0, &fmtp, p, modulation); |
| 1417 | break; |
| 1418 | case phVOWELcxx . . $ `external/espeak/phoneme.h:134:9`!: |
| 1419 | ph = p->ph; |
| 1420 | stress = p->stresslevel & 0xf; |
| 1421 | |
| 1422 | memset(&fmtp, 0, sizeof(fmtp)); |
| 1423 | |
| 1424 | InterpretPhoneme(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0, p, &phdata, &worddata); |
| 1425 | fmtp.std_length = phdata.pd_param[i_SET_LENGTHcxx . . $ `external/espeak/synthesize.h:272:9`!] * 2; |
| 1426 | vowelstart_prev = 0; |
| 1427 | |
| 1428 | if (((fmtp.fmt_addr = phdata.sound_addr[pd_VWLSTARTcxx . . $ `external/espeak/synthesize.h:213:9`!]) != 0) && ((phdata.pd_control & pd_FORNEXTPHcxx . . $ `external/espeak/synthesize.h:224:9`!) == 0)) { |
| 1429 | // a vowel start has been specified by the Vowel program |
| 1430 | fmtp.fmt_length = phdata.sound_param[pd_VWLSTARTcxx . . $ `external/espeak/synthesize.h:213:9`!]; |
| 1431 | } else if (prev->type != phPAUSEcxx . . $ `external/espeak/phoneme.h:132:9`!) { |
| 1432 | // check the previous phoneme |
| 1433 | InterpretPhoneme(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0, prev, &phdata_prev, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1434 | if (((fmtp.fmt_addr = phdata_prev.sound_addr[pd_VWLSTARTcxx . . $ `external/espeak/synthesize.h:213:9`!]) != 0) && (phdata_prev.pd_control & pd_FORNEXTPHcxx . . $ `external/espeak/synthesize.h:224:9`!)) { |
| 1435 | // a vowel start has been specified by the previous phoneme |
| 1436 | vowelstart_prev = 1; |
| 1437 | fmtp.fmt2_lenadj = phdata_prev.sound_param[pd_VWLSTARTcxx . . $ `external/espeak/synthesize.h:213:9`!]; |
| 1438 | } |
| 1439 | fmtp.transition0 = phdata_prev.vowel_transition[0]; |
| 1440 | fmtp.transition1 = phdata_prev.vowel_transition[1]; |
| 1441 | } |
| 1442 | |
| 1443 | if (fmtp.fmt_addr == 0) { |
| 1444 | // use the default start for this vowel |
| 1445 | fmtp.use_vowelin = 1; |
| 1446 | fmtp.fmt_control = 1; |
| 1447 | fmtp.fmt_addr = phdata.sound_addr[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1448 | } |
| 1449 | |
| 1450 | fmtp.fmt_amp = phdata.sound_param[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1451 | |
| 1452 | pitch_env = envelope_data[p->env]; |
| 1453 | amp_env = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1454 | if (p->tone_ph != 0) { |
| 1455 | InterpretPhoneme2(p->tone_ph, &phdata_tone); |
| 1456 | pitch_env = GetEnvelope(phdata_tone.pitch_env); |
| 1457 | if (phdata_tone.amp_env > 0) |
| 1458 | amp_env = GetEnvelope(phdata_tone.amp_env); |
| 1459 | } |
| 1460 | |
| 1461 | StartSyllablecxx . . $ StartSyllable(49f6e7a06ebc5aa8).(); |
| 1462 | |
| 1463 | modulation = 2; |
| 1464 | if (stress <= 1) |
| 1465 | modulation = 1; // 16ths |
| 1466 | else if (stress >= 7) |
| 1467 | modulation = 3; |
| 1468 | |
| 1469 | if (prev->type == phVSTOPcxx . . $ `external/espeak/phoneme.h:137:9`! || prev->type == phVFRICATIVEcxx . . $ `external/espeak/phoneme.h:139:9`!) { |
| 1470 | DoAmplitudecxx . . $ DoAmplitude(b7d66bc82a610c46).(p->amp, amp_env); |
| 1471 | DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(pitch_env, p->pitch1, p->pitch2); // don't use prevocalic rising tone |
| 1472 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(ph, 1, &fmtp, p, modulation); |
| 1473 | } else if (prev->type == phLIQUIDcxx . . $ `external/espeak/phoneme.h:135:9`! || prev->type == phNASALcxx . . $ `external/espeak/phoneme.h:140:9`!) { |
| 1474 | DoAmplitudecxx . . $ DoAmplitude(b7d66bc82a610c46).(p->amp, amp_env); |
| 1475 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(ph, 1, &fmtp, p, modulation); // continue with pre-vocalic rising tone |
| 1476 | DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(pitch_env, p->pitch1, p->pitch2); |
| 1477 | } else if (vowelstart_prev) { |
| 1478 | // VowelStart from the previous phoneme, but not phLIQUID or phNASAL |
| 1479 | DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(envelope_data[PITCHrisecxx . . $ `external/espeak/synthesize.h:448:9`!], p->pitch2 - 15, p->pitch2); |
| 1480 | DoAmplitudecxx . . $ DoAmplitude(b7d66bc82a610c46).(p->amp-1, amp_env); |
| 1481 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(ph, 1, &fmtp, p, modulation); // continue with pre-vocalic rising tone |
| 1482 | DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(pitch_env, p->pitch1, p->pitch2); |
| 1483 | } else { |
| 1484 | if (!(p->synthflags & SFLAG_SEQCONTINUEcxx . . $ `external/espeak/synthesize.h:52:9`!)) { |
| 1485 | DoAmplitudecxx . . $ DoAmplitude(b7d66bc82a610c46).(p->amp, amp_env); |
| 1486 | DoPitchcxx . . $ DoPitch(7ef8514ecfc32cd3).(pitch_env, p->pitch1, p->pitch2); |
| 1487 | } |
| 1488 | |
| 1489 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(ph, 1, &fmtp, p, modulation); |
| 1490 | } |
| 1491 | |
| 1492 | if ((option_phoneme_events) && (done_phoneme_marker == false)) { |
| 1493 | WritePhMnemonic(phoneme_name, p->ph, p, use_ipa, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1494 | DoPhonemeMarkercxx . . $ DoPhonemeMarker(bb9e92bb7fdaa1cf).(espeakEVENT_PHONEMEcxx . . $ espeakEVENT_PHONEME., sourceix, 0, phoneme_name); |
| 1495 | } |
| 1496 | |
| 1497 | fmtp.fmt_addr = phdata.sound_addr[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1498 | fmtp.fmt_amp = phdata.sound_param[pd_FMTcxx . . $ `external/espeak/synthesize.h:211:9`!]; |
| 1499 | fmtp.transition0 = 0; |
| 1500 | fmtp.transition1 = 0; |
| 1501 | |
| 1502 | if ((fmtp.fmt2_addr = phdata.sound_addr[pd_VWLENDcxx . . $ `external/espeak/synthesize.h:214:9`!]) != 0) |
| 1503 | fmtp.fmt2_lenadj = phdata.sound_param[pd_VWLENDcxx . . $ `external/espeak/synthesize.h:214:9`!]; |
| 1504 | else if (next->type != phPAUSEcxx . . $ `external/espeak/phoneme.h:132:9`!) { |
| 1505 | fmtp.fmt2_lenadj = 0; |
| 1506 | InterpretPhoneme(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0, next, &phdata_next, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1507 | |
| 1508 | fmtp.use_vowelin = 1; |
| 1509 | fmtp.transition0 = phdata_next.vowel_transition[2]; // always do vowel_transition, even if ph_VWLEND ?? consider [N] |
| 1510 | fmtp.transition1 = phdata_next.vowel_transition[3]; |
| 1511 | |
| 1512 | if ((fmtp.fmt2_addr = phdata_next.sound_addr[pd_VWLENDcxx . . $ `external/espeak/synthesize.h:214:9`!]) != 0) |
| 1513 | fmtp.fmt2_lenadj = phdata_next.sound_param[pd_VWLENDcxx . . $ `external/espeak/synthesize.h:214:9`!]; |
| 1514 | } |
| 1515 | |
| 1516 | DoSpect2cxx . . $ DoSpect2(e0bbd3409b2e9b11).(ph, 2, &fmtp, p, modulation); |
| 1517 | break; |
| 1518 | } |
| 1519 | ix++; |
| 1520 | } |
| 1521 | EndPitchcxx . . $ EndPitch(d4f767463ce0a6b3).(1); |
| 1522 | if (*n_ph > 0) { |
| 1523 | DoMarkercxx . . $ DoMarker(748afa4755bc9595).(espeakEVENT_ENDcxx . . $ espeakEVENT_END., count_characters, 0, count_sentences); // end of clause |
| 1524 | *n_ph = 0; |
| 1525 | } |
| 1526 | |
| 1527 | return 0; // finished the phoneme list |
| 1528 | } |
| 1529 | |
| 1530 | int SpeakNextClausecxx . . $ SpeakNextClause(7864480464b09eea).(int control) |
| 1531 | { |
| 1532 | // Speak text from memory (text_in) |
| 1533 | // control 0: start |
| 1534 | // text_in is set |
| 1535 | |
| 1536 | // The other calls have text_in = NULL |
| 1537 | // control 1: speak next text |
| 1538 | // 2: stop |
| 1539 | |
| 1540 | int clause_tone; |
| 1541 | char *voice_change; |
| 1542 | |
| 1543 | if (control == 2) { |
| 1544 | // stop speaking |
| 1545 | n_phoneme_listcxx . . $ n_phoneme_list. = 0; |
| 1546 | WcmdqStop(); |
| 1547 | |
| 1548 | return 0; |
| 1549 | } |
| 1550 | |
| 1551 | if (text_decoder_eof(p_decoder)) { |
| 1552 | skipping_text = false; |
| 1553 | return 0; |
| 1554 | } |
| 1555 | |
| 1556 | SelectPhonemeTable(voice->phoneme_tab_ix); |
| 1557 | |
| 1558 | // read the next clause from the input text file, translate it, and generate |
| 1559 | // entries in the wavegen command queue |
| 1560 | TranslateClause(translator, &clause_tone, &voice_change); |
| 1561 | |
| 1562 | CalcPitches(translator, clause_tone); |
| 1563 | CalcLengths(translator); |
| 1564 | |
| 1565 | if ((option_phonemes & 0xf) || (phoneme_callbackcxx . . $ phoneme_callback. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) { |
| 1566 | const char *phon_out; |
| 1567 | phon_out = GetTranslatedPhonemeString(option_phonemes); |
| 1568 | if (option_phonemes & 0xf) |
| 1569 | fprintf(f_trans, "%s\n", phon_out); |
| 1570 | if (phoneme_callbackcxx . . $ phoneme_callback. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 1571 | phoneme_callbackcxx . . $ phoneme_callback.(phon_out); |
| 1572 | } |
| 1573 | |
| 1574 | if (skipping_text) { |
| 1575 | n_phoneme_listcxx . . $ n_phoneme_list. = 0; |
| 1576 | return 1; |
| 1577 | } |
| 1578 | |
| 1579 | Generatecxx . . $ Generate(4116149b899eea69).(phoneme_listcxx . . $ phoneme_list., &n_phoneme_listcxx . . $ n_phoneme_list., 0); |
| 1580 | |
| 1581 | if (voice_change != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 1582 | // voice change at the end of the clause (i.e. clause was terminated by a voice change) |
| 1583 | new_voicecxx . . $ new_voice. = LoadVoiceVariant(voice_change, 0); // add a Voice instruction to wavegen at the end of the clause |
| 1584 | } |
| 1585 | |
| 1586 | if (new_voicecxx . . $ new_voice.) { |
| 1587 | // finished the current clause, now change the voice if there was an embedded |
| 1588 | // change voice command at the end of it (i.e. clause was broken at the change voice command) |
| 1589 | DoVoiceChangecxx . . $ DoVoiceChange(879fb63f5b5c051).(voice); |
| 1590 | new_voicecxx . . $ new_voice. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1591 | } |
| 1592 | |
| 1593 | return 1; |
| 1594 | } |
| 1595 | |
| 1596 | #pragma GCC visibility push(default) |
| 1597 | ESPEAK_APIcxx . . $ `external/espeak/speak_lib.h:38:9`! void espeak_SetPhonemeCallbackcxx . . $ espeak_SetPhonemeCallback(888b47490eab1aa9).(int (*PhonemeCallback)(const char *)) |
| 1598 | { |
| 1599 | phoneme_callbackcxx . . $ phoneme_callback. = PhonemeCallback; |
| 1600 | } |
| 1601 | #pragma GCC visibility pop |