| 1 | #ifndef _SpeechSynthesizer_h_ |
| 2 | #define _SpeechSynthesizer_h_ |
| 3 | /* SpeechSynthesizer.h |
| 4 | * |
| 5 | * Copyright (C) 2011-2013,2015-2023 David Weenink, 2015,2023,2024 Paul Boersma |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "Sound.h" |
| 22 | #include "TextGrid.h" // also for Table |
| 23 | |
| 24 | #define SpeechSynthesizer_PHONEMECODINGS_IPA 2 |
| 25 | #define SpeechSynthesizer_PHONEMECODINGS_KIRSHENBAUM 1 |
| 26 | #define SpeechSynthesizer_INPUT_TEXTONLY 1 |
| 27 | #define SpeechSynthesizer_INPUT_PHONEMESONLY 2 |
| 28 | #define SpeechSynthesizer_INPUT_TAGGEDTEXT 3 |
| 29 | |
| 30 | #include "SpeechSynthesizer_def.h" |
| 31 | |
| 32 | autoSpeechSynthesizer SpeechSynthesizer_create (conststring32 languageName, conststring32 voiceName); |
| 33 | |
| 34 | void SpeechSynthesizer_setTextInputSettings (SpeechSynthesizer me, int inputTextFormat, int inputPhonemeCoding); |
| 35 | |
| 36 | void SpeechSynthesizer_setEstimateSpeechRateFromSpeech (SpeechSynthesizer me, bool estimate); |
| 37 | |
| 38 | void SpeechSynthesizer_setSpeechOutputSettings (SpeechSynthesizer me, double samplingFrequency, double wordgap, double pitchAdjustment, double pitchRange, double wordsPerMinute, int outputPhonemeCodes); |
| 39 | |
| 40 | autoSound SpeechSynthesizer_to_Sound (SpeechSynthesizer me, conststring32 text, autoTextGrid *tg, autoTable *events); |
| 41 | |
| 42 | void SpeechSynthesizer_playText (SpeechSynthesizer me, conststring32 text); |
| 43 | |
| 44 | autostring32 SpeechSynthesizer_getPhonemesFromText (SpeechSynthesizer me, conststring32 text, bool separateBySpaces); |
| 45 | |
| 46 | /* |
| 47 | For general use. |
| 48 | */ |
| 49 | extern STRVEC theSpeechSynthesizerLanguageNames; |
| 50 | extern STRVEC theSpeechSynthesizerVoiceNames; |
| 51 | |
| 52 | /* |
| 53 | For developers mainly. |
| 54 | */ |
| 55 | extern Table theSpeechSynthesizerLanguagePropertiesTable; |
| 56 | extern Table theSpeechSynthesizerVoicePropertiesTable; |
| 57 | |
| 58 | /* |
| 59 | Create the eSpeak-Praat-FileInMemorySet and the four other objects mentioned above. |
| 60 | */ |
| 61 | void classSpeechSynthesizer_initClass (); |
| 62 | |
| 63 | /* |
| 64 | Try to change the language name, the voice name and/or the phoneme set name if any of these are not in the list. |
| 65 | This also translates ISO 639 language codes (or family/language combinations), |
| 66 | and fixes capitalization of the first letter. |
| 67 | Examples of language names: |
| 68 | en -> English (Great Britain) // obsolete |
| 69 | gmw/nl -> Dutch // ISO 639 family/language code (if identical to the eSpeak-internal code) |
| 70 | nl -> Dutch // ISO 639 language code |
| 71 | Examples of voice names: |
| 72 | f1 -> Female1 // obsolete |
| 73 | female1 -> Female1 // capitalization |
| 74 | The following "centric" ones are obsolete nowadays in eSpeak, but will still map in case any ancient Praat scripts use them: |
| 75 | Default -> English (Great Britain) // obsolete |
| 76 | default -> Male1 // obsolete |
| 77 | */ |
| 78 | void SpeechSynthesizer_checkAndRepairLanguageAndVoiceNames (SpeechSynthesizer me); |
| 79 | |
| 80 | /* End of file SpeechSynthesizer.h */ |
| 81 | #endif |