1 /* SpeechSynthesizer_def.h
2  *
3  * Copyright (C) 2011-2020 David Weenink
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or (at
8  * your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #define ooSTRUCT EspeakVoice
21 oo_DEFINE_CLASS (EspeakVoice, Daata)
22 	oo_STRING (v_name) // maximum 39 characters + 1 0-byte
23 	oo_STRING (language_name) // maximum 19 characters + 1 0-byte
24 
25 	oo_INTEGER (phoneme_tab_ix)  // phoneme table number
26 	oo_INTEGER (pitch_base)    // Hz
27 	oo_INTEGER (pitch_range)   // Hz
28 
29 	oo_INTEGER (speedf1)
30 	oo_INTEGER (speedf2)
31 	oo_INTEGER (speedf3)
32 
33 	oo_INTEGER (speed_percent)      // adjust the WPM speed by this percentage
34 	oo_INTEGER (flutter)
35 	oo_INTEGER (roughness)
36 	oo_INTEGER (echo_delay)
37 	oo_INTEGER (echo_amp)
38 	oo_INTEGER (n_harmonic_peaks)  // highest formant which is formed from adding harmonics
39 	oo_INTEGER (peak_shape)        // alternative shape for formant peaks (0=standard 1=squarer)
40 	oo_INTEGER (voicing)           // 100% = 64, level of formant-synthesized sound
41 	oo_INTEGER (formant_factor)      // adjust nominal formant frequencies by this  because of the voice's pitch (256ths)
42 	oo_INTEGER (consonant_amp)     // amplitude of unvoiced consonants
43 	oo_INTEGER (consonant_ampv)    // amplitude of the noise component of voiced consonants
44 	oo_INTEGER (samplerate)			// sampling frequency as integer Hz
45 	oo_INTEGER (numberOfKlattParameters) // default 8
46 	oo_INTVEC (klattv, numberOfKlattParameters)
47 
48 	// parameters used by Wavegen
49 	oo_INTEGER (numberOfFormants) // 9
50 	oo_INTVEC (freq, numberOfFormants)		// (short) 100% = 256
51 	oo_INTVEC (height, numberOfFormants)	// (short) 100% = 256
52 	oo_INTVEC (width, numberOfFormants)		// (short) 100% = 256
53 	oo_INTVEC (freqadd, numberOfFormants)	// (short) Hz
54 
55 	// copies without temporary adjustments from embedded commands
56 	oo_INTVEC (freq2, numberOfFormants)		// (short) 100% = 256
57 	oo_INTVEC (height2, numberOfFormants)	// (short) 100% = 256
58 	oo_INTVEC (width2, numberOfFormants)	// (short) 100% = 256
59 
60 	oo_INTVEC (breath, numberOfFormants)	// (int64) amount of breath for each formant. breath [0] indicates whether any are set.
61 	oo_INTVEC (breathw, numberOfFormants)	// width of each breath formant
62 	oo_INTEGER (numberOfToneAdjusts)
63 	oo_BYTEVEC (tone_adjust, numberOfToneAdjusts)
64 
65 oo_END_CLASS (EspeakVoice)
66 #undef ooSTRUCT
67 
68 
69 #define ooSTRUCT SpeechSynthesizer
70 oo_DEFINE_CLASS (SpeechSynthesizer, Daata)
71 
72 	oo_FROM (1)
73 		oo_STRING (d_synthesizerVersion)
74 	oo_ENDFROM
75 
76 	// sythesizers language /voice
77 	oo_STRING (d_languageName)
78 	oo_STRING (d_voiceName)
79 
80 	oo_FROM (1)
81 		oo_STRING (d_phonemeSet)
82 	oo_ENDFROM
83 	#if oo_READING
84 		oo_VERSION_UNTIL (1)
85 			d_phonemeSet = Melder_dup (d_languageName.get());
86 			d_synthesizerVersion = Melder_dup (ESPEAK_NG_VERSION);
87 			oo_INTEGER (d_wordsPerMinute)
88 		oo_VERSION_ELSE
89 			oo_DOUBLE (d_wordsPerMinute)
90 		oo_VERSION_END
91 	#else
92 		oo_DOUBLE (d_wordsPerMinute)
93 	#endif
94 	// text-only, phonemes-only, mixed
95 	oo_INT (d_inputTextFormat)
96 	// 1/: output phonemes in espeak/ notation
97 	oo_INT (d_inputPhonemeCoding)
98 	// speech output
99 	oo_DOUBLE (d_samplingFrequency)
100 	oo_DOUBLE (d_wordGap)
101 	oo_DOUBLE (d_pitchAdjustment)
102 	oo_DOUBLE (d_pitchRange)
103 	// 1/2: output phonemes in espeak/IPA notation
104 	oo_INT (d_outputPhonemeCoding)
105 
106 	#if oo_READING_TEXT
107 		oo_VERSION_UNTIL (1)
108 			oo_INT (d_estimateSpeechRate)   // this used to be oo_BOOL, which was written in text as 0 or 1, which is inappropriate for boolean text
109 		oo_VERSION_ELSE
110 			oo_QUESTION (d_estimateSpeechRate)
111 		oo_VERSION_END
112 	#else
113 		oo_QUESTION (d_estimateSpeechRate)
114 	#endif
115 
116 	#if ! oo_READING && ! oo_WRITING
117 		// Filled by the callback
118 		oo_OBJECT (Table, 0, d_events)
119 		oo_DOUBLE (d_internalSamplingFrequency)
120 		oo_INTEGER (d_numberOfSamples)
121 		oo_INTEGER (d_wavCapacity)
122 		oo_INTVEC16 (d_wav, d_wavCapacity)
123 	#endif
124 
125 	#if oo_DECLARING
126 		void v_info ()
127 			override;
128 	#endif
129 
130 oo_END_CLASS (SpeechSynthesizer)
131 #undef ooSTRUCT
132 
133 /* End of file SpeechSynthesizer_def.h */
134