| 1 | /* |
| 2 | * Copyright (C) 2005 to 2007 by Jonathan Duddington |
| 3 | * email: [email protected] |
| 4 | * Copyright (C) 2015 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_VOICE_H |
| 21 | #define ESPEAK_NG_VOICE_Hcxx . . $ `external/espeak/voice.h:21:9`! |
| 22 | |
| 23 | #include "espeak_ng.h"cxx . . $ `<file>/external/espeak/espeak_ng.h`/ |
| 24 | |
| 25 | #include "mnemonics.h"cxx . . $ `<file>/external/espeak/mnemonics.h`/ |
| 26 | #include "translate.h"cxx . . $ `<file>/external/espeak/translate.h`/ |
| 27 | |
| 28 | #include "FileInMemory.h"cxx . . $ `<file>/dwsys/FileInMemory.h`/ |
| 29 | |
| 30 | #ifdef __cpluspluscxx . . $ `<built-in>:470:9`! |
| 31 | extern "C" |
| 32 | { |
| 33 | #endif |
| 34 | |
| 35 | #define N_PEAKScxx . . $ `external/espeak/voice.h:35:9`! 9 |
| 36 | |
| 37 | typedef struct { |
| 38 | char v_name[40]; |
| 39 | char language_name[20]; |
| 40 | |
| 41 | int phoneme_tab_ix; // phoneme table number |
| 42 | int pitch_base; // Hz<<12 |
| 43 | int pitch_range; // standard = 0x1000 |
| 44 | |
| 45 | int speedf1; |
| 46 | int speedf2; |
| 47 | int speedf3; |
| 48 | |
| 49 | int speed_percent; // adjust the WPM speed by this percentage |
| 50 | int flutter; |
| 51 | int roughness; |
| 52 | int echo_delay; |
| 53 | int echo_amp; |
| 54 | int n_harmonic_peaks; // highest formant which is formed from adding harmonics |
| 55 | int peak_shape; // alternative shape for formant peaks (0=standard 1=squarer) |
| 56 | int voicing; // 100% = 64, level of formant-synthesized sound |
| 57 | int formant_factor; // adjust nominal formant frequencies by this because of the voice's pitch (256ths) |
| 58 | int consonant_amp; // amplitude of unvoiced consonants |
| 59 | int consonant_ampv; // amplitude of the noise component of voiced consonants |
| 60 | int samplerate; |
| 61 | int klattv[8]; |
| 62 | |
| 63 | // parameters used by Wavegen |
| 64 | short freq[N_PEAKScxx . . $ `external/espeak/voice.h:35:9`!]; // 100% = 256 |
| 65 | short height[N_PEAKScxx . . $ `external/espeak/voice.h:35:9`!]; // 100% = 256 |
| 66 | short width[N_PEAKScxx . . $ `external/espeak/voice.h:35:9`!]; // 100% = 256 |
| 67 | short freqadd[N_PEAKScxx . . $ `external/espeak/voice.h:35:9`!]; // Hz |
| 68 | |
| 69 | // copies without temporary adjustments from embedded commands |
| 70 | short freq2[N_PEAKScxx . . $ `external/espeak/voice.h:35:9`!]; // 100% = 256 |
| 71 | short height2[N_PEAKScxx . . $ `external/espeak/voice.h:35:9`!]; // 100% = 256 |
| 72 | |
| 73 | int breath[N_PEAKScxx . . $ `external/espeak/voice.h:35:9`!]; // amount of breath for each formant. breath[0] indicates whether any are set. |
| 74 | int breathw[N_PEAKScxx . . $ `external/espeak/voice.h:35:9`!]; // width of each breath formant |
| 75 | |
| 76 | // This table provides the opportunity for tone control. |
| 77 | // Adjustment of harmonic amplitudes, steps of 8Hz |
| 78 | // value of 128 means no change |
| 79 | #define N_TONE_ADJUSTcxx . . $ `external/espeak/voice.h:79:10`! 1000 |
| 80 | unsigned char tone_adjust[N_TONE_ADJUSTcxx . . $ `external/espeak/voice.h:79:10`!]; // 8Hz steps * 1000 = 8kHz |
| 81 | |
| 82 | } voice_t; |
| 83 | |
| 84 | extern voice_t *voice; |
| 85 | extern int tone_points[12]; |
| 86 | |
| 87 | typedef enum { |
| 88 | V_NAME = 1, |
| 89 | V_LANGUAGE, |
| 90 | V_GENDER, |
| 91 | V_PHONEMES, |
| 92 | V_DICTIONARY, |
| 93 | V_VARIANTS, |
| 94 | |
| 95 | V_MAINTAINER, |
| 96 | V_STATUS, |
| 97 | |
| 98 | // these affect voice quality, are independent of language |
| 99 | V_FORMANT, |
| 100 | V_PITCH, |
| 101 | V_ECHO, |
| 102 | V_FLUTTER, |
| 103 | V_ROUGHNESS, |
| 104 | V_CLARITY, |
| 105 | V_TONE, |
| 106 | V_VOICING, |
| 107 | V_BREATH, |
| 108 | V_BREATHW, |
| 109 | |
| 110 | // these override defaults set by the translator |
| 111 | V_LOWERCASE_SENTENCE, |
| 112 | V_WORDGAP, |
| 113 | V_INTONATION, |
| 114 | V_TUNES, |
| 115 | V_SPELLINGSTRESS, |
| 116 | V_STRESSLENGTH, |
| 117 | V_STRESSAMP, |
| 118 | V_STRESSADD, |
| 119 | V_DICTRULES, |
| 120 | V_STRESSRULE, |
| 121 | V_STRESSOPT, |
| 122 | V_NUMBERS, |
| 123 | |
| 124 | V_MBROLA, |
| 125 | V_KLATT, |
| 126 | V_FAST, |
| 127 | V_SPEED, |
| 128 | V_DICTMIN, |
| 129 | |
| 130 | // these need a phoneme table to have been specified |
| 131 | V_REPLACE, |
| 132 | V_CONSONANTS |
| 133 | } VOICELANGATTRIBUTES; |
| 134 | |
| 135 | static const MNEM_TAB langopts_tab[] = { |
| 136 | { "apostrophe", 0x100+LOPT_APOSTROPHEcxx . . $ `external/espeak/translate.h:348:9`! }, |
| 137 | { "brackets", 0x100+LOPT_BRACKET_PAUSEcxx . . $ `external/espeak/translate.h:335:9`! }, |
| 138 | { "bracketsAnnounced", 0x100+LOPT_BRACKET_PAUSE_ANNOUNCEDcxx . . $ `external/espeak/translate.h:351:9`! }, |
| 139 | { "dict_min", V_DICTMIN }, |
| 140 | { "dictrules", V_DICTRULES }, |
| 141 | { "intonation", V_INTONATION }, |
| 142 | { "l_dieresis", 0x100+LOPT_DIERESEScxx . . $ `external/espeak/translate.h:287:9`! }, |
| 143 | { "l_prefix", 0x100+LOPT_PREFIXEScxx . . $ `external/espeak/translate.h:293:9`! }, |
| 144 | { "l_regressive_v", 0x100+LOPT_REGRESSIVE_VOICINGcxx . . $ `external/espeak/translate.h:302:9`! }, |
| 145 | { "l_unpronouncable", 0x100+LOPT_UNPRONOUNCABLEcxx . . $ `external/espeak/translate.h:305:9`! }, |
| 146 | { "l_sonorant_min", 0x100+LOPT_SONORANT_MINcxx . . $ `external/espeak/translate.h:308:9`! }, |
| 147 | { "lowercaseSentence", V_LOWERCASE_SENTENCE }, |
| 148 | { "numbers", V_NUMBERS }, |
| 149 | { "spellingStress", V_SPELLINGSTRESS }, |
| 150 | { "stressAdd", V_STRESSADD }, |
| 151 | { "stressAmp", V_STRESSAMP }, |
| 152 | { "stressLength", V_STRESSLENGTH }, |
| 153 | { "stressOpt", V_STRESSOPT }, |
| 154 | { "stressRule", V_STRESSRULE }, |
| 155 | { "tunes", V_TUNES }, |
| 156 | { "words", V_WORDGAP }, |
| 157 | |
| 158 | { NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0 } |
| 159 | }; |
| 160 | |
| 161 | static const MNEM_TAB keyword_tab[] = { |
| 162 | { "name", V_NAME }, |
| 163 | { "language", V_LANGUAGE }, |
| 164 | { "gender", V_GENDER }, |
| 165 | { "variants", V_VARIANTS }, |
| 166 | { "formant", V_FORMANT }, |
| 167 | { "pitch", V_PITCH }, |
| 168 | { "phonemes", V_PHONEMES }, |
| 169 | { "dictionary", V_DICTIONARY }, |
| 170 | { "replace", V_REPLACE }, |
| 171 | { "echo", V_ECHO }, |
| 172 | { "flutter", V_FLUTTER }, |
| 173 | { "roughness", V_ROUGHNESS }, |
| 174 | { "clarity", V_CLARITY }, |
| 175 | { "tone", V_TONE }, |
| 176 | { "voicing", V_VOICING }, |
| 177 | { "breath", V_BREATH }, |
| 178 | { "breathw", V_BREATHW }, |
| 179 | { "mbrola", V_MBROLA }, |
| 180 | { "consonants", V_CONSONANTS }, |
| 181 | { "klatt", V_KLATT }, |
| 182 | { "fast_test2", V_FAST }, |
| 183 | { "speed", V_SPEED }, |
| 184 | |
| 185 | |
| 186 | { "maintainer", V_MAINTAINER }, |
| 187 | { "status", V_STATUS }, |
| 188 | |
| 189 | { NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0 } |
| 190 | }; |
| 191 | |
| 192 | const char *SelectVoice(espeak_VOICEcxx . . $ espeak_VOICE# *voice_select, int *found); |
| 193 | espeak_VOICEcxx . . $ espeak_VOICE# *SelectVoiceByName(espeak_VOICEcxx . . $ espeak_VOICE# **voices, const char *name); |
| 194 | voice_t *LoadVoice(const char *voice_name, int control); |
| 195 | voice_t *LoadVoiceVariant(const char *voice_name, int variant); |
| 196 | espeak_ng_STATUS DoVoiceChange(voice_t *v); |
| 197 | void WavegenSetVoice(voice_t *v); |
| 198 | void ReadNumbers(char *p, int *flags, int maxValue, const MNEM_TAB *keyword_tab, int key); |
| 199 | int Read8Numbers(char *data_in, int data[8]); |
| 200 | void ReadTonePoints(char *string, int *tone_pts); |
| 201 | void VoiceReset(int control); |
| 202 | void FreeVoiceList(void); |
| 203 | |
| 204 | /* |
| 205 | The following four declaration are needed for espeak_io.cpp |
| 206 | */ |
| 207 | extern int n_voices_list; |
| 208 | #define N_VOICES_LISTcxx . . $ `external/espeak/voice.h:208:9`! 350 |
| 209 | extern espeak_VOICEcxx . . $ espeak_VOICE# *voices_list [N_VOICES_LISTcxx . . $ `external/espeak/voice.h:208:9`!]; |
| 210 | espeak_VOICEcxx . . $ espeak_VOICE# *ReadVoiceFile (FileInMemorycxx . . $ FileInMemory# f_in, const char *fname, int is_language_file); |
| 211 | |
| 212 | #ifdef __cpluspluscxx . . $ `<built-in>:470:9`! |
| 213 | } |
| 214 | #endif |
| 215 | |
| 216 | #endif |