Debian Codegraph @

dwtools/KlattGrid.cpp

raw symbols SCIP
1 /* KlattGrid.cpp
2 *
3 * Copyright (C) 2008-2023 David Weenink, 2015,2017,2022-2026 Paul Boersma
4 *
5 * This code 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 3 of the License, or (at
8 * your option) any later version.
9 *
10 * This code 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 work. If not, see <http://www.gnu.org/licenses/>.
17 */
18 /*
19 djmw 20080917 Initial version
20 djmw 20090109 Add formulas for formant frequencies and bandwidths.
21 djmw 20090123 Add PlayOptions.
22 djmw 20090129 KlattGrid_draw text in boxes displays better
23 djmw 20090311 Add RealTier_valuesInRange
24 djmw 20090312 Add klattGrid_addFormantAndBandwidthTier
25 djmw 20090326 Changed DBSPL_to_A into DB_to_A for bypass and formant amplitudes.
26 djmw 20100223 Removed gsl dependency
27 djmw 20110304 Thing_new
28 djmw 20110308 struc connections -> struct structconnections
29 djmw 20110329 Table_get(Numeric|String)Value is now Table_get(Numeric|String)Value_Assert
30 djmw 20111011 Sound_VocalTractGrid_CouplingGrid_filter_cascade: group warnings
31 */
32
33 #include "FormantGrid_extensions.h"cxx . . $ `<file>/dwtools/FormantGrid_extensions.h`/
34 #include "Formula.h"cxx . . $ `<file>/sys/Formula.h`/
35 #include "Graphics_extensions.h"cxx . . $ `<file>/dwsys/Graphics_extensions.h`/
36 #include "KlattGrid.h"cxx . . $ `<file>/dwtools/KlattGrid.h`/
37 #include "KlattTable.h"cxx . . $ `<file>/dwtools/KlattTable.h`/
38 #include "Resonator.h"cxx . . $ `<file>/dwtools/Resonator.h`/
39 #include "Pitch_to_PitchTier.h"cxx . . $ `<file>/fon/Pitch_to_PitchTier.h`/
40 #include "PitchTier_to_Sound.h"cxx . . $ `<file>/fon/PitchTier_to_Sound.h`/
41 #include "PitchTier_to_PointProcess.h"cxx . . $ `<file>/fon/PitchTier_to_PointProcess.h`/
42 #include "NUM2.h"cxx . . $ `<file>/dwsys/NUM2.h`/
43 #include "Sound_to_Formant.h"cxx . . $ `<file>/fon/Sound_to_Formant.h`/
44 #include "Sound_to_Intensity.h"cxx . . $ `<file>/fon/Sound_to_Intensity.h`/
45 #include "Sound_to_Pitch.h"cxx . . $ `<file>/fon/Sound_to_Pitch.h`/
46
47 #include "oo_DESTROY.h"cxx . . $ `<file>/sys/oo_DESTROY.h`/
48 #include "KlattGrid_def.h"cxx . . $ `<file>/dwtools/KlattGrid_def.h`/
49 #include "oo_COPY.h"cxx . . $ `<file>/sys/oo_COPY.h`/
50 #include "KlattGrid_def.h"cxx . . $ `<file>/dwtools/KlattGrid_def.h`/
51 #include "oo_EQUAL.h"cxx . . $ `<file>/sys/oo_EQUAL.h`/
52 #include "KlattGrid_def.h"cxx . . $ `<file>/dwtools/KlattGrid_def.h`/
53 #include "oo_CAN_WRITE_AS_ENCODING.h"cxx . . $ `<file>/sys/oo_CAN_WRITE_AS_ENCODING.h`/
54 #include "KlattGrid_def.h"cxx . . $ `<file>/dwtools/KlattGrid_def.h`/
55 #include "oo_WRITE_TEXT.h"cxx . . $ `<file>/sys/oo_WRITE_TEXT.h`/
56 #include "KlattGrid_def.h"cxx . . $ `<file>/dwtools/KlattGrid_def.h`/
57 #include "oo_WRITE_BINARY.h"cxx . . $ `<file>/sys/oo_WRITE_BINARY.h`/
58 #include "KlattGrid_def.h"cxx . . $ `<file>/dwtools/KlattGrid_def.h`/
59 #include "oo_READ_TEXT.h"cxx . . $ `<file>/sys/oo_READ_TEXT.h`/
60 #include "KlattGrid_def.h"cxx . . $ `<file>/dwtools/KlattGrid_def.h`/
61 #include "oo_READ_BINARY.h"cxx . . $ `<file>/sys/oo_READ_BINARY.h`/
62 #include "KlattGrid_def.h"cxx . . $ `<file>/dwtools/KlattGrid_def.h`/
63 #include "oo_DESCRIPTION.h"cxx . . $ `<file>/sys/oo_DESCRIPTION.h`/
64 #include "KlattGrid_def.h"cxx . . $ `<file>/dwtools/KlattGrid_def.h`/
65
66
67 #include "enums_getText.h"cxx . . $ `<file>/melder/enums_getText.h`/
68 #include "KlattGrid_enums.h"cxx . . $ `<file>/dwtools/KlattGrid_enums.h`/
69 #include "enums_getValue.h"cxx . . $ `<file>/melder/enums_getValue.h`/
70 #include "KlattGrid_enums.h"cxx . . $ `<file>/dwtools/KlattGrid_enums.h`/
71
72 /*
73 * A KlattGrid consists of a great many tiers that can be independently modified.
74 *
75 * For any particular formant, the formant frequency tier and the formant bandwidth tier can only be added or removed jointly
76 * because they are part of a FormantGrid object. There will always be an equal number of formant frequency tiers and
77 * formant bandwidth tiers.
78 *
79 * For parallel synthesis we also need, besides the frequency and bandwidth tier, an additional amplitude tier for each formant.
80 * It is not necessary that there are an equal number of formant frequency tiers (nf) and amplitude tiers (na).
81 * During parallel synthesis we simply synthesize with min(nf,na) number of formants.
82 * These numbers nf and na can get out of sync because of the following (add, remove, replace) actions:
83 * - we replace a FormantGrid that has not the same number of tiers as the corresponding number of amplitude tiers
84 * - we remove/add a formant tier and a bandwidth tier together and not the corresponding amplitude tier
85 * - we remove/add an amplitude tier and not the corresponding formant&bandwidth tiers
86 *
87 * As of 20130113 the KlattGrid_addFormant (/remove) which also added automatically an amplitude tier has been split into two explicit actions
88 * KlattGrid_addFormantFrequencyAndBandwidth (/remove)
89 * KlattGrid_addFormantAmplitudeTier (/remove)
90 *
91 */
92
93 conststring32cxx . . $ conststring32# KlattGrid_getFormantNamecxx . . $ KlattGrid_getFormantName(362132ab0d943c60). (kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType) {
94 conststring32cxx . . $ conststring32# result;
95 if (formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::ORALcxx . . $ kKlattGridFormantType#ORAL.)
96 result = U"oral formant";
97 else if (formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::NASALcxx . . $ kKlattGridFormantType#NASAL.)
98 result = U"nasal formant";
99 else if (formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::FRICATIONcxx . . $ kKlattGridFormantType#FRICATION.)
100 result = U"frication Formant";
101 else if (formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::TRACHEALcxx . . $ kKlattGridFormantType#TRACHEAL.)
102 result = U"tracheal formant";
103 else if (formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::NASAL_ANTIcxx . . $ kKlattGridFormantType#NASAL_ANTI.)
104 result = U"nasal Antiformant";
105 else if (formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::TRACHEAL_ANTIcxx . . $ kKlattGridFormantType#TRACHEAL_ANTI.)
106 result = U"tracheal antiformant";
107 else if (formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::DELTAcxx . . $ kKlattGridFormantType#DELTA.)
108 result = U"delta formant";
109 else
110 result = U"unknown formant";
111 return result;
112 }
113
114 #define KlattGrid_OPENPHASE_DEFAULTcxx . . $ `dwtools/KlattGrid.cpp:114:9`! 0.7
115 #define KlattGrid_POWER1_DEFAULTcxx . . $ `dwtools/KlattGrid.cpp:115:9`! 3
116 #define KlattGrid_POWER2_DEFAULTcxx . . $ `dwtools/KlattGrid.cpp:116:9`! (KlattGrid_POWER1_DEFAULTcxx . . $ `dwtools/KlattGrid.cpp:115:9`!+1)
117
118 /* Amplitude scaling: maximum amplitude (-1,+1) corresponds to 91 dB */
119
120 /*static double NUMinterpolateLinear (double x1, double y1, double x2, double y2, double x)
121 {
122 if (y1 == y2) return y1;
123 if (x1 == x2) return undefined;
124 return (y2 - y1) * (x - x1) / (x2 - x1) + y1;
125 }*/
126
127 /*
128 Scales relative widths
129 E.g.
130 Before: relativeWidths = {1, 2, 3}, totalWidth = 10
131 After: relativeWidths = {2, 4, 6}, accumulatedWidths = {2, 6, 10}
132 */
133 static void scaleRelativeAndAccumulatedWidthscxx . . $ scaleRelativeAndAccumulatedWidths(d9ca4354eebefd12). (VECcxx . . $ VEC# relativeWidths, VECcxx . . $ VEC# const& accumulatedWidths, double totalWidth) {
134 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (relativeWidths.size == accumulatedWidths.size);
135 double rsum = NUMsumcxx . . $ NUMsum(4bb9c3e3a8dd5442). (relativeWidthscxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd).);
136
137 if (rsum == 0.0)
138 return;
139
140 const double widthUnit = totalWidth / rsum;
141 double accumulatedWidth = 0.0;
142 for (integercxx . . $ integer# i = 1; i <= relativeWidths.sizecxx . . $ vector#size.; i ++) { // to absolute
143 relativeWidths [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] *= widthUnit;
144 accumulatedWidth += relativeWidths [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
145 accumulatedWidths [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] = accumulatedWidth;
146 }
147 }
148
149 static bool RealTier_valuesInRangecxx . . $ RealTier_valuesInRange(b021b2c1643d2d88). (RealTiercxx . . $ RealTier# me, double min, double max) {
150 for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.; i ++) {
151 const RealPointcxx . . $ RealPoint# p = mycxx . . $ `melder/melder.h:44:9`! pointscxx . . $ structRealTier#points..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i];
152 if (isdefinedcxx . . $ isdefined(f8197d536af80c96). (min) && p -> valuecxx . . $ structRealPoint#value. < min)
153 return false;
154 if (isdefinedcxx . . $ isdefined(f8197d536af80c96). (max) && p -> valuecxx . . $ structRealPoint#value. < max)
155 return false;
156 }
157 return true;
158 }
159
160 static double PointProcess_getPeriodAtIndexcxx . . $ PointProcess_getPeriodAtIndex(19efc67d561c65e2). (PointProcesscxx . . $ PointProcess# me, integercxx . . $ integer# it, double maximumPeriod) {
161 double period = undefinedcxx . . $ undefined.;
162 if (it >= 2) {
163 period = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).it] - mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).it - 1];
164 if (period > maximumPeriod)
165 period = undefinedcxx . . $ undefined.;
166 }
167 if (isundefcxx . . $ isundef(f8197d536af80c96). (period)) {
168 if (it < mycxx . . $ `melder/melder.h:44:9`! ntcxx . . $ structPointProcess#nt.) {
169 period = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).it + 1] - mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).it];
170 if (period > maximumPeriod)
171 period = undefinedcxx . . $ undefined.;
172 }
173 }
174 // undefined can only occur for a single isolated pulse.
175 return period;
176 }
177
178 #define UPDATE_TIERcxx . . $ `dwtools/KlattGrid.cpp:178:9`! \
179 RealTier_addPoint (thee.get(), mytime, myvalue); \
180 lasttime = mytime; \
181 myindex ++; \
182 if (myindex <= numberOfValues) { \
183 mypoint = mycxx . . $ `melder/melder.h:44:9`! points.at [myindex]; \
184 mytime = mypoint -> number; \
185 myvalue = mypoint -> value;\
186 } else { \
187 mytime = mycxx . . $ `melder/melder.h:44:9`! xmax; \
188 }
189
190 static autoRealTiercxx . . $ autoRealTier# RealTier_updateWithDeltacxx . . $ RealTier_updateWithDelta(43cbe50096b5b09d). (RealTiercxx . . $ RealTier# me, RealTiercxx . . $ RealTier# delta, PhonationTier glottis, double openglottis_fadeFraction) {
191 try {
192 integercxx . . $ integer# myindex = 1;
193 RealPointcxx . . $ RealPoint# mypoint = mycxx . . $ `melder/melder.h:44:9`! pointscxx . . $ structRealTier#points..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).myindex];
194 const integercxx . . $ integer# numberOfValues = mycxx . . $ `melder/melder.h:44:9`! pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.;
195 double mytime = mypoint -> numbercxx . . $ structSimpleDouble#number.;
196 double myvalue = mypoint -> valuecxx . . $ structRealPoint#value.;
197 double lasttime = mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin. - 0.001; // sometime before xmin
198 autoRealTiercxx . . $ autoRealTier# thee = RealTier_createcxx . . $ RealTier_create(8e3ec305798a9b8e). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax.);
199
200 if (openglottis_fadeFraction <= 0.0)
201 openglottis_fadeFraction = 0.0001;
202 if (openglottis_fadeFraction >= 0.5)
203 openglottis_fadeFraction = 0.4999;
204 for (integercxx . . $ integer# ipoint = 1; ipoint <= glottis -> points.sizecxx . . $ CollectionOf#size.; ipoint ++) {
205 const PhonationPoint point = glottis -> points.atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).ipoint];
206 const double t4 = point -> numbercxx . . $ structSimpleDouble#number.; // glottis closing
207 const double openDuration = point -> te;
208 const double t1 = t4 - openDuration;
209 const double t2 = t1 + openglottis_fadeFraction * openDuration;
210 const double t3 = t4 - openglottis_fadeFraction * openDuration;
211 /*
212 Add my points that lie before t1 and after previous t4.
213 */
214 while (mytime > lasttime && mytime < t1) {
215 UPDATE_TIERcxx . . $ `dwtools/KlattGrid.cpp:178:9`!
216 }
217 if (t2 > t1) {
218 // Set new value at t1
219 const double myvalue1 = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (me, t1);
220 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t1, myvalue1);
221 // Add my points between t1 and t2
222 while (mytime > lasttime && mytime < t2) {
223 const double dvalue = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (delta, mytime);
224 if (isdefinedcxx . . $ isdefined(f8197d536af80c96). (dvalue)) {
225 const double fraction = (mytime - t1) / (openglottis_fadeFraction * openDuration);
226 myvalue += dvalue * fraction;
227 }
228 UPDATE_TIERcxx . . $ `dwtools/KlattGrid.cpp:178:9`!
229 }
230 }
231
232 double myvalue2 = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (me, t2);
233 double dvalue = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (delta, t2);
234 if (isdefinedcxx . . $ isdefined(f8197d536af80c96). (dvalue))
235 myvalue2 += dvalue;
236 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t2, myvalue2);
237
238 // Add points between t2 and t3
239
240 while (mytime > lasttime && mytime < t3) {
241 dvalue = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (delta, mytime);
242 if (isdefinedcxx . . $ isdefined(f8197d536af80c96). (dvalue))
243 myvalue += dvalue;
244 UPDATE_TIERcxx . . $ `dwtools/KlattGrid.cpp:178:9`!
245 }
246
247 // set new value at t3
248
249 double myvalue3 = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (me, t3);
250 dvalue = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (delta, t3);
251 if (isdefinedcxx . . $ isdefined(f8197d536af80c96). (dvalue)) {
252 myvalue3 += dvalue;
253 }
254 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t3, myvalue3);
255
256 if (t4 > t3) {
257 // Add my points between t3 and t4
258 while (mytime > lasttime && mytime < t4) {
259 dvalue = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (delta, mytime);
260 if (isdefinedcxx . . $ isdefined(f8197d536af80c96). (dvalue)) {
261 const double fraction = 1 - (mytime - t3) / (openglottis_fadeFraction * openDuration);
262 myvalue += dvalue * fraction;
263 }
264 UPDATE_TIERcxx . . $ `dwtools/KlattGrid.cpp:178:9`!
265 }
266
267 // Set new value at t4
268 const double myvalue4 = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (me, t4);
269 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t4, myvalue4);
270 }
271 }
272 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
273 } catch (MelderErrorcxx . . $ MelderError#) {
274 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not updated with delta.");
275 }
276 }
277
278 static bool FormantGrid_isFormantDefinedcxx . . $ FormantGrid_isFormantDefined(4af5946d6a620ee5). (FormantGridcxx . . $ FormantGrid# me, integercxx . . $ integer# iformant) {
279 // formant and bandwidth are always in sync
280 const RealTiercxx . . $ RealTier# ftier = mycxx . . $ `melder/melder.h:44:9`! formantscxx . . $ structFormantGrid#formants..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant];
281 const RealTiercxx . . $ RealTier# btier = mycxx . . $ `melder/melder.h:44:9`! bandwidthscxx . . $ structFormantGrid#bandwidths..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant];
282 return ftier -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0 and btier -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0;
283 }
284
285 static bool FormantGrid_Intensities_isFormantDefinedcxx . . $ FormantGrid_Intensities_isFormantDefined(e4481afef51e2311). (FormantGridcxx . . $ FormantGrid# me, OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* thee, integercxx . . $ integer# iformant) {
286 bool exists = false;
287 if (iformant <= mycxx . . $ `melder/melder.h:44:9`! formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size. && iformant <= mycxx . . $ `melder/melder.h:44:9`! bandwidthscxx . . $ structFormantGrid#bandwidths..sizecxx . . $ CollectionOf#size. && iformant <= thee->sizecxx . . $ CollectionOf#size.) {
288 const RealTiercxx . . $ RealTier# ftier = mycxx . . $ `melder/melder.h:44:9`! formantscxx . . $ structFormantGrid#formants..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant];
289 const RealTiercxx . . $ RealTier# btier = mycxx . . $ `melder/melder.h:44:9`! bandwidthscxx . . $ structFormantGrid#bandwidths..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant];
290 const IntensityTiercxx . . $ IntensityTier# atier = thycxx . . $ `melder/melder.h:45:9`! atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant];
291 exists = ( ftier -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0 && btier -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0 && atier -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0 );
292 }
293 return exists;
294 }
295
296 static void check_formantscxx . . $ check_formants(b76a3bd1263aa692). (integercxx . . $ integer# numberOfFormants, integercxx . . $ integer# *ifb, integercxx . . $ integer# *ife) {
297 if (numberOfFormants <= 0 || *ifb > numberOfFormants || *ife < *ifb || *ife < 1) {
298 *ife = 0; // overrules everything *ifb value is a don't care now
299 return;
300 }
301 if (*ifb <= 1)
302 *ifb = 1;
303 if (*ife > numberOfFormants)
304 *ife = numberOfFormants;
305 }
306
307 static autoSoundcxx . . $ autoSound# Sound_createEmptyMonocxx . . $ Sound_createEmptyMono(e34f441442c8776d). (double xmin, double xmax, double samplingFrequency) {
308 const integercxx . . $ integer# nt = Melder_iceilingcxx . . $ `melder/melder_ftoi.h:45:9`! ((xmax - xmin) * samplingFrequency);
309 const double dt = 1.0 / samplingFrequency;
310 const double tmid = (xmin + xmax) / 2.0;
311 const double t1 = tmid - 0.5 * (nt - 1) * dt;
312
313 return Sound_createcxx . . $ Sound_create(39ab106d6b9a0135). (1, xmin, xmax, nt, dt, t1);
314 }
315
316 static void _Sounds_add_inplacecxx . . $ _Sounds_add_inplace(3740d3b02ef916dc). (Soundcxx . . $ Sound# me, Soundcxx . . $ Sound# thee) {
317 for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.; i ++)
318 mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] += thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
319 }
320
321 static autoSoundcxx . . $ autoSound# _Sound_diffcxx . . $ _Sound_diff(c027fb02721117d5). (Soundcxx . . $ Sound# me, int scale) {
322 try {
323 autoSoundcxx . . $ autoSound# thee = Data_copycxx . . $ Data_copy(97a542a26794c80e). (me);
324
325 // extremum
326 double amax1 = -1.0e34, amax2 = amax1, val, pval = 0.0;
327 if (scale) {
328 for (integercxx . . $ integer# i = 1; i <= thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.; i ++) {
329 val = fabscxx . . $ fabs(fee4f1d22bc8e617). (thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i]);
330 if (val > amax1)
331 amax1 = val;
332 }
333 }
334 // x [n]-x [n-1]
335 for (integercxx . . $ integer# i = 1; i <= thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.; i ++) {
336 val = thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
337 thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] -= pval;
338 pval = val;
339 }
340 if (scale) {
341 for (integercxx . . $ integer# i = 1; i <= thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.; i ++) {
342 val = fabscxx . . $ fabs(fee4f1d22bc8e617). (thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i]);
343 if (val > amax2)
344 amax2 = val;
345 }
346 // scale
347 for (integercxx . . $ integer# i = 1; i <= thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.; i ++)
348 thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] *= amax1 / amax2;
349 }
350 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
351 } catch (MelderErrorcxx . . $ MelderError#) {
352 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not differenced.");
353 }
354 }
355
356 /*static void _Sounds_addDifferentiated_inplace (Sound me, Sound thee)
357 {
358 double pval = 0, dx = my dx;
359 for (integer i = 1; i <= my nx; i ++)
360 {
361 const double val = thy z [1] [i];
362 my z [1] [i] += (val - pval) / dx; // dx makes amplitude of dz/dt independent of sampling.
363 pval = val;
364 }
365 }*/
366
367 typedef struct structconnectionscxx . . $ structconnections# {
368 integercxx . . $ integer# numberOfConnectionscxx . . $ structconnections#numberOfConnections.;
369 autoVECcxx . . $ autoVEC# xcxx . . $ structconnections#x., ycxx . . $ structconnections#y.;
370 } *connectionscxx . . $ connections#;
371
372 static void connections_freecxx . . $ connections_free(5c23632b7bdbbe2b). (connectionscxx . . $ connections# me) {
373 if (! me)
374 return;
375 Melder_freecxx . . $ `melder/melder_alloc.h:38:9`! (me);
376 }
377
378 static connectionscxx . . $ connections# connections_createcxx . . $ connections_create(bd2eacb064a285e2). (integercxx . . $ integer# numberOfConnections) {
379 connectionscxx . . $ connections# me = 0;
380 try {
381 me = (connectionscxx . . $ connections#) Melder_calloccxx . . $ `melder/melder_alloc.h:34:9`! (structconnections, 1);
382 mycxx . . $ `melder/melder.h:44:9`! numberOfConnectionscxx . . $ structconnections#numberOfConnections. = numberOfConnections;
383 mycxx . . $ `melder/melder.h:44:9`! xcxx . . $ structconnections#x. =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). zero_VECcxx . . $ zero_VEC(e4395f764b859b1e). (numberOfConnections);
384 mycxx . . $ `melder/melder.h:44:9`! ycxx . . $ structconnections#y. =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). zero_VECcxx . . $ zero_VEC(e4395f764b859b1e). (numberOfConnections);
385 return me;
386 } catch (MelderErrorcxx . . $ MelderError#) {
387 connections_freecxx . . $ connections_free(5c23632b7bdbbe2b). (me);
388 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Connections not created.");
389 }
390 }
391
392 // Calculates the intersection point (xi,yi) of a line with a circle.
393 // The line starts at the origin and P (xp, yp) is on that line.
394 static void NUMcircle_radial_intersection_sqcxx . . $ NUMcircle_radial_intersection_sq(5d9ba02e38dab810). (double x, double y, double r, double xp, double yp, double *xi, double *yi) {
395 double dx = xp - x, dy = yp - y;
396 const double d = hypotcxx . . $ hypot(b71928d39fde4295). (dx, dy);
397 if (d > 0) {
398 *xi = x + dx * r / d;
399 *yi = y + dy * r / d;
400 } else {
401 *xi = *yi = undefinedcxx . . $ undefined.;
402 }
403 }
404
405 static void summer_drawcxx . . $ summer_draw(aae12790aeee6e05). (Graphicscxx . . $ Graphics# g, double x, double y, double r, bool alternating) {
406 Graphics_setLineWidthcxx . . $ Graphics_setLineWidth(2514a1c07b6be5e2). (g, 2);
407 Graphics_circlecxx . . $ Graphics_circle(8752bb7a78272ca7). (g, x, y, r);
408 const double dy = 3.0 * r / 4.0;
409 // + symbol
410 if (alternating)
411 y += r / 4.0;
412 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x, y + r / 2.0, x, y - r / 2.0);
413 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x - r / 2.0, y, x + r / 2.0, y);
414 if (alternating)
415 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x - r / 2.0, y - dy , x + r / 2.0, y - dy);
416 }
417
418 static void _summer_drawConnectionscxx . . $ _summer_drawConnections(746848d82b7b0149). (Graphicscxx . . $ Graphics# g, double x, double y, double r, connectionscxx . . $ connections# thee, bool arrow, bool alternating, double horizontalFraction) {
419 summer_drawcxx . . $ summer_draw(aae12790aeee6e05). (g, x, y, r, alternating);
420
421 for (integercxx . . $ integer# i = 1; i <= thycxx . . $ `melder/melder.h:45:9`! numberOfConnectionscxx . . $ structconnections#numberOfConnections.; i ++) {
422 const double yp = thycxx . . $ `melder/melder.h:45:9`! ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i];
423 double xto, yto, xp = thycxx . . $ `melder/melder.h:45:9`! xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i];
424 if (horizontalFraction > 0) {
425 const double dx = x - xp;
426 if (dx > 0) {
427 xp += horizontalFraction * dx;
428 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, thycxx . . $ `melder/melder.h:45:9`! xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i], yp, xp, yp);
429 }
430 }
431 NUMcircle_radial_intersection_sqcxx . . $ NUMcircle_radial_intersection_sq(5d9ba02e38dab810). (x, y, r, xp, yp, & xto, & yto);
432 if (isundefcxx . . $ isundef(f8197d536af80c96). (xto) || isundefcxx . . $ isundef(f8197d536af80c96). (yto))
433 continue;
434 if (arrow)
435 Graphics_arrowcxx . . $ Graphics_arrow(72bdb7937dbb13da). (g, xp, yp, xto, yto);
436 else
437 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, xp, yp, xto, yto);
438 }
439 }
440
441 static void summer_drawConnectionscxx . . $ summer_drawConnections(45f02620acd1b9a1). (Graphicscxx . . $ Graphics# g, double x, double y, double r, connectionscxx . . $ connections# thee, bool arrow, double horizontalFraction) {
442 _summer_drawConnectionscxx . . $ _summer_drawConnections(746848d82b7b0149). (g, x, y, r, thee, arrow, false, horizontalFraction);
443 }
444
445 static void alternatingSummer_drawConnectionscxx . . $ alternatingSummer_drawConnections(45f02620acd1b9a1). (Graphicscxx . . $ Graphics# g, double x, double y, double r, connectionscxx . . $ connections# thee, bool arrow, double horizontalFraction) {
446 _summer_drawConnectionscxx . . $ _summer_drawConnections(746848d82b7b0149). (g, x, y, r, thee, arrow, true, horizontalFraction);
447 }
448
449 static void drawLinesInBoxcxx . . $ drawLinesInBox(7482afdee92020f4). (Graphicscxx . . $ Graphics# g, double xmin, double xmax, double ymin, double ymax, constSTRVECcxx . . $ constSTRVEC# const& lines) {
450 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (lines.size > 0);
451 Graphics_rectanglecxx . . $ Graphics_rectangle(72bdb7937dbb13da). (g, xmin, xmax, ymin, ymax);
452 const double dy = (ymax - ymin) / lines.sizecxx . . $ _conststringvector#size.;
453 const double x = (xmax + xmin) / 2.0;
454 double y = ymax - 0.5 * dy;
455 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (g, Graphics_CENTREcxx . . $ `sys/Graphics.h:250:9`!, Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!);
456 for (integercxx . . $ integer# iline = 1; iline <= lines.sizecxx . . $ _conststringvector#size.; iline ++, y -= dy)
457 Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (g, x, y, lines [cxx . . $ _conststringvector#`operator[]`(2065423e0524e64a).iline]);
458 }
459
460 // Maximum amplitue (-1,1) at 93.97940008672037 dB
461 #define DBSPL_to_Acxx . . $ `dwtools/KlattGrid.cpp:461:9`!(x) (pow (10.0, x / 20.0) * 2.0e-5)
462 // Normal dB's
463 #define DB_to_Acxx . . $ `dwtools/KlattGrid.cpp:463:9`!(x) (pow (10.0, x / 20.0))
464
465 /************************ Sound & FormantGrid *********************************************/
466
467 static void _Sound_FormantGrid_filterWithOneFormant_inplacecxx . . $ _Sound_FormantGrid_filterWithOneFormant_inplace(60905d3b6f56d980). (Soundcxx . . $ Sound# me, FormantGridcxx . . $ FormantGrid# thee, integercxx . . $ integer# iformant, bool antiformant) {
468 if (iformant < 1 || iformant > thycxx . . $ `melder/melder.h:45:9`! formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.) {
469 Melder_warningcxx . . $ Melder_warning(6298c93241566110). (U"Formant ", iformant, U" does not exist.");
470 return;
471 }
472 const RealTiercxx . . $ RealTier# ftier = thycxx . . $ `melder/melder.h:45:9`! formantscxx . . $ structFormantGrid#formants..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant];
473 const RealTiercxx . . $ RealTier# btier = thycxx . . $ `melder/melder.h:45:9`! bandwidthscxx . . $ structFormantGrid#bandwidths..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant];
474 if (ftier -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. == 0 && btier -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. == 0)
475 return;
476 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (ftier -> points.size != 0 && btier -> points.size != 0,
477 U"Tier should not be empty,");
478 const double nyquist = 0.5 / mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx.;
479 autoFiltercxx . . $ autoFilter# rcxx . . $ autoSomeThing#autoSomeThing(49f6e7a06ebc5aa8).;
480 if (antiformant)
481 r =cxx . . $ autoSomeThing#`operator=`(ed6a1a4da6aedae3). AntiResonator_createcxx . . $ AntiResonator_create(473e4a3e2f0be5f0). (mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx.);
482 else
483 r =cxx . . $ autoSomeThing#`operator=`(ed6a1a4da6aedae3). Resonator_createcxx . . $ Resonator_create(15e8c0c410711d65). (mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx., true);
484
485 for (integercxx . . $ integer# is = 1; is <= mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.; is ++) {
486 const double t = mycxx . . $ `melder/melder.h:44:9`! x1cxx . . $ structSampled#x1. + (is - 1) * mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx.;
487 const double f = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (ftier, t);
488 const double b = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (btier, t);
489 if (f <= nyquist && isdefinedcxx . . $ isdefined(f8197d536af80c96). (b))
490 Filter_setCoefficientscxx . . $ Filter_setCoefficients(8c9469244f9d62e9). (r.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), f, b);
491 mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).is] = Filter_getOutputcxx . . $ Filter_getOutput(3b7ebd8f53a54cf6). (r.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).is]);
492 }
493 }
494
495 void Sound_FormantGrid_filterWithOneAntiFormant_inplacecxx . . $ Sound_FormantGrid_filterWithOneAntiFormant_inplace(50c20f85ac267a85). (Soundcxx . . $ Sound# me, FormantGridcxx . . $ FormantGrid# thee, integercxx . . $ integer# iformant) {
496 _Sound_FormantGrid_filterWithOneFormant_inplacecxx . . $ _Sound_FormantGrid_filterWithOneFormant_inplace(60905d3b6f56d980). (me, thee, iformant, true);
497 }
498
499 void Sound_FormantGrid_filterWithOneFormant_inplacecxx . . $ Sound_FormantGrid_filterWithOneFormant_inplace(50c20f85ac267a85). (Soundcxx . . $ Sound# me, FormantGridcxx . . $ FormantGrid# thee, integercxx . . $ integer# iformant) {
500 _Sound_FormantGrid_filterWithOneFormant_inplacecxx . . $ _Sound_FormantGrid_filterWithOneFormant_inplace(60905d3b6f56d980). (me, thee, iformant, false);
501 }
502
503 void Sound_FormantGrid_Intensities_filterWithOneFormant_inplacecxx . . $ Sound_FormantGrid_Intensities_filterWithOneFormant_inplace(f9fcc884e7918fa4). (Soundcxx . . $ Sound# me, FormantGridcxx . . $ FormantGrid# thee, OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* amplitudes, integercxx . . $ integer# iformant) {
504 try {
505 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (iformant > 0 && iformant <= thycxx . . $ `melder/melder.h:45:9`! formants.size, U"Formant ", iformant, U" not defined.");
506
507 const double nyquist = 0.5 / mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx.;
508
509 const RealTiercxx . . $ RealTier# ftier = thycxx . . $ `melder/melder.h:45:9`! formantscxx . . $ structFormantGrid#formants..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant];
510 const RealTiercxx . . $ RealTier# btier = thycxx . . $ `melder/melder.h:45:9`! bandwidthscxx . . $ structFormantGrid#bandwidths..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant];
511 const IntensityTiercxx . . $ IntensityTier# atier = amplitudes->atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant];
512
513 if (ftier -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. == 0 || btier -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. == 0 || atier -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. == 0)
514 return; // nothing to do
515 autoResonatorcxx . . $ autoResonator# r = Resonator_createcxx . . $ Resonator_create(15e8c0c410711d65). (mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx., false);
516 for (integercxx . . $ integer# is = 1; is <= mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.; is ++) {
517 const double t = mycxx . . $ `melder/melder.h:44:9`! x1cxx . . $ structSampled#x1. + (is - 1) * mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx.;
518 const double f = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (ftier, t);
519 const double b = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (btier, t);
520 if (f <= nyquist && isdefinedcxx . . $ isdefined(f8197d536af80c96). (b)) {
521 Filter_setCoefficientscxx . . $ Filter_setCoefficients(8c9469244f9d62e9). (r.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), f, b);
522 const double a = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (atier, t);
523 if (isdefinedcxx . . $ isdefined(f8197d536af80c96). (a))
524 r ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). acxx . . $ structFilter#a. *= DB_to_Acxx . . $ `dwtools/KlattGrid.cpp:463:9`! (a);
525 }
526 mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).is] = Filter_getOutputcxx . . $ Filter_getOutput(3b7ebd8f53a54cf6). (r.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).is]);
527 }
528 } catch (MelderErrorcxx . . $ MelderError#) {
529 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not filtered with one formant filter.");
530 }
531 }
532
533 autoSoundcxx . . $ autoSound# Sound_FormantGrid_Intensities_filtercxx . . $ Sound_FormantGrid_Intensities_filter(b5a7075cec170387). (Soundcxx . . $ Sound# me, FormantGridcxx . . $ FormantGrid# thee, OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* amplitudes, integercxx . . $ integer# iformantb, integercxx . . $ integer# iformante, int alternatingSign) {
534 try {
535 if (iformantb > iformante) {
536 iformantb = 1;
537 iformante = thycxx . . $ `melder/melder.h:45:9`! formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
538 }
539 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (iformantb > 0 && iformantb <= thycxx . . $ `melder/melder.h:45:9`! formants.size ,
540 U"From formant ", iformantb, U" not defined.");
541 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (iformante > 0 && iformante <= thycxx . . $ `melder/melder.h:45:9`! formants.size ,
542 U"To formant ", iformante, U" not defined.");
543
544 autoSoundcxx . . $ autoSound# him = Sound_createcxx . . $ Sound_create(39ab106d6b9a0135). (mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny., mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx., mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx., mycxx . . $ `melder/melder.h:44:9`! x1cxx . . $ structSampled#x1.);
545
546 for (integercxx . . $ integer# iformant = iformantb; iformant <= iformante; iformant ++) {
547 if (FormantGrid_Intensities_isFormantDefinedcxx . . $ FormantGrid_Intensities_isFormantDefined(e4481afef51e2311). (thee, amplitudes, iformant)) {
548 autoSoundcxx . . $ autoSound# tmp = Data_copycxx . . $ Data_copy(97a542a26794c80e). (me);
549 Sound_FormantGrid_Intensities_filterWithOneFormant_inplacecxx . . $ Sound_FormantGrid_Intensities_filterWithOneFormant_inplace(f9fcc884e7918fa4). (tmp.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), thee, amplitudes, iformant);
550 for (integercxx . . $ integer# is = 1; is <= mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.; is ++)
551 hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).is] += ( alternatingSign >= 0 ? tmp ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).is] : - tmp ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).is] );
552 if (alternatingSign != 0)
553 alternatingSign = - alternatingSign;
554 }
555 }
556 return himcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
557 } catch (MelderErrorcxx . . $ MelderError#) {
558 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not filtered.");
559 }
560 }
561
562 /********************* PhonationTier ************************/
563
564 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (PhonationPoint, AnyPoint, 0);
565
566 autoPhonationPoint PhonationPoint_createcxx . . $ PhonationPoint_create(50e17eda9fa30423). (double time, double period, double openPhase, double collisionPhase, double te, double power1, double power2, double pulseScale) {
567 try {
568 autoPhonationPoint me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (PhonationPoint);
569 mycxx . . $ `melder/melder.h:44:9`! numbercxx . . $ structSimpleDouble#number. = time;
570 mycxx . . $ `melder/melder.h:44:9`! period = period;
571 mycxx . . $ `melder/melder.h:44:9`! openPhase = openPhase;
572 mycxx . . $ `melder/melder.h:44:9`! collisionPhase = collisionPhase;
573 mycxx . . $ `melder/melder.h:44:9`! te = te;
574 mycxx . . $ `melder/melder.h:44:9`! power1 = power1;
575 mycxx . . $ `melder/melder.h:44:9`! power2 = power2;
576 mycxx . . $ `melder/melder.h:44:9`! pulseScale = pulseScale;
577 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
578 } catch (MelderErrorcxx . . $ MelderError#) {
579 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"PhonationPoint not created.");
580 }
581 }
582
583 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (PhonationTier, AnyTier, 0);
584
585 autoPhonationTier PhonationTier_createcxx . . $ PhonationTier_create(32c525becfbb2d10). (double tmin, double tmax) {
586 try {
587 autoPhonationTier me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (PhonationTier);
588 Function_initcxx . . $ Function_init(ac72a71dd6ac1bfb). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tmin, tmax);
589 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
590 } catch (MelderErrorcxx . . $ MelderError#) {
591 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"PhonationTier not created.");
592 }
593 }
594
595 autoPointProcesscxx . . $ autoPointProcess# PhonationTier_to_PointProcess_closurescxx . . $ PhonationTier_to_PointProcess_closures(9c5ff66da6d77826). (PhonationTier me) {
596 try {
597 const integercxx . . $ integer# nt = mycxx . . $ `melder/melder.h:44:9`! points.sizecxx . . $ CollectionOf#size.;
598 autoPointProcesscxx . . $ autoPointProcess# thee = PointProcess_createcxx . . $ PointProcess_create(7a858f446a8dd7cc). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., nt);
599 for (integercxx . . $ integer# ip = 1; ip <= nt; ip ++) {
600 const PhonationPoint fp = mycxx . . $ `melder/melder.h:44:9`! points.atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).ip];
601 PointProcess_addPointcxx . . $ PointProcess_addPoint(29f3b64796387061). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), fp -> numbercxx . . $ structSimpleDouble#number.);
602 }
603 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
604 } catch (MelderErrorcxx . . $ MelderError#) {
605 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no PointProcess with closure times created.");
606 }
607 }
608
609 /********************** PhonationGridPlayOptions **********************/
610
611 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (PhonationGridPlayOptions, Daata, 0);
612
613 static void PhonationGridPlayOptions_setDefaultscxx . . $ PhonationGridPlayOptions_setDefaults(e4af3a3aa7d7d11c). (PhonationGridPlayOptions me) {
614 mycxx . . $ `melder/melder.h:44:9`! flowDerivative = mycxx . . $ `melder/melder.h:44:9`! voicing = 1;
615 mycxx . . $ `melder/melder.h:44:9`! aspiration = mycxx . . $ `melder/melder.h:44:9`! breathiness = 1;
616 mycxx . . $ `melder/melder.h:44:9`! flutter = mycxx . . $ `melder/melder.h:44:9`! doublePulsing = 1;
617 mycxx . . $ `melder/melder.h:44:9`! collisionPhase = mycxx . . $ `melder/melder.h:44:9`! spectralTilt = 1;
618 mycxx . . $ `melder/melder.h:44:9`! flowFunction = 1; // User defined flow tiers (power1 & power2)
619 mycxx . . $ `melder/melder.h:44:9`! maximumPeriod = 0;
620 }
621
622 autoPhonationGridPlayOptions PhonationGridPlayOptions_createcxx . . $ PhonationGridPlayOptions_create(db0c1f3869518f2c). () {
623 try {
624 autoPhonationGridPlayOptions me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (PhonationGridPlayOptions);
625 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
626 } catch (MelderErrorcxx . . $ MelderError#) {
627 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"PhonationGridPlayOptions not created.");
628 }
629 }
630
631 /********************** PhonationGrid **********************/
632
633
634 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (PhonationGrid, Function, 0);
635
636 void structPhonationGrid :: v1_info () {
637 structDaatacxx . . $ structDaata# :: v1_infocxx . . $ structThing#v1_info(49f6e7a06ebc5aa8). ();
638 conststring32cxx . . $ conststring32# in1 = U" ", in2 = U" ";
639 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in1, U"Time domain:");
640 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"Start time: ", xmincxx . . $ structFunction#xmin., U" seconds");
641 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"End time: ", xmaxcxx . . $ structFunction#xmax., U" seconds");
642 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"Total duration: ", xmaxcxx . . $ structFunction#xmax. - xmincxx . . $ structFunction#xmin., U" seconds");
643 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in1, U"\nNumber of points in the PHONATION tiers:");
644 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"pitch: ", pitch ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
645 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"voicingAmplitude: ", voicingAmplitude ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
646 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"openPhase: ", openPhase ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
647 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"collisionPhase: ", collisionPhase ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
648 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"power1: ", power1 ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
649 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"power2: ", power2 ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
650 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"flutter: ", flutter ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
651 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"doublePulsing: ", doublePulsing ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
652 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"spectralTilt: ", spectralTilt ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
653 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"aspirationAmplitude: ", aspirationAmplitude ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
654 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"breathinessAmplitude:", breathinessAmplitude ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
655 }
656
657 void PhonationGrid_setNamescxx . . $ PhonationGrid_setNames(d8c306b453f39c78). (PhonationGrid me) {
658 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! pitch.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"pitch");
659 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! voicingAmplitude.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"voicingAmplitude");
660 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! openPhase.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"openPhase");
661 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! collisionPhase.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"collisionPhase");
662 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! power1.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"power1");
663 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! power2.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"power2");
664 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! flutter.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"flutter");
665 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! doublePulsing.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"doublePulsing");
666 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! spectralTilt.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"spectralTilt");
667 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! aspirationAmplitude.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"aspirationAmplitude");
668 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! breathinessAmplitude.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"breathinessAmplitude");
669 }
670
671 autoPhonationGrid PhonationGrid_createcxx . . $ PhonationGrid_create(1eb73ff0364c97d9). (double tmin, double tmax) {
672 try {
673 autoPhonationGrid me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (PhonationGrid);
674 Function_initcxx . . $ Function_init(ac72a71dd6ac1bfb). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tmin, tmax);
675 mycxx . . $ `melder/melder.h:44:9`! pitch =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). PitchTier_createcxx . . $ PitchTier_create(6e304f2c8cc67c9c). (tmin, tmax);
676 mycxx . . $ `melder/melder.h:44:9`! voicingAmplitude =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). IntensityTier_createcxx . . $ IntensityTier_create(3d279d9ea4a74662). (tmin, tmax);
677 mycxx . . $ `melder/melder.h:44:9`! openPhase =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). RealTier_createcxx . . $ RealTier_create(8e3ec305798a9b8e). (tmin, tmax);
678 mycxx . . $ `melder/melder.h:44:9`! collisionPhase =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). RealTier_createcxx . . $ RealTier_create(8e3ec305798a9b8e). (tmin, tmax);
679 mycxx . . $ `melder/melder.h:44:9`! power1 =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). RealTier_createcxx . . $ RealTier_create(8e3ec305798a9b8e). (tmin, tmax);
680 mycxx . . $ `melder/melder.h:44:9`! power2 =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). RealTier_createcxx . . $ RealTier_create(8e3ec305798a9b8e). (tmin, tmax);
681 mycxx . . $ `melder/melder.h:44:9`! flutter =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). RealTier_createcxx . . $ RealTier_create(8e3ec305798a9b8e). (tmin, tmax);
682 mycxx . . $ `melder/melder.h:44:9`! doublePulsing =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). RealTier_createcxx . . $ RealTier_create(8e3ec305798a9b8e). (tmin, tmax);
683 mycxx . . $ `melder/melder.h:44:9`! spectralTilt =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). IntensityTier_createcxx . . $ IntensityTier_create(3d279d9ea4a74662). (tmin, tmax);
684 mycxx . . $ `melder/melder.h:44:9`! aspirationAmplitude =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). IntensityTier_createcxx . . $ IntensityTier_create(3d279d9ea4a74662). (tmin, tmax);
685 mycxx . . $ `melder/melder.h:44:9`! breathinessAmplitude =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). IntensityTier_createcxx . . $ IntensityTier_create(3d279d9ea4a74662). (tmin, tmax);
686 mycxx . . $ `melder/melder.h:44:9`! options =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). PhonationGridPlayOptions_createcxx . . $ PhonationGridPlayOptions_create(db0c1f3869518f2c). ();
687 PhonationGrid_setNamescxx . . $ PhonationGrid_setNames(d8c306b453f39c78). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
688 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
689 } catch (MelderErrorcxx . . $ MelderError#) {
690 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"PhonationGrid not created.");
691 }
692 }
693
694 static void PhonationGrid_checkFlowFunctioncxx . . $ PhonationGrid_checkFlowFunction(d8c306b453f39c78). (PhonationGrid me) {
695 int hasPower1Points = mycxx . . $ `melder/melder.h:44:9`! power1 ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0;
696 int hasPower2Points = mycxx . . $ `melder/melder.h:44:9`! power2 ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0;
697
698 integercxx . . $ integer# ipoint = 1;
699 do {
700 const double time = ( hasPower1Points ? mycxx . . $ `melder/melder.h:44:9`! power1 ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).ipoint] -> numbercxx . . $ structSimpleDouble#number. : 0.5 * (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin. + mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax.) );
701 double power1 = RealTier_getValueAtIndexcxx . . $ RealTier_getValueAtIndex(ed98425824ac647a). (mycxx . . $ `melder/melder.h:44:9`! power1.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ipoint);
702 if (isundefcxx . . $ isundef(f8197d536af80c96). (power1))
703 power1 = KlattGrid_POWER1_DEFAULTcxx . . $ `dwtools/KlattGrid.cpp:115:9`!;
704 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (power1 > 0.0,
705 U"All power1 values should greater than zero.");
706
707 double power2 = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (mycxx . . $ `melder/melder.h:44:9`! power2.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), time);
708 if (isundefcxx . . $ isundef(f8197d536af80c96). (power2))
709 power2 = KlattGrid_POWER2_DEFAULTcxx . . $ `dwtools/KlattGrid.cpp:116:9`!;
710 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (power1 < power2,
711 U"At all times a power1 value should be smaller than the corresponding power2 value.");
712
713 } while ( ++ ipoint < mycxx . . $ `melder/melder.h:44:9`! power1 ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
714
715 // Now check power2 values. This is necessary to catch situations where power2 has a valley:
716 // power1(0) = 3; power2(1)= 4; power2(1)= 4; power2(0.5) = 3;
717
718 ipoint = 1;
719 do {
720 const double time = ( hasPower2Points ? mycxx . . $ `melder/melder.h:44:9`! power2 ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).ipoint] -> numbercxx . . $ structSimpleDouble#number. : 0.5 * (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin. + mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax.) );
721 double power2 = RealTier_getValueAtIndexcxx . . $ RealTier_getValueAtIndex(ed98425824ac647a). (mycxx . . $ `melder/melder.h:44:9`! power2.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ipoint);
722 if (isundefcxx . . $ isundef(f8197d536af80c96). (power2))
723 power2 = KlattGrid_POWER2_DEFAULTcxx . . $ `dwtools/KlattGrid.cpp:116:9`!;
724 double power1 = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (mycxx . . $ `melder/melder.h:44:9`! power1.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), time);
725 if (isundefcxx . . $ isundef(f8197d536af80c96). (power1))
726 power1 = KlattGrid_POWER1_DEFAULTcxx . . $ `dwtools/KlattGrid.cpp:115:9`!;
727 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (power1 < power2,
728 U"At all times a power1 value should be smaller than the corresponding power2 value.");
729
730 } while ( ++ ipoint < mycxx . . $ `melder/melder.h:44:9`! power2 ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
731 }
732
733 static void PhonationGrid_draw_insidecxx . . $ PhonationGrid_draw_inside(d340f301efa05e04). (PhonationGrid me, Graphicscxx . . $ Graphics# g, double xmin, double xmax, double ymin, double ymax, double dy, double *out_y) {
734 // dum voicing conn tilt conn summer
735 (void) me;
736 // { voicingBox, line, tiltBox, connection, summer }
737 autoVECcxx . . $ autoVEC# relativeWidthscxx . . $ autovector#autovector(8de98f561e977378). { 1.0, 0.5, 1.0, 0.5, 0.5 }, accumulatedWidths = zero_VECcxx . . $ zero_VEC(e4395f764b859b1e). (5);
738 double oldFontSize = Graphics_inqFontSizecxx . . $ Graphics_inqFontSize(f906975acce41a59). (g);
739 connectionscxx . . $ connections# thee = connections_createcxx . . $ connections_create(bd2eacb064a285e2). (2);
740
741 scaleRelativeAndAccumulatedWidthscxx . . $ scaleRelativeAndAccumulatedWidths(d9ca4354eebefd12). (relativeWidths.getcxx . . $ autovector#get(e8d1da7fe68a6585).(), accumulatedWidths.getcxx . . $ autovector#get(e8d1da7fe68a6585).(), xmax - xmin);
742
743 dy = (ymax - ymin) / (1.0 + ( dy < 0.0 ? 0.0 : dy ) + 1.0);
744 double x1 = xmin, x2 = x1 + relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1];
745 double y2 = ymax, y1 = y2 - dy;
746 autoSTRVECcxx . . $ autoSTRVEC# voicingTextcxx . . $ _autostringautovector#_autostringautovector(74bdb0c13d8f03c9). { U"Voicing" };
747 double newFontSize = Graphics_getFontSizeInsideBoxcxx . . $ Graphics_getFontSizeInsideBox(58355cd5a6d131f). (g, relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1], dy, 7.0, 1.5);
748 if (newFontSize < oldFontSize)
749 Graphics_setFontSizecxx . . $ Graphics_setFontSize(2514a1c07b6be5e2). (g, newFontSize);
750 drawLinesInBoxcxx . . $ drawLinesInBox(7482afdee92020f4). (g, x1, x2, y1, y2, voicingTextcxx . . $ _conststringvector#_conststringvector(93d9e701af42cb0d)..getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02).());
751
752 x1 = x2;
753 x2 = x1 + relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2];
754 double ymid = (y1 + y2) / 2.0;
755 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x1, ymid, x2, ymid);
756
757 x1 = x2;
758 x2 = x1 + relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).3];
759 autoSTRVECcxx . . $ autoSTRVEC# tiltTextcxx . . $ _autostringautovector#_autostringautovector(74bdb0c13d8f03c9). { U"Tilt" };
760 drawLinesInBoxcxx . . $ drawLinesInBox(7482afdee92020f4). (g, x1, x2, y1, y2, tiltTextcxx . . $ _conststringvector#_conststringvector(93d9e701af42cb0d)..getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02).());
761
762 thycxx . . $ `melder/melder.h:45:9`! xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1] = x2;
763 thycxx . . $ `melder/melder.h:45:9`! ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1] = ymid;
764
765 y2 = y1 - 0.5 * dy;
766 y1 = y2 - dy;
767 ymid = (y1 + y2) / 2.0;
768 x2 = xmin + accumulatedWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).3];
769 x1 = x2 - 1.5 * relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).3]; // some extra space
770 autoSTRVECcxx . . $ autoSTRVEC# aspirationTextcxx . . $ _autostringautovector#_autostringautovector(74bdb0c13d8f03c9). { U"Aspiration" };
771 drawLinesInBoxcxx . . $ drawLinesInBox(7482afdee92020f4). (g, x1, x2, y1, y2, aspirationTextcxx . . $ _conststringvector#_conststringvector(93d9e701af42cb0d)..getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02).());
772
773 thycxx . . $ `melder/melder.h:45:9`! xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2] = x2;
774 thycxx . . $ `melder/melder.h:45:9`! ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2] = ymid;
775
776 const double r = relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).5] / 2.0;
777 const double xs = xmax - r, ys = (ymax + ymin) / 2.0;
778 const bool arrow = true;
779
780 summer_drawConnectionscxx . . $ summer_drawConnections(45f02620acd1b9a1). (g, xs, ys, r, thee, arrow, 0.4);
781 connections_freecxx . . $ connections_free(5c23632b7bdbbe2b). (thee);
782
783 Graphics_setFontSizecxx . . $ Graphics_setFontSize(2514a1c07b6be5e2). (g, oldFontSize); // restore
784
785 if (out_y)
786 *out_y = ys;
787 }
788
789 void PhonationGrid_drawcxx . . $ PhonationGrid_draw(d6abde4a28ac6301). (PhonationGrid me, Graphicscxx . . $ Graphics# g) {
790 const double xmin = 0.0, xmax2 = 0.9, xmax = 1.0, ymin = 0.0, ymax = 1.0, dy = 0.5;
791
792 Graphics_setInnercxx . . $ Graphics_setInner(2d838ed765120c5d). (g);
793 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (g, xmin, xmax, ymin, ymax);
794 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (g, kGraphics_horizontalAlignmentcxx . . $ kGraphics_horizontalAlignment#::CENTREcxx . . $ kGraphics_horizontalAlignment#CENTRE., Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!);
795 double yout;
796 PhonationGrid_draw_insidecxx . . $ PhonationGrid_draw_inside(d340f301efa05e04). (me, g, xmin, xmax2, ymin, ymax, dy, & yout);
797
798 Graphics_arrowcxx . . $ Graphics_arrow(72bdb7937dbb13da). (g, xmax2, yout, xmax, yout);
799 Graphics_unsetInnercxx . . $ Graphics_unsetInner(2d838ed765120c5d). (g);
800 }
801
802 double PhonationGrid_getMaximumPeriodcxx . . $ PhonationGrid_getMaximumPeriod(8f6a2e2645dbfeef). (PhonationGrid me) {
803 const double minimumPitch = RealTier_getMinimumValuecxx . . $ RealTier_getMinimumValue(77f29e426b60f650). (mycxx . . $ `melder/melder.h:44:9`! pitch.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
804 return 2.0 / ( isdefinedcxx . . $ isdefined(f8197d536af80c96). (minimumPitch) && minimumPitch != 0.0 ? minimumPitch : mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax. - mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin. );
805 }
806
807 static autoPointProcesscxx . . $ autoPointProcess# PitchTier_to_PointProcess_fluttercxx . . $ PitchTier_to_PointProcess_flutter(38bbfbf1420627d6). (PitchTiercxx . . $ PitchTier# pitch, RealTiercxx . . $ RealTier# flutter, double maximumPeriod) {
808 try {
809 autoPointProcesscxx . . $ autoPointProcess# thee = PitchTier_to_PointProcesscxx . . $ PitchTier_to_PointProcess(f0370c77e10beb54). (pitch);
810 if (! flutter)
811 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
812 double tsum = 0;
813 for (integercxx . . $ integer# it = 2; it <= thycxx . . $ `melder/melder.h:45:9`! ntcxx . . $ structPointProcess#nt.; it ++) {
814 const double t = thycxx . . $ `melder/melder.h:45:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).it - 1];
815 const double period = thycxx . . $ `melder/melder.h:45:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).it] - thycxx . . $ `melder/melder.h:45:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).it - 1];
816 if (period < maximumPeriod && flutter -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0) {
817 const double fltr = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (flutter, t);
818 if (isdefinedcxx . . $ isdefined(f8197d536af80c96). (fltr)) {
819 // newF0 = f0 * (1 + (val / 50) * (sin ... + ...));
820 const double newPeriod = period / (1.0 + (fltr / 50.0) * (sincxx . . $ sin(fee4f1d22bc8e617). (NUM2picxx . . $ NUM2pi. * 12.7 * t) + sincxx . . $ sin(fee4f1d22bc8e617). (NUM2picxx . . $ NUM2pi. * 7.1 * t) + sincxx . . $ sin(fee4f1d22bc8e617). (NUM2picxx . . $ NUM2pi. * 4.7 * t)));
821 tsum += newPeriod - period;
822 }
823 }
824 thycxx . . $ `melder/melder.h:45:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).it] += tsum;
825 }
826 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
827 } catch (MelderErrorcxx . . $ MelderError#) {
828 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (pitch, U": no flutter PointProcess created.");
829 }
830 }
831
832 autoSoundcxx . . $ autoSound# PhonationGrid_to_Sound_aspirationcxx . . $ PhonationGrid_to_Sound_aspiration(d110d2c1f29080aa). (PhonationGrid me, double samplingFrequency) {
833 try {
834 autoSoundcxx . . $ autoSound# thee = Sound_createEmptyMonocxx . . $ Sound_createEmptyMono(e34f441442c8776d). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., samplingFrequency);
835
836 // Noise spectrum is tilted down by soft low-pass filter having a pole near
837 // the origin in the z-plane, i.e. y [n] = x [n] + (0.75 * y [n-1])
838 double lastval = 0.0;
839 if (mycxx . . $ `melder/melder.h:44:9`! aspirationAmplitude ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0) {
840 for (integercxx . . $ integer# i = 1; i <= thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.; i ++) {
841 const double t = thycxx . . $ `melder/melder.h:45:9`! x1cxx . . $ structSampled#x1. + (i - 1) * thycxx . . $ `melder/melder.h:45:9`! dxcxx . . $ structSampled#dx.;
842 double val = NUMrandomUniformcxx . . $ NUMrandomUniform(d8e7e0733fa41c87). (-1.0, 1.0);
843 const double a = DBSPL_to_Acxx . . $ `dwtools/KlattGrid.cpp:461:9`! (RealTier_getValueAtTime (mycxx . . $ `melder/melder.h:44:9`! aspirationAmplitude.get(), t));
844 if (isdefinedcxx . . $ isdefined(f8197d536af80c96). (a)) {
845 thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] = lastval = val + 0.75 * lastval;
846 lastval = (val += 0.75 * lastval); // soft low-pass
847 thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] = val * a;
848 }
849 }
850 }
851 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
852 } catch (MelderErrorcxx . . $ MelderError#) {
853 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no aspiration Sound created.");
854 }
855 }
856
857 static void Sound_PhonationGrid_spectralTilt_inplacecxx . . $ Sound_PhonationGrid_spectralTilt_inplace(30bc083103ac153d). (Soundcxx . . $ Sound# thee, PhonationGrid me) {
858 if (mycxx . . $ `melder/melder.h:44:9`! spectralTilt ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0) {
859 /* Spectral tilt
860 Filter y [n] = a * x [n] + b * y [n-1] => H(z) = a / (1 - bz^(-1)).
861 We need attenuation, i.e. low-pass. Therefore 0 <= b <= 1.
862 |H(f)| = a / sqrt (1 - 2*b*cos(2*pi*f*T) + b^2),
863 |H(0)|= a /(1 - b) => if |H(0)| == 1, then a = 1 - b.
864 Now solve 20 log|H(F)|= -c (at F=3 kHz and c > 0)
865 Solution: if q = (1 - D * cos(2*pi*F*T)) / (1 - D), with D = 10^(-c/10)
866 then b = q -sqrt(q^2 - 1)
867 */
868
869 const double cosf = coscxx . . $ cos(fee4f1d22bc8e617). (NUM2picxx . . $ NUM2pi. * 3000.0 * thycxx . . $ `melder/melder.h:45:9`! dxcxx . . $ structSampled#dx.); // samplingFrequency > 6000.0 !
870 double ynm1 = 0.0;
871
872 for (integercxx . . $ integer# i = 1; i <= thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.; i ++) {
873 const double t = thycxx . . $ `melder/melder.h:45:9`! x1cxx . . $ structSampled#x1. + (i - 1) * thycxx . . $ `melder/melder.h:45:9`! dxcxx . . $ structSampled#dx.;
874 const double tilt_db = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (mycxx . . $ `melder/melder.h:44:9`! spectralTilt.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t);
875
876 if (tilt_db > 0) {
877 const double d = powcxx . . $ pow(b71928d39fde4295). (10.0, -tilt_db / 10.0);
878 const double q = (1.0 - d * cosf) / (1.0 - d);
879 const double b = q - sqrtcxx . . $ sqrt(fee4f1d22bc8e617). (q * q - 1.0);
880 const double a = 1.0 - b;
881 thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] = a * thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] + b * ynm1;
882 ynm1 = thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
883 }
884 }
885 }
886 }
887
888 struct nrfunction_structcxx . . $ nrfunction_struct# {
889 double ncxx . . $ nrfunction_struct#n.;
890 double mcxx . . $ nrfunction_struct#m.;
891 double acxx . . $ nrfunction_struct#a.;
892 };
893
894 static double nrfunctioncxx . . $ nrfunction(b9cf8b1375751fce). (double x, double *dfx, void *closure) {
895 const struct nrfunction_structcxx . . $ nrfunction_struct# *nrfs = (struct nrfunction_structcxx . . $ nrfunction_struct# *) closure;
896 const double mplusax = nrfs -> mcxx . . $ nrfunction_struct#m. + nrfs -> acxx . . $ nrfunction_struct#a. * x;
897 const double mminn = nrfs -> mcxx . . $ nrfunction_struct#m. - nrfs -> ncxx . . $ nrfunction_struct#n.;
898 const double fx = powcxx . . $ pow(b71928d39fde4295). (x, mminn) - (nrfs -> ncxx . . $ nrfunction_struct#n. + nrfs -> acxx . . $ nrfunction_struct#a. * x) / mplusax;
899 *dfx = mminn * powcxx . . $ pow(b71928d39fde4295). (x, mminn - 1) - nrfs -> acxx . . $ nrfunction_struct#a. * mminn / (mplusax * mplusax);
900 return fx;
901 }
902
903 static double get_collisionPoint_xcxx . . $ get_collisionPoint_x(7678bba071383ab). (double n, double m, double collisionPhase) {
904 double y = undefinedcxx . . $ undefined.;
905 /*
906 Domain [0, 1]:
907 The glottal flow is given by:
908 U(y) = y^n - y^m 0<= y <= x, and m > n
909 (x^n - x^m)exp(-a(y-x)) y >= x, where a = 1 / collisionPhase
910 The x where this occurs is the point where the amplitudes as well as the derivatives are equal.
911 I.e. the x where n x^(n-1) - m x^(m-1) = (x^n-x^m)(-a).
912 This can be simplified: find x in (0,1) where f(x) = x^(m-n) - (n+ax)/(m+ax) == 0.
913 For m - n == 1, f(x) is a second order equation f(x)= a x^2 + (m-a) x - n == 0.
914 In all other cases we solve with Newton-Raphson. For these cases we also need the derivative:
915 f'(x)= (m - n)x^(m - n - 1)- a(m - n) / (m + a x)^2
916 */
917 if (collisionPhase <= 0.0)
918 return 1.0;
919 double a = 1.0 / collisionPhase;
920 if (m - n == 1.0) {
921 const double b = m - a;
922 const double c = - n;
923 double y1, y2;
924 integercxx . . $ integer# nroots = NUMsolveQuadraticEquationcxx . . $ NUMsolveQuadraticEquation(727311d4260346f0). (a, b, c, &y1, &y2);
925 if (nroots == 2)
926 y = y2;
927 else if (nroots == 1)
928 y = y1;
929 } else { // Newton-Raphson
930 // search in the interval from where the flow is a maximum to 1
931 const double xmaxFlow = powcxx . . $ pow(b71928d39fde4295). (n / m, 1.0 / (m - n));
932 struct nrfunction_structcxx . . $ nrfunction_struct# nrfs = {n, m, a};
933 double root = NUMnrbiscxx . . $ NUMnrbis(928da06fce274b3e). (& nrfunctioncxx . . $ nrfunction(b9cf8b1375751fce)., xmaxFlow, 1.0, & nrfs);
934 y = root;
935 }
936 return y;
937 }
938
939 autoPhonationTier PhonationGrid_to_PhonationTiercxx . . $ PhonationGrid_to_PhonationTier(dfa2e4f6c40d1ed). (PhonationGrid me) {
940 try {
941 integercxx . . $ integer# diplophonicPulseIndex = 0;
942 const PhonationGridPlayOptions pp = mycxx . . $ `melder/melder.h:44:9`! options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
943
944 PhonationGrid_checkFlowFunctioncxx . . $ PhonationGrid_checkFlowFunction(d8c306b453f39c78). (me);
945 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! pitch -> points.size > 0,
946 U"Pitch tier should not be empty.");
947
948 if (pp -> maximumPeriod == 0.0)
949 pp -> maximumPeriod = PhonationGrid_getMaximumPeriodcxx . . $ PhonationGrid_getMaximumPeriod(8f6a2e2645dbfeef). (me);
950
951 autoPointProcesscxx . . $ autoPointProcess# point = PitchTier_to_PointProcess_fluttercxx . . $ PitchTier_to_PointProcess_flutter(38bbfbf1420627d6). (mycxx . . $ `melder/melder.h:44:9`! pitch.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ( pp -> flutter ? mycxx . . $ `melder/melder.h:44:9`! flutter.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).() : nullptr ), pp -> maximumPeriod);
952
953 autoPhonationTier thee = PhonationTier_createcxx . . $ PhonationTier_create(32c525becfbb2d10). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax.);
954
955 /*
956 Cycle through the points of the point PointProcess. Each will become a period.
957 We assume that the planning for the pitch period occurs approximately at a time T before the glottal closure.
958 For each point t [i]:
959 Determine the f0 -> period T [i]
960 Determine time t [i]-T [i] the open quotient, power1, power2, collisionphase etc.
961 Generate the period.
962 */
963
964 for (integercxx . . $ integer# it = 1; it <= point ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). ntcxx . . $ structPointProcess#nt.; it ++) {
965 double re = 0.0, t = point ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).it]; // the glottis "closing" point
966 double pulseDelay = 0.0; // For alternate pulses in case of diplophonia
967 double pulseScale = 1.0; // For alternate pulses in case of diplophonia
968
969 double period = PointProcess_getPeriodAtIndexcxx . . $ PointProcess_getPeriodAtIndex(19efc67d561c65e2). (point.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), it, pp -> maximumPeriod);
970 if (isundefcxx . . $ isundef(f8197d536af80c96). (period))
971 period = 0.5 * pp -> maximumPeriod; // some default value
972
973 // Calculate the point where the exponential decay starts:
974 // Query tiers where period starts .
975
976 double periodStart = t - period;
977 double collisionPhase = ( pp -> collisionPhase ? RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (mycxx . . $ `melder/melder.h:44:9`! collisionPhase.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), periodStart) : 0.0 );
978 if (isundefcxx . . $ isundef(f8197d536af80c96). (collisionPhase))
979 collisionPhase = 0.0;
980 double power1 = ( pp -> flowFunction == 1 ? RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (mycxx . . $ `melder/melder.h:44:9`! power1.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), periodStart) : pp -> flowFunction );
981 if (isundefcxx . . $ isundef(f8197d536af80c96). (power1))
982 power1 = KlattGrid_POWER1_DEFAULTcxx . . $ `dwtools/KlattGrid.cpp:115:9`!;
983 double power2 = ( pp -> flowFunction == 1 ? RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (mycxx . . $ `melder/melder.h:44:9`! power2.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), periodStart) : pp -> flowFunction + 1 );
984 if (isundefcxx . . $ isundef(f8197d536af80c96). (power2))
985 power2 = KlattGrid_POWER2_DEFAULTcxx . . $ `dwtools/KlattGrid.cpp:116:9`!;
986 try {
987 re = get_collisionPoint_xcxx . . $ get_collisionPoint_x(7678bba071383ab). (power1, power2, collisionPhase);
988 } catch (MelderErrorcxx . . $ MelderError#) {
989 Melder_warningcxx . . $ Melder_warning(6298c93241566110). (U"Illegal collision point at t = ", t, U" (power1=", power1, U", power2=", power2, U"colPhase=", collisionPhase, U")");
990 }
991
992 double openPhase = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (mycxx . . $ `melder/melder.h:44:9`! openPhase.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), periodStart);
993 if (isundefcxx . . $ isundef(f8197d536af80c96). (openPhase))
994 openPhase = KlattGrid_OPENPHASE_DEFAULTcxx . . $ `dwtools/KlattGrid.cpp:114:9`!;
995
996 const double te = re * period * openPhase;
997
998 // In case of diplophonia alternate pulses get modified.
999 // A modified puls is delayed in time and its amplitude attenuated.
1000 // This delay scales to maximally equal the closed phase of the next period.
1001 // The doublePulsing scales the amplitudes as well as the delay linearly.
1002
1003 double doublePulsing = ( pp -> doublePulsing ? RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (mycxx . . $ `melder/melder.h:44:9`! doublePulsing.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), periodStart) : 0.0 );
1004 if (isundefcxx . . $ isundef(f8197d536af80c96). (doublePulsing))
1005 doublePulsing = 0.0;
1006 if (doublePulsing > 0.0) {
1007 diplophonicPulseIndex ++;
1008 if (diplophonicPulseIndex % 2 == 1) { // the odd-numbered one
1009 double nextPeriod = PointProcess_getPeriodAtIndexcxx . . $ PointProcess_getPeriodAtIndex(19efc67d561c65e2). (point.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), it + 1, pp -> maximumPeriod);
1010 if (isundefcxx . . $ isundef(f8197d536af80c96). (nextPeriod))
1011 nextPeriod = period;
1012 double openPhase2 = KlattGrid_OPENPHASE_DEFAULTcxx . . $ `dwtools/KlattGrid.cpp:114:9`!;
1013 if (mycxx . . $ `melder/melder.h:44:9`! openPhase ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0)
1014 openPhase2 = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (mycxx . . $ `melder/melder.h:44:9`! openPhase.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t);
1015 const double maxDelay = period * (1.0 - openPhase2);
1016 pulseDelay = maxDelay * doublePulsing;
1017 pulseScale *= 1.0 - doublePulsing;
1018 }
1019 } else
1020 diplophonicPulseIndex = 0;
1021
1022 t += pulseDelay;
1023 autoPhonationPoint phonationPoint = PhonationPoint_createcxx . . $ PhonationPoint_create(50e17eda9fa30423). (t, period, openPhase, collisionPhase, te, power1, power2, pulseScale);
1024 AnyTier_addPoint_movecxx . . $ AnyTier_addPoint_move(2e294f110b9a88c5). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()->asAnyTier(), phonationPointcxx . . $ autoSomeThing#autoSomeThing(327dc2ad7b4df21)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).());
1025 }
1026 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
1027 } catch (MelderErrorcxx . . $ MelderError#) {
1028 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no PhonationTier created.");
1029 }
1030 }
1031
1032 static autoSoundcxx . . $ autoSound# PhonationGrid_PhonationTier_to_Sound_voicedcxx . . $ PhonationGrid_PhonationTier_to_Sound_voiced(710823c3d83ddec0). (PhonationGrid me, PhonationTier thee, double samplingFrequency) {
1033 try {
1034 const PhonationGridPlayOptions p = mycxx . . $ `melder/melder.h:44:9`! options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1035 double lastVal = undefinedcxx . . $ undefined.;
1036
1037 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! voicingAmplitude -> points.size > 0,
1038 U"Voicing amplitude tier should not be empty.");
1039
1040 autoSoundcxx . . $ autoSound# him = Sound_createEmptyMonocxx . . $ Sound_createEmptyMono(e34f441442c8776d). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., samplingFrequency);
1041 autoSoundcxx . . $ autoSound# breathycxx . . $ autoSomeThing#autoSomeThing(49f6e7a06ebc5aa8).;
1042 if (p -> breathiness && mycxx . . $ `melder/melder.h:44:9`! breathinessAmplitude ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0)
1043 breathy =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Sound_createEmptyMonocxx . . $ Sound_createEmptyMono(e34f441442c8776d). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., samplingFrequency);
1044
1045 /*
1046 Cycle through the points of the PhonationTier. Each will become a period.
1047 We assume that the planning for the pitch period occurs approximately at a time T before the glottal closure.
1048 For each point t [i]:
1049 Determine the f0 -> period T [i]
1050 Determine time t [i]-T [i] the open quotient, power1, power2, collisionphase etc.
1051 Generate the period.
1052 */
1053 VECcxx . . $ VEC# sound = hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z..rowcxx . . $ automatrix#row(2d545b3cb3f8e666). (1);
1054 for (integercxx . . $ integer# it = 1; it <= thycxx . . $ `melder/melder.h:45:9`! points.sizecxx . . $ CollectionOf#size.; it ++) {
1055 PhonationPoint point = thycxx . . $ `melder/melder.h:45:9`! points.atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).it];
1056 const double t = point -> numbercxx . . $ structSimpleDouble#number.; // the glottis "closing" point
1057 const double te = point -> te;
1058 const double period = point -> period; // duration of the current period
1059 const double openPhase = point -> openPhase;
1060 const double collisionPhase = point -> collisionPhase;
1061 const double pulseScale = point -> pulseScale; // For alternate pulses in case of diplophonia
1062 const double power1 = point -> power1, power2 = point -> power2;
1063 double phase; // 0..1
1064 double flow;
1065
1066 //- double amplitude = pulseScale * (power1 + power2 + 1.0) / (power2 - power1);
1067 //- amplitude /= period * openPhase;
1068
1069 // Maximum of U(x) = x^n - x^m is where the derivative U'(x) = n x^(n-1) - m x^(m-1) == 0,
1070 // i.e. (n/m) = x^(m-n), so xmax = (n/m)^(1/(m-n))
1071 // U(xmax) = x^n (1-x^(m-n)) = (n/m)^(n/(m-n))(1-n/m)
1072
1073 const double amplitude = pulseScale / (powcxx . . $ pow(b71928d39fde4295). (power1 / power2, 1.0 / (power2 / power1 - 1.0)) * (1.0 - power1 / power2));
1074
1075 // Fill in the samples to the left of the current point.
1076
1077 integercxx . . $ integer# midSample = Sampled_xToLowIndexcxx . . $ Sampled_xToLowIndex(405c2491bc3636e9). (him.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t), beginSample;
1078 beginSample = midSample - Melder_ifloorcxx . . $ `melder/melder_ftoi.h:33:9`! (te / hiscxx . . $ `melder/melder.h:47:9`! dxcxx . . $ structSampled#dx.);
1079 if (beginSample < 1)
1080 beginSample = 0;
1081 if (midSample > hiscxx . . $ `melder/melder.h:47:9`! nxcxx . . $ structSampled#nx.)
1082 midSample = hiscxx . . $ `melder/melder.h:47:9`! nxcxx . . $ structSampled#nx.;
1083 for (integercxx . . $ integer# i = beginSample; i <= midSample; i ++) {
1084 const double tsamp = hiscxx . . $ `melder/melder.h:47:9`! x1cxx . . $ structSampled#x1. + (i - 1) * hiscxx . . $ `melder/melder.h:47:9`! dxcxx . . $ structSampled#dx.;
1085 phase = (tsamp - (t - te)) / (period * openPhase);
1086 if (phase > 0.0) {
1087 flow = amplitude * (powcxx . . $ pow(b71928d39fde4295). (phase, power1) - powcxx . . $ pow(b71928d39fde4295). (phase, power2));
1088 if (i == 0) {
1089 lastVal = flow; // For the derivative
1090 continue;
1091 }
1092 sound [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] += flow;
1093
1094 // Breathiness only during open part modulated by the flow
1095 if (breathy) {
1096 double val = flow * NUMrandomUniformcxx . . $ NUMrandomUniform(d8e7e0733fa41c87). (-1.0, 1.0);
1097 double a = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (mycxx . . $ `melder/melder.h:44:9`! breathinessAmplitude.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t);
1098 breathy ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] += val * DBSPL_to_Acxx . . $ `dwtools/KlattGrid.cpp:461:9`! (a);
1099 }
1100 }
1101 }
1102
1103 // Determine the signal parameters at the current point.
1104
1105 phase = te / (period * openPhase);
1106
1107 //- double flow = amplitude * (period * openPhase) * (pow (phase, power1) - pow (phase, power2));
1108
1109 flow = amplitude * (powcxx . . $ pow(b71928d39fde4295). (phase, power1) - powcxx . . $ pow(b71928d39fde4295). (phase, power2));
1110
1111 // Fill in the samples to the right of the current point.
1112
1113 if (flow > 0.0) {
1114 const double ta = collisionPhase * (period * openPhase);
1115 const double factorPerSample = expcxx . . $ exp(fee4f1d22bc8e617). (- hiscxx . . $ `melder/melder.h:47:9`! dxcxx . . $ structSampled#dx. / ta);
1116 double value = flow * expcxx . . $ exp(fee4f1d22bc8e617). (- (hiscxx . . $ `melder/melder.h:47:9`! x1cxx . . $ structSampled#x1. + midSample * hiscxx . . $ `melder/melder.h:47:9`! dxcxx . . $ structSampled#dx. - t) / ta);
1117 integercxx . . $ integer# endSample = midSample + Melder_ifloorcxx . . $ `melder/melder_ftoi.h:33:9`! (20.0 * ta / hiscxx . . $ `melder/melder.h:47:9`! dxcxx . . $ structSampled#dx.);
1118 if (endSample > hiscxx . . $ `melder/melder.h:47:9`! nxcxx . . $ structSampled#nx.)
1119 endSample = hiscxx . . $ `melder/melder.h:47:9`! nxcxx . . $ structSampled#nx.;
1120 for (integercxx . . $ integer# i = midSample + 1; i <= endSample; i ++) {
1121 sound [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] += value;
1122 value *= factorPerSample;
1123 }
1124 }
1125 }
1126
1127 // Scale voiced part and add breathiness during open phase
1128 if (p -> flowDerivative) {
1129 const double extremum = Vector_getAbsoluteExtremumcxx . . $ Vector_getAbsoluteExtremum(9e5d98b21939784c). (him.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.0, 0.0, kVector_peakInterpolationcxx . . $ kVector_peakInterpolation# :: CUBICcxx . . $ kVector_peakInterpolation#CUBIC.);
1130 if (isundefcxx . . $ isundef(f8197d536af80c96). (lastVal))
1131 lastVal = 0.0;
1132 for (integercxx . . $ integer# i = 1; i <= hiscxx . . $ `melder/melder.h:47:9`! nxcxx . . $ structSampled#nx.; i ++) {
1133 const double val = hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
1134 hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] -= lastVal;
1135 lastVal = val;
1136 }
1137 Vector_scalecxx . . $ Vector_scale(54f31cdb89d1acde). (him.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), extremum);
1138 }
1139
1140 for (integercxx . . $ integer# i = 1; i <= hiscxx . . $ `melder/melder.h:47:9`! nxcxx . . $ structSampled#nx.; i ++) {
1141 const double t = hiscxx . . $ `melder/melder.h:47:9`! x1cxx . . $ structSampled#x1. + (i - 1) * hiscxx . . $ `melder/melder.h:47:9`! dxcxx . . $ structSampled#dx.;
1142 hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] *= DBSPL_to_Acxx . . $ `dwtools/KlattGrid.cpp:461:9`! (RealTier_getValueAtTime (mycxx . . $ `melder/melder.h:44:9`! voicingAmplitude.get(), t));
1143 if (breathy)
1144 hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] += breathy ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
1145 }
1146 return himcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
1147 } catch (MelderErrorcxx . . $ MelderError#) {
1148 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no Sound created.");
1149 }
1150 }
1151
1152 static autoSoundcxx . . $ autoSound# PhonationGrid_to_Sound_voicedcxx . . $ PhonationGrid_to_Sound_voiced(d110d2c1f29080aa). (PhonationGrid me, double samplingFrequency) {
1153 try {
1154 autoPhonationTier thee = PhonationGrid_to_PhonationTiercxx . . $ PhonationGrid_to_PhonationTier(dfa2e4f6c40d1ed). (me);
1155 return PhonationGrid_PhonationTier_to_Sound_voicedcxx . . $ PhonationGrid_PhonationTier_to_Sound_voiced(710823c3d83ddec0). (me, thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), samplingFrequency);
1156 } catch (MelderErrorcxx . . $ MelderError#) {
1157 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no voiced Sound created.");
1158 }
1159 }
1160
1161 static autoSoundcxx . . $ autoSound# PhonationGrid_to_Soundcxx . . $ PhonationGrid_to_Sound(91d3261e423536d3). (PhonationGrid me, CouplingGrid him, double samplingFrequency) {
1162 try {
1163 PhonationGridPlayOptions pp = mycxx . . $ `melder/melder.h:44:9`! options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1164 autoSoundcxx . . $ autoSound# theecxx . . $ autoSomeThing#autoSomeThing(49f6e7a06ebc5aa8).;
1165 if (pp -> voicing) {
1166 if (him && hiscxx . . $ `melder/melder.h:47:9`! glottis ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). points.sizecxx . . $ CollectionOf#size. > 0)
1167 thee =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). PhonationGrid_PhonationTier_to_Sound_voicedcxx . . $ PhonationGrid_PhonationTier_to_Sound_voiced(710823c3d83ddec0). (me, hiscxx . . $ `melder/melder.h:47:9`! glottis.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), samplingFrequency);
1168 else
1169 thee =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). PhonationGrid_to_Sound_voicedcxx . . $ PhonationGrid_to_Sound_voiced(d110d2c1f29080aa). (me, samplingFrequency);
1170 if (pp -> spectralTilt)
1171 Sound_PhonationGrid_spectralTilt_inplacecxx . . $ Sound_PhonationGrid_spectralTilt_inplace(30bc083103ac153d). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), me);
1172 }
1173 if (pp -> aspiration) {
1174 autoSoundcxx . . $ autoSound# aspiration = PhonationGrid_to_Sound_aspirationcxx . . $ PhonationGrid_to_Sound_aspiration(d110d2c1f29080aa). (me, samplingFrequency);
1175 if (thee)
1176 _Sounds_add_inplacecxx . . $ _Sounds_add_inplace(3740d3b02ef916dc). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), aspiration.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
1177 else
1178 thee =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). aspiration.movecxx . . $ autoSomeThing#move(25acc3554b7d1642).();
1179 }
1180 if (! thee)
1181 thee =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Sound_createEmptyMonocxx . . $ Sound_createEmptyMono(e34f441442c8776d). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., samplingFrequency);
1182 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
1183 } catch (MelderErrorcxx . . $ MelderError#) {
1184 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no Sound created.");
1185 }
1186 }
1187
1188 static void formantsAmplitudes_createcxx . . $ formantsAmplitudes_create(20f2512fed5c7bcc). (OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* me, double tmin, double tmax, integercxx . . $ integer# numberOfFormants) {
1189 try {
1190 for (integercxx . . $ integer# i = 1; i <= numberOfFormants; i ++) {
1191 autoIntensityTiercxx . . $ autoIntensityTier# a = IntensityTier_createcxx . . $ IntensityTier_create(3d279d9ea4a74662). (tmin, tmax);
1192 me -> addItem_movecxx . . $ CollectionOf#addItem_move(bcc0cff787be24fe). (acxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).());
1193 }
1194 } catch (MelderErrorcxx . . $ MelderError#) {
1195 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"No formants amplitudes created.");
1196 };
1197 }
1198
1199 /********************** VocalTractGridPlayOptions **********************/
1200
1201 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (VocalTractGridPlayOptions, Daata, 0);
1202
1203 static void VocalTractGridPlayOptions_setDefaultscxx . . $ VocalTractGridPlayOptions_setDefaults(33821518a87c09fe). (VocalTractGridPlayOptions me, VocalTractGrid thee) {
1204 mycxx . . $ `melder/melder.h:44:9`! filterModel = kKlattGridFilterModelcxx . . $ kKlattGridFilterModel#::CASCADEcxx . . $ kKlattGridFilterModel#CASCADE.;
1205 mycxx . . $ `melder/melder.h:44:9`! endOralFormant = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a). (thycxx . . $ `melder/melder.h:45:9`! oral_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size., thycxx . . $ `melder/melder.h:45:9`! oral_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bandwidthscxx . . $ structFormantGrid#bandwidths..sizecxx . . $ CollectionOf#size.);
1206 mycxx . . $ `melder/melder.h:44:9`! startOralFormant = 1;
1207 mycxx . . $ `melder/melder.h:44:9`! endNasalFormant = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a). (thycxx . . $ `melder/melder.h:45:9`! nasal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size., thycxx . . $ `melder/melder.h:45:9`! nasal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bandwidthscxx . . $ structFormantGrid#bandwidths..sizecxx . . $ CollectionOf#size.);
1208 mycxx . . $ `melder/melder.h:44:9`! startNasalFormant = 1;
1209 mycxx . . $ `melder/melder.h:44:9`! endNasalAntiFormant = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a). (thycxx . . $ `melder/melder.h:45:9`! nasal_antiformants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size., thycxx . . $ `melder/melder.h:45:9`! nasal_antiformants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bandwidthscxx . . $ structFormantGrid#bandwidths..sizecxx . . $ CollectionOf#size.);
1210 mycxx . . $ `melder/melder.h:44:9`! startNasalAntiFormant = 1;
1211 }
1212
1213 autoVocalTractGridPlayOptions VocalTractGridPlayOptions_createcxx . . $ VocalTractGridPlayOptions_create(ae2a90592c7b8309). () {
1214 try {
1215 autoVocalTractGridPlayOptions me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (VocalTractGridPlayOptions);
1216 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
1217 } catch (MelderErrorcxx . . $ MelderError#) {
1218 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"VocalTractGridPlayOptions not created.");
1219 }
1220 }
1221
1222 /********************** VocalTractGrid ***************************************/
1223
1224 static integercxx . . $ integer# FormantGrid_getNumberOfFormantPointscxx . . $ FormantGrid_getNumberOfFormantPoints(b676e5b4df7ee99b). (FormantGridcxx . . $ FormantGrid# me, integercxx . . $ integer# iformant) {
1225 if (iformant < 1 || iformant > mycxx . . $ `melder/melder.h:44:9`! formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.)
1226 return -1;
1227 const RealTiercxx . . $ RealTier# f = mycxx . . $ `melder/melder.h:44:9`! formantscxx . . $ structFormantGrid#formants..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant];
1228 return f -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.;
1229 }
1230
1231 static integercxx . . $ integer# FormantGrid_getNumberOfBandwidthPointscxx . . $ FormantGrid_getNumberOfBandwidthPoints(b676e5b4df7ee99b). (FormantGridcxx . . $ FormantGrid# me, integercxx . . $ integer# iformant) {
1232 if (iformant < 1 || iformant > mycxx . . $ `melder/melder.h:44:9`! bandwidthscxx . . $ structFormantGrid#bandwidths..sizecxx . . $ CollectionOf#size.)
1233 return -1;
1234 const RealTiercxx . . $ RealTier# b = mycxx . . $ `melder/melder.h:44:9`! bandwidthscxx . . $ structFormantGrid#bandwidths..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant];
1235 return b -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.;
1236 }
1237
1238 static integercxx . . $ integer# Ordered_getNumberOfAmplitudePointscxx . . $ Ordered_getNumberOfAmplitudePoints(681e494e6ec871ca). (OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* me, integercxx . . $ integer# iformant) {
1239 if (! me || iformant < 1 || iformant > mycxx . . $ `melder/melder.h:44:9`! sizecxx . . $ CollectionOf#size.)
1240 return -1;
1241 const RealTiercxx . . $ RealTier# t = mycxx . . $ `melder/melder.h:44:9`! atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant];
1242 return t -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.;
1243 }
1244
1245 static void FormantGrid_infocxx . . $ FormantGrid_info(75b679a5faacbdd4). (FormantGridcxx . . $ FormantGrid# me, OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* amplitudes, conststring32cxx . . $ conststring32# in1, conststring32cxx . . $ conststring32# in2) {
1246 const integercxx . . $ integer# nformants = mycxx . . $ `melder/melder.h:44:9`! formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1247 const integercxx . . $ integer# namplitudes = ( amplitudes ? amplitudes->sizecxx . . $ CollectionOf#size. : 0 );
1248 const integercxx . . $ integer# nmax = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a). (nformants, namplitudes);
1249
1250 for (integercxx . . $ integer# iformant = 1; iformant <= nmax; iformant ++) {
1251 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in1, U"Formant ", iformant, U":");
1252 if (iformant <= mycxx . . $ `melder/melder.h:44:9`! formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.) {
1253 const integercxx . . $ integer# nfp = FormantGrid_getNumberOfFormantPointscxx . . $ FormantGrid_getNumberOfFormantPoints(b676e5b4df7ee99b). (me, iformant);
1254 const integercxx . . $ integer# nbp = FormantGrid_getNumberOfBandwidthPointscxx . . $ FormantGrid_getNumberOfBandwidthPoints(b676e5b4df7ee99b). (me, iformant);
1255 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"formants: ", ( nfp >= 0 ? Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). (nfp) : U"--undefined--" ));
1256 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"bandwidths: ", ( nbp >= 0 ? Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). (nbp) : U"--undefined--" ));
1257 }
1258 if (amplitudes) {
1259 const integercxx . . $ integer# nap = Ordered_getNumberOfAmplitudePointscxx . . $ Ordered_getNumberOfAmplitudePoints(681e494e6ec871ca). (amplitudes, iformant);
1260 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"amplitudes: ", ( nap >= 0 ? Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). (nap) : U"--undefined--" ));
1261 }
1262 }
1263 }
1264
1265 void structVocalTractGrid :: v1_info () {
1266 ourcxx . . $ `melder/melder.h:42:9`! structDaatacxx . . $ structDaata# :: v1_infocxx . . $ structThing#v1_info(49f6e7a06ebc5aa8). ();
1267 const conststring32cxx . . $ conststring32# in1 = U" ", in2 = U" ", in3 = U" ";
1268 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in1, U"Time domain:");
1269 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"Start time: ", ourcxx . . $ `melder/melder.h:42:9`! xmincxx . . $ structFunction#xmin., U" seconds");
1270 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"End time: ", ourcxx . . $ `melder/melder.h:42:9`! xmaxcxx . . $ structFunction#xmax., U" seconds");
1271 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"Total duration: ", ourcxx . . $ `melder/melder.h:42:9`! xmaxcxx . . $ structFunction#xmax. - ourcxx . . $ `melder/melder.h:42:9`! xmincxx . . $ structFunction#xmin., U" seconds");
1272 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in1, U"\nNumber of points in the ORAL FORMANT tiers:");
1273 FormantGrid_infocxx . . $ FormantGrid_info(75b679a5faacbdd4). (ourcxx . . $ `melder/melder.h:42:9`! oral_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), & ourcxx . . $ `melder/melder.h:42:9`! oral_formants_amplitudes, in2, in3);
1274 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in1, U"\nNumber of points in the NASAL FORMANT tiers:");
1275 FormantGrid_infocxx . . $ FormantGrid_info(75b679a5faacbdd4). (ourcxx . . $ `melder/melder.h:42:9`! nasal_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), & ourcxx . . $ `melder/melder.h:42:9`! nasal_formants_amplitudes, in2, in3);
1276 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in1, U"\nNumber of points in the NASAL ANTIFORMANT tiers:");
1277 FormantGrid_infocxx . . $ FormantGrid_info(75b679a5faacbdd4). (ourcxx . . $ `melder/melder.h:42:9`! nasal_antiformants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), nullptr, in2, in3);
1278 }
1279
1280 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (VocalTractGrid, Function, 0);
1281
1282 void VocalTractGrid_setNamescxx . . $ VocalTractGrid_setNames(3d2529f7c469d424). (VocalTractGrid me) {
1283 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! oral_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"oral_formants");
1284 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! nasal_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"nasal_formants");
1285 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! nasal_antiformants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"nasal_antiformants");
1286 //Thing_setName (my oral_formants_amplitudes.get(), U"oral_formants_amplitudes");
1287 //Thing_setName (my nasal_formants_amplitudes.get(), U"nasal_formants_amplitudes");
1288 }
1289
1290 autoVocalTractGrid VocalTractGrid_createcxx . . $ VocalTractGrid_create(4a8bbb8d1f5632c). (double tmin, double tmax, integercxx . . $ integer# numberOfFormants, integercxx . . $ integer# numberOfNasalFormants, integercxx . . $ integer# numberOfNasalAntiFormants) {
1291 try {
1292 autoVocalTractGrid me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (VocalTractGrid);
1293 Function_initcxx . . $ Function_init(ac72a71dd6ac1bfb). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tmin, tmax);
1294 mycxx . . $ `melder/melder.h:44:9`! oral_formants =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). FormantGrid_createEmptycxx . . $ FormantGrid_createEmpty(73275a7b30af7b50). (tmin, tmax, numberOfFormants);
1295 mycxx . . $ `melder/melder.h:44:9`! nasal_formants =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). FormantGrid_createEmptycxx . . $ FormantGrid_createEmpty(73275a7b30af7b50). (tmin, tmax, numberOfNasalFormants);
1296 mycxx . . $ `melder/melder.h:44:9`! nasal_antiformants =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). FormantGrid_createEmptycxx . . $ FormantGrid_createEmpty(73275a7b30af7b50). (tmin, tmax, numberOfNasalAntiFormants);
1297 formantsAmplitudes_createcxx . . $ formantsAmplitudes_create(20f2512fed5c7bcc). (& mycxx . . $ `melder/melder.h:44:9`! oral_formants_amplitudes, tmin, tmax, numberOfFormants);
1298 formantsAmplitudes_createcxx . . $ formantsAmplitudes_create(20f2512fed5c7bcc). (& mycxx . . $ `melder/melder.h:44:9`! nasal_formants_amplitudes, tmin, tmax, numberOfNasalFormants);
1299 mycxx . . $ `melder/melder.h:44:9`! options =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). VocalTractGridPlayOptions_createcxx . . $ VocalTractGridPlayOptions_create(ae2a90592c7b8309). ();
1300 VocalTractGrid_setNamescxx . . $ VocalTractGrid_setNames(3d2529f7c469d424). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
1301 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
1302 } catch (MelderErrorcxx . . $ MelderError#) {
1303 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"VocalTractGrid not created.");
1304 }
1305 }
1306
1307 static void VocalTractGrid_CouplingGrid_drawCascade_inplacecxx . . $ VocalTractGrid_CouplingGrid_drawCascade_inplace(7e7c8f605c7af396). (VocalTractGrid me, CouplingGrid thee, Graphicscxx . . $ Graphics# g, double xmin, double xmax, double ymin, double ymax, double *out_yin, double *out_yout) {
1308 const integercxx . . $ integer# numberOfOralFormants = mycxx . . $ `melder/melder.h:44:9`! oral_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1309 const integercxx . . $ integer# numberOfNasalFormants = mycxx . . $ `melder/melder.h:44:9`! nasal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1310 const integercxx . . $ integer# numberOfNasalAntiFormants = mycxx . . $ `melder/melder.h:44:9`! nasal_antiformants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1311 const integercxx . . $ integer# numberOfTrachealFormants = ( thee ? thycxx . . $ `melder/melder.h:45:9`! tracheal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size. : 0 );
1312 const integercxx . . $ integer# numberOfTrachealAntiFormants = ( thee ? thycxx . . $ `melder/melder.h:45:9`! tracheal_antiformants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size. : 0 );
1313 const double ddx = 0.2, ymid = (ymin + ymax) / 2.0;
1314 autoSTRVECcxx . . $ autoSTRVEC# textcxx . . $ _autostringautovector#_autostringautovector(74bdb0c13d8f03c9). { U"TF", U"TAF", U"NF", U"NAF", U""};
1315 autoINTVECcxx . . $ autoINTVEC# nfcxx . . $ autovector#autovector(8de98f561e977378). { numberOfTrachealFormants, numberOfTrachealAntiFormants, numberOfNasalFormants, numberOfNasalAntiFormants, numberOfOralFormants };
1316 autoSTRVECcxx . . $ autoSTRVEC# sectionTextcxx . . $ _autostringautovector#_autostringautovector(1624ee8275b10bda). (3);
1317 autoMelderStringcxx . . $ autoMelderString# ffcxx . . $ autoMelderString#autoMelderString(49f6e7a06ebc5aa8)., fbcxx . . $ autoMelderString#autoMelderString(49f6e7a06ebc5aa8).;
1318 integercxx . . $ integer# nsx = 0;
1319
1320 if (out_yin)
1321 *out_yin = ymid;
1322 if (out_yout)
1323 *out_yout = ymid;
1324 const integercxx . . $ integer# numberOfFilters = numberOfNasalFormants + numberOfNasalAntiFormants + numberOfTrachealFormants + numberOfTrachealAntiFormants + numberOfOralFormants;
1325 double x1, x2;
1326 if (numberOfFilters == 0) {
1327 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, xmin, ymid, xmax, ymid);
1328 return;
1329 }
1330
1331 for (integercxx . . $ integer# isection = 1; isection <= nf.sizecxx . . $ autovector#size.; isection ++)
1332 if (nf [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).isection] > 0)
1333 nsx ++;
1334
1335 const double dx = (xmax - xmin) / (numberOfFilters + 1);
1336 const double boxWidth = (xmax - xmin) / (numberOfFilters + 1 + (nsx - 1) * ddx);
1337 const double oldFontSize = Graphics_inqFontSizecxx . . $ Graphics_inqFontSize(f906975acce41a59). (g);
1338 double newFontSize = Graphics_getFontSizeInsideBoxcxx . . $ Graphics_getFontSizeInsideBox(58355cd5a6d131f). (g, boxWidth, ymax - ymin, 4.0, 4.0);
1339 if (newFontSize < oldFontSize)
1340 Graphics_setFontSizecxx . . $ Graphics_setFontSize(2514a1c07b6be5e2). (g, newFontSize);
1341
1342 x1 = xmin;
1343 for (integercxx . . $ integer# isection = 1; isection <= nf.sizecxx . . $ autovector#size.; isection ++) {
1344 const integercxx . . $ integer# numberOfFormants = nf [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).isection];
1345
1346 if (numberOfFormants == 0)
1347 continue;
1348 sectionText [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).1] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (text [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).isection].getcxx . . $ _autostring#get(5a2a78a048fb49a8).());
1349 for (integercxx . . $ integer# i = 1; i <= numberOfFormants; i ++) {
1350 MelderString_copycxx . . $ MelderString_copy(65be51a793e0ff96). (& ff, U"F", i);
1351 MelderString_copycxx . . $ MelderString_copy(65be51a793e0ff96). (& fb, U"B", i);
1352 sectionText [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).2] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (ff.stringcxx . . $ MelderString#string.);
1353 sectionText [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).3] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (fb.stringcxx . . $ MelderString#string.);
1354 x2 = x1 + boxWidth;
1355 drawLinesInBoxcxx . . $ drawLinesInBox(7482afdee92020f4). (g, x1, x2, ymin, ymax, sectionTextcxx . . $ _conststringvector#_conststringvector(93d9e701af42cb0d)..getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02).());
1356 x1 += dx;
1357 }
1358 x1 += ddx * dx;
1359 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x2, ymid, x1, ymid);
1360 }
1361 if (x1 < xmax)
1362 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x1, ymid, xmax, ymid);
1363 Graphics_setFontSizecxx . . $ Graphics_setFontSize(2514a1c07b6be5e2). (g, oldFontSize);
1364 }
1365
1366 static void VocalTractGrid_CouplingGrid_drawParallel_inplacecxx . . $ VocalTractGrid_CouplingGrid_drawParallel_inplace(aa3dba8479e4b9ca). (VocalTractGrid me, CouplingGrid thee, Graphicscxx . . $ Graphics# g, double xmin, double xmax, double ymin, double ymax, double dy, double *out_yin, double *out_yout) {
1367 const integercxx . . $ integer# numberOfNasalFormants = mycxx . . $ `melder/melder.h:44:9`! nasal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1368 const integercxx . . $ integer# numberOfOralFormants = mycxx . . $ `melder/melder.h:44:9`! oral_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1369 const integercxx . . $ integer# numberOfTrachealFormants = ( thee ? thycxx . . $ `melder/melder.h:45:9`! tracheal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size. : 0 );
1370 const integercxx . . $ integer# numberOfFormants = numberOfNasalFormants + numberOfOralFormants + numberOfTrachealFormants;
1371 const integercxx . . $ integer# numberOfUpperPartFormants = numberOfNasalFormants + ( numberOfOralFormants > 0 ? 1 : 0 );
1372 const integercxx . . $ integer# numberOfLowerPartFormants = numberOfFormants - numberOfUpperPartFormants;
1373 const conststring32cxx . . $ conststring32# text [5] = { nullptr, U"Nasal", U"", U"", U"Tracheal" };
1374 autoINTVECcxx . . $ autoINTVEC# nffrom = {cxx . . $ autovector#autovector(8de98f561e977378). 1, 1, 2, 1 };
1375 autoINTVECcxx . . $ autoINTVEC# nfto = {cxx . . $ autovector#autovector(8de98f561e977378). numberOfNasalFormants, ( numberOfOralFormants > 0 ? 1 : 0 ), numberOfOralFormants, numberOfTrachealFormants };
1376 // (1: hor. line to split) (2: split to diff) (3: diff) (4: diff to split)
1377 // (5: split to filter) (6: filters) (7: conn to summer) (8: summer)
1378 autoVECcxx . . $ autoVEC# relativeWidthscxx . . $ autovector#autovector(8de98f561e977378). { 0.3, 0.2, 1.5, 0.5, 0.5, 1.0, 0.5, 0.5 }, accumulatedWidths = zero_VECcxx . . $ zero_VEC(e4395f764b859b1e). (relativeWidths.sizecxx . . $ autovector#size.);
1379 autoMelderStringcxx . . $ autoMelderString# fbacxx . . $ autoMelderString#autoMelderString(49f6e7a06ebc5aa8).;
1380
1381 scaleRelativeAndAccumulatedWidthscxx . . $ scaleRelativeAndAccumulatedWidths(d9ca4354eebefd12). (relativeWidths.getcxx . . $ autovector#get(e8d1da7fe68a6585).(), accumulatedWidths.getcxx . . $ autovector#get(e8d1da7fe68a6585).(), xmax - xmin);
1382
1383 double y1, y2;
1384 if (numberOfFormants == 0) {
1385 y1 = y2 = (ymin + ymax) / 2.0;
1386 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, xmin, y1, xmax, y1);
1387 if (out_yin)
1388 *out_yin = y1;
1389 if (out_yout)
1390 *out_yout = y2;
1391 return;
1392 }
1393
1394 const double ddy = ( dy < 0 ? 0.0 : dy);
1395 dy = (ymax - ymin) / (numberOfFormants * (1.0 + ddy) - ddy);
1396
1397 const connectionscxx . . $ connections# local_in = connections_createcxx . . $ connections_create(bd2eacb064a285e2). (numberOfFormants);
1398 const connectionscxx . . $ connections# local_out = connections_createcxx . . $ connections_create(bd2eacb064a285e2). (numberOfFormants);
1399
1400 // parallel section
1401 double x1 = xmin + accumulatedWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).5];
1402 double x2 = x1 + relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).6];
1403 y2 = ymax;
1404 double x3 = xmin + accumulatedWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).4];
1405 integercxx . . $ integer# ic = 0;
1406 autoSTRVECcxx . . $ autoSTRVEC# fbLinescxx . . $ _autostringautovector#_autostringautovector(1624ee8275b10bda). (2);
1407 double numberOfCharacters = 9.0 + (numberOfOralFormants < 10 ? 0 : 3 );
1408 double oldFontSize = Graphics_inqFontSizecxx . . $ Graphics_inqFontSize(f906975acce41a59). (g);
1409 double fontSizeFormants = Graphics_getFontSizeInsideBoxcxx . . $ Graphics_getFontSizeInsideBox(58355cd5a6d131f). (g, relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).6], dy, numberOfCharacters, 2.5);
1410 const double fontSizePreEmphasis = Graphics_getFontSizeInsideBoxcxx . . $ Graphics_getFontSizeInsideBox(58355cd5a6d131f). (g, relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).3], dy, 13.0, 1.5);
1411 double newFontSize = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a). (fontSizePreEmphasis, fontSizeFormants);
1412 if (newFontSize < oldFontSize)
1413 Graphics_setFontSizecxx . . $ Graphics_setFontSize(2514a1c07b6be5e2). (g, newFontSize);
1414
1415 for (integercxx . . $ integer# isection = 1; isection <= nffrom.sizecxx . . $ autovector#size.; isection ++) {
1416 const integercxx . . $ integer# ifrom = nffrom [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).isection], ito = nfto [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).isection];
1417 if (ito < ifrom)
1418 continue;
1419 fbLines [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).1] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (text [isection]);
1420 for (integercxx . . $ integer# i = ifrom; i <= ito; i ++) {
1421 y1 = y2 - dy;
1422 const double ymid = (y1 + y2) / 2.0;
1423 const conststring32cxx . . $ conststring32# fi = Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). (i);
1424 MelderString_copycxx . . $ MelderString_copy(65be51a793e0ff96). (& fba, U"A", fi, U" F", fi, U" B", fi);
1425 fbLines [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).2] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (fba.stringcxx . . $ MelderString#string.);
1426 drawLinesInBoxcxx . . $ drawLinesInBox(7482afdee92020f4). (g, x1, x2, y1, y2, fbLinescxx . . $ _conststringvector#_conststringvector(93d9e701af42cb0d)..getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02).());
1427 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x3, ymid, x1, ymid); // to the left
1428 ic ++;
1429 local_in -> xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ic] = x3;
1430 local_out -> xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ic] = x2;
1431 local_in -> ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ic] = local_out -> ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ic] = ymid;
1432 y2 = y1 - 0.5 * dy;
1433 }
1434 }
1435
1436 ic = 0;
1437 x1 = local_in -> ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1];
1438 if (numberOfUpperPartFormants > 0) {
1439 x1 = local_in -> xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).numberOfUpperPartFormants];
1440 y1 = local_in -> ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).numberOfUpperPartFormants];
1441 if (numberOfUpperPartFormants > 1)
1442 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x1, y1, local_in -> xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1], local_in -> ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1]); // vertical
1443 x2 = xmin;
1444 if (numberOfLowerPartFormants > 0)
1445 x2 += relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1];
1446 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x1, y1, x2, y1); // done
1447 }
1448 if (numberOfLowerPartFormants > 0) {
1449 const integercxx . . $ integer# ifrom = numberOfUpperPartFormants + 1;
1450 x1 = local_in -> xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ifrom];
1451 y1 = local_in -> ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ifrom]; // at the split
1452 if (numberOfLowerPartFormants > 1)
1453 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x1, y1, local_in -> xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).numberOfFormants], local_in -> ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).numberOfFormants]); // vertical
1454 x2 = xmin + accumulatedWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).3]; // right of diff
1455 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x1, y1, x2, y1); // from vertical to diff
1456 x1 = xmin + accumulatedWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2]; // left of diff
1457 autoSTRVECcxx . . $ autoSTRVEC# preEmphasisLinecxx . . $ _autostringautovector#_autostringautovector(74bdb0c13d8f03c9). { U"Pre-emphasis" };
1458 drawLinesInBoxcxx . . $ drawLinesInBox(7482afdee92020f4). (g, x1, x2, y1 + 0.5 * dy, y1 - 0.5 * dy, preEmphasisLinecxx . . $ _conststringvector#_conststringvector(93d9e701af42cb0d)..getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02).());
1459 x2 = x1;
1460 if (numberOfUpperPartFormants > 0) {
1461 x2 = xmin + relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1];
1462 y2 = y1; // at split
1463 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x1, y1, x2, y1); // to split
1464 y1 += (1 + ddy) * dy;
1465 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x2, y2, x2, y1); // vertical
1466 y1 -= 0.5 * (1.0 + ddy) * dy;
1467 }
1468 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, xmin, y1, x2, y1);
1469 }
1470
1471 const double r = relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).8] / 2.0;
1472 x2 = xmax - r;
1473 y2 = (ymin + ymax) / 2.0;
1474
1475 alternatingSummer_drawConnectionscxx . . $ alternatingSummer_drawConnections(45f02620acd1b9a1). (g, x2, y2, r, local_out, true, 0.4);
1476
1477 connections_freecxx . . $ connections_free(5c23632b7bdbbe2b). (local_out);
1478 connections_freecxx . . $ connections_free(5c23632b7bdbbe2b). (local_in);
1479 Graphics_setFontSizecxx . . $ Graphics_setFontSize(2514a1c07b6be5e2). (g, oldFontSize);
1480 if (out_yin)
1481 *out_yin = y1;
1482 if (out_yout)
1483 *out_yout = y2;
1484 }
1485
1486 static void VocalTractGrid_CouplingGrid_draw_insidecxx . . $ VocalTractGrid_CouplingGrid_draw_inside(9a00d6c023e180ac). (VocalTractGrid me, CouplingGrid thee, Graphicscxx . . $ Graphics# g, kKlattGridFilterModelcxx . . $ kKlattGridFilterModel# filterModel, double xmin, double xmax, double ymin, double ymax, double dy, double *out_yin, double *out_yout) {
1487 if (filterModel == kKlattGridFilterModelcxx . . $ kKlattGridFilterModel#::CASCADEcxx . . $ kKlattGridFilterModel#CASCADE.)
1488 VocalTractGrid_CouplingGrid_drawCascade_inplacecxx . . $ VocalTractGrid_CouplingGrid_drawCascade_inplace(7e7c8f605c7af396). (me, thee, g, xmin, xmax, ymin, ymax, out_yin, out_yout);
1489 else if (filterModel == kKlattGridFilterModelcxx . . $ kKlattGridFilterModel#::PARALLELcxx . . $ kKlattGridFilterModel#PARALLEL.)
1490 VocalTractGrid_CouplingGrid_drawParallel_inplacecxx . . $ VocalTractGrid_CouplingGrid_drawParallel_inplace(aa3dba8479e4b9ca). (me, thee, g, xmin, xmax, ymin, ymax, dy, out_yin, out_yout);
1491 else
1492 ;// Not valid
1493 }
1494
1495 static void VocalTractGrid_CouplingGrid_drawcxx . . $ VocalTractGrid_CouplingGrid_draw(dbb176e308ddbe60). (VocalTractGrid me, CouplingGrid thee, Graphicscxx . . $ Graphics# g, kKlattGridFilterModelcxx . . $ kKlattGridFilterModel# filterModel) {
1496 const double xmin = 0.0, xmin1 = 0.05, xmax1 = 0.95, xmax = 1.0, ymin = 0.0, ymax = 1.0, dy = 0.5;
1497
1498 Graphics_setInnercxx . . $ Graphics_setInner(2d838ed765120c5d). (g);
1499 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (g, xmin, xmax, ymin, ymax);
1500 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (g, kGraphics_horizontalAlignmentcxx . . $ kGraphics_horizontalAlignment#::CENTREcxx . . $ kGraphics_horizontalAlignment#CENTRE., Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!);
1501 Graphics_setLineWidthcxx . . $ Graphics_setLineWidth(2514a1c07b6be5e2). (g, 2);
1502 double yin, yout;
1503 VocalTractGrid_CouplingGrid_draw_insidecxx . . $ VocalTractGrid_CouplingGrid_draw_inside(9a00d6c023e180ac). (me, thee, g, filterModel, xmin1, xmax1, ymin, ymax, dy, & yin, & yout);
1504 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, xmin, yin, xmin1, yin);
1505 Graphics_arrowcxx . . $ Graphics_arrow(72bdb7937dbb13da). (g, xmax1, yout, xmax, yout);
1506 Graphics_unsetInnercxx . . $ Graphics_unsetInner(2d838ed765120c5d). (g);
1507 }
1508
1509 static autoSoundcxx . . $ autoSound# Sound_VocalTractGrid_CouplingGrid_filter_cascadecxx . . $ Sound_VocalTractGrid_CouplingGrid_filter_cascade(51132d8301f8bc48). (Soundcxx . . $ Sound# me, VocalTractGrid thee, CouplingGrid coupling) {
1510 try {
1511 const VocalTractGridPlayOptions pv = thycxx . . $ `melder/melder.h:45:9`! options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1512 const CouplingGridPlayOptions pc = coupling -> options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1513 const bool useOpenGlottisInfo = pc -> openglottis && coupling && coupling -> glottis && coupling -> glottis ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). points.sizecxx . . $ CollectionOf#size. > 0;
1514 const FormantGridcxx . . $ FormantGrid# oral_formants = thycxx . . $ `melder/melder.h:45:9`! oral_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1515 const FormantGridcxx . . $ FormantGrid# nasal_formants = thycxx . . $ `melder/melder.h:45:9`! nasal_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1516 const FormantGridcxx . . $ FormantGrid# nasal_antiformants = thycxx . . $ `melder/melder.h:45:9`! nasal_antiformants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1517 const FormantGridcxx . . $ FormantGrid# tracheal_formants = coupling -> tracheal_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1518 const FormantGridcxx . . $ FormantGrid# tracheal_antiformants = coupling -> tracheal_antiformants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1519
1520 const integercxx . . $ integer# numberOfFormants = oral_formants -> formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1521 const integercxx . . $ integer# numberOfTrachealFormants = tracheal_formants -> formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1522 const integercxx . . $ integer# numberOfTrachealAntiFormants = tracheal_antiformants -> formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1523 const integercxx . . $ integer# numberOfNasalFormants = nasal_formants -> formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1524 const integercxx . . $ integer# numberOfNasalAntiFormants = nasal_antiformants -> formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1525 check_formantscxx . . $ check_formants(b76a3bd1263aa692). (numberOfFormants, & pv -> startOralFormant, & pv -> endOralFormant);
1526 check_formantscxx . . $ check_formants(b76a3bd1263aa692). (numberOfNasalFormants, & pv -> startNasalFormant, & pv -> endNasalFormant);
1527 check_formantscxx . . $ check_formants(b76a3bd1263aa692). (numberOfTrachealFormants, & pc -> startTrachealFormant, & pc -> endTrachealFormant);
1528 check_formantscxx . . $ check_formants(b76a3bd1263aa692). (numberOfNasalAntiFormants, & pv -> startNasalAntiFormant, & pv -> endNasalAntiFormant);
1529 check_formantscxx . . $ check_formants(b76a3bd1263aa692). (numberOfTrachealAntiFormants, & pc -> startTrachealAntiFormant, & pc -> endTrachealAntiFormant);
1530
1531 autoSoundcxx . . $ autoSound# him = Data_copycxx . . $ Data_copy(97a542a26794c80e). (me);
1532
1533 autoFormantGridcxx . . $ autoFormantGrid# formantscxx . . $ autoSomeThing#autoSomeThing(49f6e7a06ebc5aa8).;
1534 if (useOpenGlottisInfo) {
1535 formants =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (thycxx . . $ `melder/melder.h:45:9`! oral_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
1536 FormantGrid_CouplingGrid_updateOpenPhasescxx . . $ FormantGrid_CouplingGrid_updateOpenPhases(2c9adfc90b41d318). (formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), coupling);
1537 }
1538
1539 integercxx . . $ integer# nasal_formant_warning = 0, any_warning = 0;
1540 if (pv -> endNasalFormant > 0) { // nasal formants
1541 for (integercxx . . $ integer# iformant = pv -> startNasalFormant; iformant <= pv -> endNasalFormant; iformant ++) {
1542 if (FormantGrid_isFormantDefinedcxx . . $ FormantGrid_isFormantDefined(4af5946d6a620ee5). (thycxx . . $ `melder/melder.h:45:9`! nasal_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), iformant)) {
1543 _Sound_FormantGrid_filterWithOneFormant_inplacecxx . . $ _Sound_FormantGrid_filterWithOneFormant_inplace(60905d3b6f56d980). (him.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), thycxx . . $ `melder/melder.h:45:9`! nasal_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), iformant, false);
1544 } else {
1545 // Melder_warning ("Nasal formant", iformant, ": frequency and/or bandwidth missing.");
1546 nasal_formant_warning ++;
1547 any_warning ++;
1548 }
1549 }
1550 }
1551
1552 integercxx . . $ integer# nasal_antiformant_warning = 0;
1553 if (pv -> endNasalAntiFormant > 0) { // nasal antiformants
1554 for (integercxx . . $ integer# iformant = pv -> startNasalAntiFormant; iformant <= pv -> endNasalAntiFormant; iformant ++) {
1555 if (FormantGrid_isFormantDefinedcxx . . $ FormantGrid_isFormantDefined(4af5946d6a620ee5). (thycxx . . $ `melder/melder.h:45:9`! nasal_antiformants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), iformant)) {
1556 _Sound_FormantGrid_filterWithOneFormant_inplacecxx . . $ _Sound_FormantGrid_filterWithOneFormant_inplace(60905d3b6f56d980). (him.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), thycxx . . $ `melder/melder.h:45:9`! nasal_antiformants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), iformant, true);
1557 } else {
1558 // Melder_warning ("Nasal antiformant", iformant, ": frequency and/or bandwidth missing.");
1559 nasal_antiformant_warning ++;
1560 any_warning ++;
1561 }
1562 }
1563 }
1564
1565 integercxx . . $ integer# tracheal_formant_warning = 0;
1566 if (pc -> endTrachealFormant > 0) { // tracheal formants
1567 for (integercxx . . $ integer# iformant = pc -> startTrachealFormant; iformant <= pc -> endTrachealFormant; iformant ++) {
1568 if (FormantGrid_isFormantDefinedcxx . . $ FormantGrid_isFormantDefined(4af5946d6a620ee5). (tracheal_formants, iformant)) {
1569 _Sound_FormantGrid_filterWithOneFormant_inplacecxx . . $ _Sound_FormantGrid_filterWithOneFormant_inplace(60905d3b6f56d980). (him.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tracheal_formants, iformant, false);
1570 } else {
1571 // Melder_warning ("Tracheal formant", iformant, ": frequency and/or bandwidth missing.");
1572 tracheal_formant_warning ++;
1573 any_warning ++;
1574 }
1575 }
1576 }
1577
1578 integercxx . . $ integer# tracheal_antiformant_warning = 0;
1579 if (pc -> endTrachealAntiFormant > 0) { // tracheal antiformants
1580 for (integercxx . . $ integer# iformant = pc -> startTrachealAntiFormant; iformant <= pc -> endTrachealAntiFormant; iformant ++) {
1581 if (FormantGrid_isFormantDefinedcxx . . $ FormantGrid_isFormantDefined(4af5946d6a620ee5). (tracheal_antiformants, iformant)) {
1582 _Sound_FormantGrid_filterWithOneFormant_inplacecxx . . $ _Sound_FormantGrid_filterWithOneFormant_inplace(60905d3b6f56d980). (him.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tracheal_antiformants, iformant, true);
1583 } else {
1584 // Melder_warning ("Tracheal antiformant", iformant, ": frequency and/or bandwidth missing.");
1585 tracheal_antiformant_warning ++;
1586 any_warning ++;
1587 }
1588 }
1589 }
1590
1591 integercxx . . $ integer# oral_formant_warning = 0;
1592 if (pv -> endOralFormant > 0) { // oral formants
1593 if (! formants)
1594 formants =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (thycxx . . $ `melder/melder.h:45:9`! oral_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
1595
1596 for (integercxx . . $ integer# iformant = pv -> startOralFormant; iformant <= pv -> endOralFormant; iformant ++) {
1597 if (FormantGrid_isFormantDefinedcxx . . $ FormantGrid_isFormantDefined(4af5946d6a620ee5). (formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), iformant)) {
1598 _Sound_FormantGrid_filterWithOneFormant_inplacecxx . . $ _Sound_FormantGrid_filterWithOneFormant_inplace(60905d3b6f56d980). (him.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), iformant, false);
1599 } else {
1600 // Melder_warning ("Oral formant", iformant, ": frequency and/or bandwidth missing.");
1601 oral_formant_warning ++;
1602 any_warning ++;
1603 }
1604 }
1605 }
1606 if (any_warning > 0)
1607 {
1608 autoMelderStringcxx . . $ autoMelderString# warningcxx . . $ autoMelderString#autoMelderString(49f6e7a06ebc5aa8).;
1609 if (nasal_formant_warning > 0)
1610 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& warning, U"\tNasal formants: one or more are missing.\n");
1611 if (nasal_antiformant_warning)
1612 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& warning, U"\tNasal antiformants: one or more are missing.\n");
1613 if (tracheal_formant_warning)
1614 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& warning, U"\tTracheal formants: one or more are missing.\n");
1615 if (tracheal_antiformant_warning)
1616 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& warning, U"\tTracheal antiformants: one or more are missing.\n");
1617 if (oral_formant_warning)
1618 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& warning, U"\tOral formants: one or more are missing.\n");
1619 MelderInfo_writecxx . . $ MelderInfo_write(3eb398314feba58b). (U"\nWarning:\n", warning.stringcxx . . $ MelderString#string.);
1620 MelderInfo_draincxx . . $ MelderInfo_drain(49f6e7a06ebc5aa8). ();
1621 }
1622 return himcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
1623 } catch (MelderErrorcxx . . $ MelderError#) {
1624 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not filtered by vocaltract and coupling grid.");
1625 }
1626 }
1627
1628 static autoSoundcxx . . $ autoSound# Sound_VocalTractGrid_CouplingGrid_filter_parallelcxx . . $ Sound_VocalTractGrid_CouplingGrid_filter_parallel(51132d8301f8bc48). (Soundcxx . . $ Sound# me, VocalTractGrid thee, CouplingGrid coupling) {
1629 try {
1630 const VocalTractGridPlayOptions pv = thycxx . . $ `melder/melder.h:45:9`! options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1631 const CouplingGridPlayOptions pc = coupling -> options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1632 autoSoundcxx . . $ autoSound# himcxx . . $ autoSomeThing#autoSomeThing(49f6e7a06ebc5aa8).;
1633 FormantGridcxx . . $ FormantGrid# oral_formants = thycxx . . $ `melder/melder.h:45:9`! oral_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1634 autoFormantGridcxx . . $ autoFormantGrid# aofcxx . . $ autoSomeThing#autoSomeThing(49f6e7a06ebc5aa8).;
1635 int alternatingSign = 0; // 0: no alternating signs in parallel adding of filter outputs, 1/-1 start sign
1636 const bool useOpenGlottisInfo = pc -> openglottis && coupling -> glottis && coupling -> glottis ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). points.sizecxx . . $ CollectionOf#size. > 0;
1637 int scale = 1;
1638 const integercxx . . $ integer# numberOfFormants = thycxx . . $ `melder/melder.h:45:9`! oral_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1639 const integercxx . . $ integer# numberOfNasalFormants = thycxx . . $ `melder/melder.h:45:9`! nasal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1640 const integercxx . . $ integer# numberOfTrachealFormants = coupling -> tracheal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1641
1642 check_formantscxx . . $ check_formants(b76a3bd1263aa692). (numberOfFormants, & (pv -> startOralFormant), & (pv -> endOralFormant));
1643 check_formantscxx . . $ check_formants(b76a3bd1263aa692). (numberOfNasalFormants, & (pv -> startNasalFormant), & (pv -> endNasalFormant));
1644 check_formantscxx . . $ check_formants(b76a3bd1263aa692). (numberOfTrachealFormants, & (pc -> startTrachealFormant), & (pc -> endTrachealFormant));
1645
1646 if (useOpenGlottisInfo) {
1647 aof =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (thycxx . . $ `melder/melder.h:45:9`! oral_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
1648 oral_formants = aof.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1649 FormantGrid_CouplingGrid_updateOpenPhasescxx . . $ FormantGrid_CouplingGrid_updateOpenPhases(2c9adfc90b41d318). (oral_formants, coupling);
1650 }
1651
1652 if (pv -> endOralFormant > 0) {
1653 if (pv -> startOralFormant == 1) {
1654 him =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (me);
1655 if (oral_formants -> formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size. > 0)
1656 Sound_FormantGrid_Intensities_filterWithOneFormant_inplacecxx . . $ Sound_FormantGrid_Intensities_filterWithOneFormant_inplace(f9fcc884e7918fa4). (him.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), oral_formants, & thycxx . . $ `melder/melder.h:45:9`! oral_formants_amplitudes, 1);
1657 }
1658 }
1659
1660 if (pv -> endNasalFormant > 0) {
1661 alternatingSign = 0;
1662 autoSoundcxx . . $ autoSound# nasal = Sound_FormantGrid_Intensities_filtercxx . . $ Sound_FormantGrid_Intensities_filter(b5a7075cec170387). (me, thycxx . . $ `melder/melder.h:45:9`! nasal_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), & thycxx . . $ `melder/melder.h:45:9`! nasal_formants_amplitudes, pv -> startNasalFormant, pv -> endNasalFormant, alternatingSign);
1663
1664 if (! him)
1665 him =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (nasal.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
1666 else
1667 _Sounds_add_inplacecxx . . $ _Sounds_add_inplace(3740d3b02ef916dc). (him.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), nasal.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
1668 }
1669
1670 // Formants 2 and up, with alternating signs.
1671 // We perform pre-emphasis by differentiating.
1672 // Klatt (1980) states that a first difference for the higher formants is necessary to remove low-frequency
1673 // energy from them. This energy would otherwise distort the spectrum in the region of F1 during the synthesis
1674 // of some vowels.
1675
1676 autoSoundcxx . . $ autoSound# me_diff = _Sound_diffcxx . . $ _Sound_diff(c027fb02721117d5). (me, scale);
1677
1678 if (pv -> endOralFormant >= 2) {
1679 const integercxx . . $ integer# startOralFormant2 = ( pv -> startOralFormant > 2 ? pv -> startOralFormant : 2 );
1680 alternatingSign = ( startOralFormant2 % 2 == 0 ? -1 : 1 ); // 2 starts with negative sign
1681 if (startOralFormant2 <= oral_formants -> formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.) {
1682 autoSoundcxx . . $ autoSound# vocalTract = Sound_FormantGrid_Intensities_filtercxx . . $ Sound_FormantGrid_Intensities_filter(b5a7075cec170387). (me_diff.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), oral_formants, & thycxx . . $ `melder/melder.h:45:9`! oral_formants_amplitudes, startOralFormant2, pv -> endOralFormant, alternatingSign);
1683
1684 if (! him)
1685 him =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (vocalTract.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
1686 else
1687 _Sounds_add_inplacecxx . . $ _Sounds_add_inplace(3740d3b02ef916dc). (him.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), vocalTract.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
1688 }
1689 }
1690
1691 if (pc -> endTrachealFormant > 0) { // tracheal formants
1692 alternatingSign = 0;
1693 autoSoundcxx . . $ autoSound# trachea = Sound_FormantGrid_Intensities_filtercxx . . $ Sound_FormantGrid_Intensities_filter(b5a7075cec170387). (me_diff.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), coupling -> tracheal_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(),
1694 & coupling -> tracheal_formants_amplitudes,
1695 pc -> startTrachealFormant, pc -> endTrachealFormant, alternatingSign);
1696
1697 if (! him)
1698 him =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (trachea.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
1699 else
1700 _Sounds_add_inplacecxx . . $ _Sounds_add_inplace(3740d3b02ef916dc). (him.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), trachea.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
1701 }
1702
1703 if (! him)
1704 him =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (me);
1705 return himcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
1706 } catch (MelderErrorcxx . . $ MelderError#) {
1707 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not filtered in parallel.");
1708 }
1709 }
1710
1711 autoSoundcxx . . $ autoSound# Sound_VocalTractGrid_CouplingGrid_filtercxx . . $ Sound_VocalTractGrid_CouplingGrid_filter(51132d8301f8bc48). (Soundcxx . . $ Sound# me, VocalTractGrid thee, CouplingGrid coupling) {
1712 return thycxx . . $ `melder/melder.h:45:9`! options ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). filterModel == kKlattGridFilterModelcxx . . $ kKlattGridFilterModel#::CASCADEcxx . . $ kKlattGridFilterModel#CASCADE. ?
1713 Sound_VocalTractGrid_CouplingGrid_filter_cascadecxx . . $ Sound_VocalTractGrid_CouplingGrid_filter_cascade(51132d8301f8bc48). (me, thee, coupling) :
1714 Sound_VocalTractGrid_CouplingGrid_filter_parallelcxx . . $ Sound_VocalTractGrid_CouplingGrid_filter_parallel(51132d8301f8bc48). (me, thee, coupling);
1715 }
1716
1717 /********************** CouplingGridPlayOptions **********************/
1718
1719 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (CouplingGridPlayOptions, Daata, 0);
1720
1721 static void CouplingGridPlayOptions_setDefaultscxx . . $ CouplingGridPlayOptions_setDefaults(d6a4c69477c8deb1). (CouplingGridPlayOptions me, CouplingGrid thee) {
1722 mycxx . . $ `melder/melder.h:44:9`! fadeFraction = 0.1;
1723 mycxx . . $ `melder/melder.h:44:9`! openglottis = 1;
1724 mycxx . . $ `melder/melder.h:44:9`! endTrachealFormant = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a). (thycxx . . $ `melder/melder.h:45:9`! tracheal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size., thycxx . . $ `melder/melder.h:45:9`! tracheal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bandwidthscxx . . $ structFormantGrid#bandwidths..sizecxx . . $ CollectionOf#size.);
1725 mycxx . . $ `melder/melder.h:44:9`! startTrachealFormant = 1;
1726 mycxx . . $ `melder/melder.h:44:9`! endTrachealAntiFormant = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a). (thycxx . . $ `melder/melder.h:45:9`! tracheal_antiformants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size., thycxx . . $ `melder/melder.h:45:9`! tracheal_antiformants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bandwidthscxx . . $ structFormantGrid#bandwidths..sizecxx . . $ CollectionOf#size.);
1727 mycxx . . $ `melder/melder.h:44:9`! startTrachealAntiFormant = 1;
1728 mycxx . . $ `melder/melder.h:44:9`! startDeltaFormant = 1;
1729 mycxx . . $ `melder/melder.h:44:9`! endDeltaFormant = thycxx . . $ `melder/melder.h:45:9`! delta_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1730 mycxx . . $ `melder/melder.h:44:9`! startDeltaBandwidth = 1;
1731 mycxx . . $ `melder/melder.h:44:9`! endDeltaBandwidth = thycxx . . $ `melder/melder.h:45:9`! delta_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bandwidthscxx . . $ structFormantGrid#bandwidths..sizecxx . . $ CollectionOf#size.;
1732 }
1733
1734 autoCouplingGridPlayOptions CouplingGridPlayOptions_createcxx . . $ CouplingGridPlayOptions_create(bfe6d719d1029cc3). () {
1735 try {
1736 autoCouplingGridPlayOptions me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (CouplingGridPlayOptions);
1737 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
1738 } catch (MelderErrorcxx . . $ MelderError#) {
1739 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"CouplingGridPlayOptions not created.");
1740 }
1741 }
1742
1743 /********************** CouplingGrid *************************************/
1744
1745 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (CouplingGrid, Function, 0);
1746
1747 void structCouplingGrid :: v1_info () {
1748 structDaatacxx . . $ structDaata# :: v1_infocxx . . $ structThing#v1_info(49f6e7a06ebc5aa8). ();
1749 conststring32cxx . . $ conststring32# in1 = U" ", in2 = U" ", in3 = U" ";
1750 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in1, U"Time domain:");
1751 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"Start time: ", xmincxx . . $ structFunction#xmin., U" seconds");
1752 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"End time: ", xmaxcxx . . $ structFunction#xmax., U" seconds");
1753 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"Total duration: ", xmaxcxx . . $ structFunction#xmax. - xmincxx . . $ structFunction#xmin., U" seconds");
1754 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in1, U"\nNumber of points in the TRACHEAL FORMANT tiers:");
1755 FormantGrid_infocxx . . $ FormantGrid_info(75b679a5faacbdd4). (ourcxx . . $ `melder/melder.h:42:9`! tracheal_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), & tracheal_formants_amplitudes, in2, in3);
1756 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in1, U"\nNumber of points in the TRACHEAL ANTIFORMANT tiers:");
1757 FormantGrid_infocxx . . $ FormantGrid_info(75b679a5faacbdd4). (ourcxx . . $ `melder/melder.h:42:9`! tracheal_antiformants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), nullptr, in2, in3);
1758 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in1, U"\nNumber of points in the DELTA FORMANT tiers:");
1759 FormantGrid_infocxx . . $ FormantGrid_info(75b679a5faacbdd4). (ourcxx . . $ `melder/melder.h:42:9`! delta_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), nullptr, in2, in3);
1760 }
1761
1762 void CouplingGrid_setNamescxx . . $ CouplingGrid_setNames(308a3c41555c96a5). (CouplingGrid me) {
1763 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! tracheal_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"tracheal_formants");
1764 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! tracheal_antiformants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"tracheal_antiformants");
1765 //Thing_setName (my tracheal_formants_amplitudes.get(), U"tracheal_formants_amplitudes");
1766 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! delta_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"delta_formants");
1767 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! glottis.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"glottis");
1768 }
1769
1770 autoCouplingGrid CouplingGrid_createcxx . . $ CouplingGrid_create(502c0db2238ea6a8). (double tmin, double tmax, integercxx . . $ integer# numberOfTrachealFormants, integercxx . . $ integer# numberOfTrachealAntiFormants, integercxx . . $ integer# numberOfDeltaFormants) {
1771 try {
1772 autoCouplingGrid me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (CouplingGrid);
1773 Function_initcxx . . $ Function_init(ac72a71dd6ac1bfb). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tmin, tmax);
1774 mycxx . . $ `melder/melder.h:44:9`! tracheal_formants =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). FormantGrid_createEmptycxx . . $ FormantGrid_createEmpty(73275a7b30af7b50). (tmin, tmax, numberOfTrachealFormants);
1775 mycxx . . $ `melder/melder.h:44:9`! tracheal_antiformants =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). FormantGrid_createEmptycxx . . $ FormantGrid_createEmpty(73275a7b30af7b50). (tmin, tmax, numberOfTrachealAntiFormants);
1776 formantsAmplitudes_createcxx . . $ formantsAmplitudes_create(20f2512fed5c7bcc). (& mycxx . . $ `melder/melder.h:44:9`! tracheal_formants_amplitudes, tmin, tmax, numberOfTrachealFormants);
1777 mycxx . . $ `melder/melder.h:44:9`! delta_formants =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). FormantGrid_createEmptycxx . . $ FormantGrid_createEmpty(73275a7b30af7b50). (tmin, tmax, numberOfDeltaFormants);
1778 mycxx . . $ `melder/melder.h:44:9`! glottis =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). PhonationTier_createcxx . . $ PhonationTier_create(32c525becfbb2d10). (tmin, tmax);
1779 mycxx . . $ `melder/melder.h:44:9`! options =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). CouplingGridPlayOptions_createcxx . . $ CouplingGridPlayOptions_create(bfe6d719d1029cc3). ();
1780 CouplingGrid_setNamescxx . . $ CouplingGrid_setNames(308a3c41555c96a5). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
1781 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
1782 } catch (MelderErrorcxx . . $ MelderError#) {
1783 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"CouplingGrid not created.");
1784 }
1785 }
1786
1787 /********************** FormantGrid & CouplingGrid *************************************/
1788
1789 void FormantGrid_CouplingGrid_updateOpenPhasescxx . . $ FormantGrid_CouplingGrid_updateOpenPhases(2c9adfc90b41d318). (FormantGridcxx . . $ FormantGrid# me, CouplingGrid thee) {
1790 try {
1791 CouplingGridPlayOptions pc = thycxx . . $ `melder/melder.h:45:9`! options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1792 for (integercxx . . $ integer# itier = 1; itier <= thycxx . . $ `melder/melder.h:45:9`! delta_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.; itier ++) {
1793 RealTiercxx . . $ RealTier# delta = thycxx . . $ `melder/melder.h:45:9`! delta_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).itier];
1794 if (itier <= mycxx . . $ `melder/melder.h:44:9`! formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.) {
1795 if (delta -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0) {
1796 autoRealTiercxx . . $ autoRealTier# rt = RealTier_updateWithDeltacxx . . $ RealTier_updateWithDelta(43cbe50096b5b09d). (mycxx . . $ `melder/melder.h:44:9`! formantscxx . . $ structFormantGrid#formants..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).itier], delta, thycxx . . $ `melder/melder.h:45:9`! glottis.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pc -> fadeFraction);
1797 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (RealTier_valuesInRange (rt.get(), 0, undefined),
1798 U"Formant ", itier, U" coupling should not give negative values.");
1799
1800 mycxx . . $ `melder/melder.h:44:9`! formantscxx . . $ structFormantGrid#formants.. replaceItem_movecxx . . $ CollectionOf#replaceItem_move(ca501a207ce7a6c1). (rtcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).(), itier);
1801 }
1802 }
1803 delta = thycxx . . $ `melder/melder.h:45:9`! delta_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bandwidthscxx . . $ structFormantGrid#bandwidths..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).itier];
1804 if (itier <= mycxx . . $ `melder/melder.h:44:9`! bandwidthscxx . . $ structFormantGrid#bandwidths..sizecxx . . $ CollectionOf#size.) {
1805 if (delta -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0) {
1806 autoRealTiercxx . . $ autoRealTier# rt = RealTier_updateWithDeltacxx . . $ RealTier_updateWithDelta(43cbe50096b5b09d). (mycxx . . $ `melder/melder.h:44:9`! bandwidthscxx . . $ structFormantGrid#bandwidths..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).itier], delta, thycxx . . $ `melder/melder.h:45:9`! glottis.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pc -> fadeFraction);
1807 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (RealTier_valuesInRange (rt.get(), 0, undefined),
1808 U"Bandwidth ", itier, U" coupling gives negative values.");
1809 mycxx . . $ `melder/melder.h:44:9`! bandwidthscxx . . $ structFormantGrid#bandwidths.. replaceItem_movecxx . . $ CollectionOf#replaceItem_move(ca501a207ce7a6c1). (rtcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).(), itier);
1810 }
1811 }
1812 }
1813 } catch (MelderErrorcxx . . $ MelderError#) {
1814 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not updated with open hase information.");
1815 }
1816 }
1817
1818 /********************** FricationGridPlayOptions **********************/
1819
1820 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (FricationGridPlayOptions, Daata, 0);
1821
1822 static void FricationGridPlayOptions_setDefaultscxx . . $ FricationGridPlayOptions_setDefaults(122cf50fa96454a9). (FricationGridPlayOptions me, FricationGrid thee) {
1823 mycxx . . $ `melder/melder.h:44:9`! endFricationFormant = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a). (thycxx . . $ `melder/melder.h:45:9`! frication_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size., thycxx . . $ `melder/melder.h:45:9`! frication_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bandwidthscxx . . $ structFormantGrid#bandwidths..sizecxx . . $ CollectionOf#size.);
1824 mycxx . . $ `melder/melder.h:44:9`! startFricationFormant = 2;
1825 mycxx . . $ `melder/melder.h:44:9`! bypass = 1;
1826 }
1827
1828 autoFricationGridPlayOptions FricationGridPlayOptions_createcxx . . $ FricationGridPlayOptions_create(e74247a1df0f85df). () {
1829 try {
1830 autoFricationGridPlayOptions me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (FricationGridPlayOptions);
1831 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
1832 } catch (MelderErrorcxx . . $ MelderError#) {
1833 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"FricationGridPlayOptions not created.");
1834 }
1835 }
1836
1837 /************************ FricationGrid (& Sound) *********************************************/
1838
1839 void structFricationGrid :: v1_info () {
1840 structDaatacxx . . $ structDaata# :: v1_infocxx . . $ structThing#v1_info(49f6e7a06ebc5aa8). ();
1841 const static char32cxx . . $ char32# *in1 = U" ", *in2 = U" ", *in3 = U" ";
1842 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in1, U"Time domain:");
1843 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"Start time: ", xmincxx . . $ structFunction#xmin., U" seconds");
1844 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"End time: ", xmaxcxx . . $ structFunction#xmax., U" seconds");
1845 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"Total duration: ", xmaxcxx . . $ structFunction#xmax. - xmincxx . . $ structFunction#xmin., U" seconds");
1846 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in1, U"\nNumber of points in the FRICATION tiers:");
1847 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"fricationAmplitude: ", fricationAmplitude ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
1848 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in2, U"bypass: ", bypass ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.);
1849 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (in1, U"\nNumber of points in the FRICATION FORMANT tiers:");
1850 FormantGrid_infocxx . . $ FormantGrid_info(75b679a5faacbdd4). (ourcxx . . $ `melder/melder.h:42:9`! frication_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), & ourcxx . . $ `melder/melder.h:42:9`! frication_formants_amplitudes, in2, in3);
1851 }
1852
1853 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (FricationGrid, Function, 0);
1854
1855 void FricationGrid_setNamescxx . . $ FricationGrid_setNames(ea8cb882e1da8e26). (FricationGrid me) {
1856 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! fricationAmplitude.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"fricationAmplitude");
1857 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! frication_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"frication_formants");
1858 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! bypass.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"bypass");
1859 //Thing_setName (my frication_formants_amplitudes.get(), U"frication_formants_amplitudes");
1860 }
1861
1862 autoFricationGrid FricationGrid_createcxx . . $ FricationGrid_create(bb0e3bcfa5311da1). (double tmin, double tmax, integercxx . . $ integer# numberOfFormants) {
1863 try {
1864 autoFricationGrid me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (FricationGrid);
1865 Function_initcxx . . $ Function_init(ac72a71dd6ac1bfb). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tmin, tmax);
1866 mycxx . . $ `melder/melder.h:44:9`! fricationAmplitude =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). IntensityTier_createcxx . . $ IntensityTier_create(3d279d9ea4a74662). (tmin, tmax);
1867 mycxx . . $ `melder/melder.h:44:9`! frication_formants =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). FormantGrid_createEmptycxx . . $ FormantGrid_createEmpty(73275a7b30af7b50). (tmin, tmax, numberOfFormants);
1868 mycxx . . $ `melder/melder.h:44:9`! bypass =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). IntensityTier_createcxx . . $ IntensityTier_create(3d279d9ea4a74662). (tmin, tmax);
1869 formantsAmplitudes_createcxx . . $ formantsAmplitudes_create(20f2512fed5c7bcc). (& mycxx . . $ `melder/melder.h:44:9`! frication_formants_amplitudes, tmin, tmax, numberOfFormants);
1870 mycxx . . $ `melder/melder.h:44:9`! options =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). FricationGridPlayOptions_createcxx . . $ FricationGridPlayOptions_create(e74247a1df0f85df). ();
1871 FricationGrid_setNamescxx . . $ FricationGrid_setNames(ea8cb882e1da8e26). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
1872 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
1873 } catch (MelderErrorcxx . . $ MelderError#) {
1874 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"FricationGrid not created.");
1875 }
1876 }
1877
1878 static void FricationGrid_draw_insidecxx . . $ FricationGrid_draw_inside(b3d61a9f6dae8f1b). (FricationGrid me, Graphicscxx . . $ Graphics# g, double xmin, double xmax, double ymin, double ymax, double dy, double *yout) {
1879 const integercxx . . $ integer# numberOfFormants = mycxx . . $ `melder/melder.h:44:9`! frication_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1880 const integercxx . . $ integer# numberOfParts = numberOfFormants + ( numberOfFormants > 1 ? 0 : 1 ) ; // 2..number + bypass
1881 // dum noise, connections, filter, connections, adder
1882 autoVECcxx . . $ autoVEC# relativeWidthscxx . . $ autovector#autovector(8de98f561e977378). { 2, 0.6, 1.5, 0.6, 0.5 }, accumulatedWidths = zero_VECcxx . . $ zero_VEC(e4395f764b859b1e). (relativeWidths.sizecxx . . $ autovector#size.);
1883 double x1, y1, x2, y2, x3, ymid = (ymin + ymax) / 2.0;
1884 double oldFontSize = Graphics_inqFontSizecxx . . $ Graphics_inqFontSize(f906975acce41a59). (g);
1885
1886 scaleRelativeAndAccumulatedWidthscxx . . $ scaleRelativeAndAccumulatedWidths(d9ca4354eebefd12). (relativeWidths.getcxx . . $ autovector#get(e8d1da7fe68a6585).(), accumulatedWidths.getcxx . . $ autovector#get(e8d1da7fe68a6585).(), xmax - xmin);
1887
1888 dy = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a). (dy, 0.0);
1889 dy = (ymax - ymin) / (numberOfParts * (1.0 + dy) - dy);
1890
1891 connectionscxx . . $ connections# cp = connections_createcxx . . $ connections_create(bd2eacb064a285e2). (numberOfParts);
1892 if (cp == 0)
1893 return;
1894
1895 // section 1
1896 x1 = xmin;
1897 x2 = x1 + relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1];
1898 y1 = ymid - 0.5 * dy;
1899 y2 = y1 + dy;
1900
1901 double fontSizeFrication = Graphics_getFontSizeInsideBoxcxx . . $ Graphics_getFontSizeInsideBox(58355cd5a6d131f). (g, relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1], dy, 10.0, 2.0);
1902 double fontSizeFormants = Graphics_getFontSizeInsideBoxcxx . . $ Graphics_getFontSizeInsideBox(58355cd5a6d131f). (g, relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).3], dy, 9.0, 1.5);
1903 double newFontSize = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a). (fontSizeFrication, fontSizeFormants);
1904 if (newFontSize < oldFontSize)
1905 Graphics_setFontSizecxx . . $ Graphics_setFontSize(2514a1c07b6be5e2). (g, newFontSize);
1906 autoSTRVECcxx . . $ autoSTRVEC# fricationNoisecxx . . $ _autostringautovector#_autostringautovector(74bdb0c13d8f03c9). { U"Frication", U"noise" };
1907 drawLinesInBoxcxx . . $ drawLinesInBox(7482afdee92020f4). (g, x1, x2, y1, y2, fricationNoisecxx . . $ _conststringvector#_conststringvector(93d9e701af42cb0d)..getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02).());
1908
1909 // section 2, horizontal line halfway, vertical line
1910 x1 = x2;
1911 x2 = x1 + relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2] / 2.0;
1912 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x1, ymid, x2, ymid);
1913 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x2, ymax - dy / 2, x2, ymin + dy / 2.0);
1914 x3 = x2;
1915 // final connection to section 2 , filters , connections to adder
1916 x1 = xmin + accumulatedWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2];
1917 x2 = x1 + relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).3];
1918 y2 = ymax;
1919 autoMelderStringcxx . . $ autoMelderString# fbacxx . . $ autoMelderString#autoMelderString(49f6e7a06ebc5aa8).;
1920 autoSTRVECcxx . . $ autoSTRVEC# fbaicxx . . $ _autostringautovector#_autostringautovector(74bdb0c13d8f03c9). { U"" };
1921
1922 for (integercxx . . $ integer# i = 1; i <= numberOfParts; i ++) {
1923 conststring32cxx . . $ conststring32# fi = Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). (i + 1);
1924 y1 = y2 - dy;
1925 if (i < numberOfParts)
1926 MelderString_copycxx . . $ MelderString_copy(65be51a793e0ff96). (& fba, U"A", fi, U" F", fi, U" B", fi);
1927 else
1928 MelderString_copycxx . . $ MelderString_copy(65be51a793e0ff96). (& fba, U"Bypass");
1929 fbai [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).1] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (fba.stringcxx . . $ MelderString#string.);
1930 drawLinesInBoxcxx . . $ drawLinesInBox(7482afdee92020f4). (g, x1, x2, y1, y2, fbaicxx . . $ _conststringvector#_conststringvector(93d9e701af42cb0d)..getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02).());
1931 double ymidi = (y1 + y2) / 2.0;
1932 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, x3, ymidi, x1, ymidi); // from noise to filter
1933 cp -> xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i] = x2;
1934 cp -> ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i] = ymidi;
1935 y2 = y1 - 0.5 * dy;
1936 }
1937
1938 const double r = relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).5] / 2.0;
1939 const double xs = xmax - r;
1940 const double ys = ymid;
1941
1942 if (numberOfParts > 1)
1943 alternatingSummer_drawConnectionscxx . . $ alternatingSummer_drawConnections(45f02620acd1b9a1). (g, xs, ys, r, cp, 1, 0.4);
1944 else
1945 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, cp -> xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1], cp -> ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1], xs + r, ys);
1946
1947 connections_freecxx . . $ connections_free(5c23632b7bdbbe2b). (cp);
1948 Graphics_setFontSizecxx . . $ Graphics_setFontSize(2514a1c07b6be5e2). (g, oldFontSize);
1949 if (yout)
1950 *yout = ys;
1951 }
1952
1953 void FricationGrid_drawcxx . . $ FricationGrid_draw(7b3fab4041080a6e). (FricationGrid me, Graphicscxx . . $ Graphics# g) {
1954 const double xmin = 0.0, xmax = 1.0, xmax2 = 0.9, ymin = 0.0, ymax = 1.0, dy = 0.5;
1955
1956 Graphics_setInnercxx . . $ Graphics_setInner(2d838ed765120c5d). (g);
1957 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (g, xmin, xmax, ymin, ymax);
1958 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (g, kGraphics_horizontalAlignmentcxx . . $ kGraphics_horizontalAlignment#::CENTREcxx . . $ kGraphics_horizontalAlignment#CENTRE., Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!);
1959 Graphics_setLineWidthcxx . . $ Graphics_setLineWidth(2514a1c07b6be5e2). (g, 2);
1960
1961 double yout;
1962 FricationGrid_draw_insidecxx . . $ FricationGrid_draw_inside(b3d61a9f6dae8f1b). (me, g, xmin, xmax2, ymin, ymax, dy, & yout);
1963
1964 Graphics_arrowcxx . . $ Graphics_arrow(72bdb7937dbb13da). (g, xmax2, yout, xmax, yout);
1965 Graphics_unsetInnercxx . . $ Graphics_unsetInner(2d838ed765120c5d). (g);
1966 }
1967
1968 autoSoundcxx . . $ autoSound# FricationGrid_to_Soundcxx . . $ FricationGrid_to_Sound(38e320daed217d9d). (FricationGrid me, double samplingFrequency) {
1969 try {
1970 autoSoundcxx . . $ autoSound# thee = Sound_createEmptyMonocxx . . $ Sound_createEmptyMono(e34f441442c8776d). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., samplingFrequency);
1971
1972 double lastval = 0.0;
1973 for (integercxx . . $ integer# i = 1; i <= thycxx . . $ `melder/melder.h:45:9`! nxcxx . . $ structSampled#nx.; i ++) {
1974 const double t = thycxx . . $ `melder/melder.h:45:9`! x1cxx . . $ structSampled#x1. + (i - 1) * thycxx . . $ `melder/melder.h:45:9`! dxcxx . . $ structSampled#dx.;
1975 double val = NUMrandomUniformcxx . . $ NUMrandomUniform(d8e7e0733fa41c87). (-1.0, 1.0);
1976 double a = 0.0;
1977 if (mycxx . . $ `melder/melder.h:44:9`! fricationAmplitude ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0) {
1978 const double dba = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (mycxx . . $ `melder/melder.h:44:9`! fricationAmplitude.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t);
1979 a = ( isdefinedcxx . . $ isdefined(f8197d536af80c96). (dba) ? DBSPL_to_Acxx . . $ `dwtools/KlattGrid.cpp:461:9`! (dba) : 0.0 );
1980 }
1981 lastval = (val += 0.75 * lastval); // TODO: soft low-pass coefficient should be Fs dependent!
1982 thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] = val * a;
1983 }
1984
1985 autoSoundcxx . . $ autoSound# him = Sound_FricationGrid_filtercxx . . $ Sound_FricationGrid_filter(86b9b8f8e04c2f5d). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), me);
1986 return himcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
1987 } catch (MelderErrorcxx . . $ MelderError#) {
1988 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no frication Sound created.");
1989 }
1990 }
1991
1992 /************************ Sound & FricationGrid *********************************************/
1993
1994 autoSoundcxx . . $ autoSound# Sound_FricationGrid_filtercxx . . $ Sound_FricationGrid_filter(86b9b8f8e04c2f5d). (Soundcxx . . $ Sound# me, FricationGrid thee) {
1995 try {
1996 const FricationGridPlayOptions pf = thycxx . . $ `melder/melder.h:45:9`! options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
1997 autoSoundcxx . . $ autoSound# himcxx . . $ autoSomeThing#autoSomeThing(49f6e7a06ebc5aa8).;
1998 const integercxx . . $ integer# numberOfFricationFormants = thycxx . . $ `melder/melder.h:45:9`! frication_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
1999
2000 check_formantscxx . . $ check_formants(b76a3bd1263aa692). (numberOfFricationFormants, & (pf -> startFricationFormant), & (pf -> endFricationFormant));
2001
2002 if (pf -> endFricationFormant > 1) {
2003 const integercxx . . $ integer# startFricationFormant2 = pf -> startFricationFormant > 2 ? pf -> startFricationFormant : 2;
2004 int alternatingSign = ( startFricationFormant2 % 2 == 0 ? 1 : -1 ); // 2 starts with positive sign
2005 him =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Sound_FormantGrid_Intensities_filtercxx . . $ Sound_FormantGrid_Intensities_filter(b5a7075cec170387). (me, thycxx . . $ `melder/melder.h:45:9`! frication_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), & thycxx . . $ `melder/melder.h:45:9`! frication_formants_amplitudes, startFricationFormant2, pf -> endFricationFormant, alternatingSign);
2006 }
2007
2008 if (! him)
2009 him =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (me);
2010
2011 if (pf -> bypass) {
2012 for (integercxx . . $ integer# is = 1; is <= hiscxx . . $ `melder/melder.h:47:9`! nxcxx . . $ structSampled#nx.; is ++) { // Bypass
2013 const double t = hiscxx . . $ `melder/melder.h:47:9`! x1cxx . . $ structSampled#x1. + (is - 1) * hiscxx . . $ `melder/melder.h:47:9`! dxcxx . . $ structSampled#dx.;
2014 double ab = 0.0;
2015 if (thycxx . . $ `melder/melder.h:45:9`! bypass ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0) {
2016 const double val = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (thycxx . . $ `melder/melder.h:45:9`! bypass.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t);
2017 ab = ( isundefcxx . . $ isundef(f8197d536af80c96). (val) ? 0.0 : DB_to_Acxx . . $ `dwtools/KlattGrid.cpp:463:9`! (val) );
2018 }
2019 hiscxx . . $ `melder/melder.h:47:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).is] += mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).is] * ab;
2020 }
2021 }
2022 return himcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
2023 } catch (MelderErrorcxx . . $ MelderError#) {
2024 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not filtered by frication filter.");
2025 }
2026 }
2027
2028 /********************** KlattGridPlayOptions **********************/
2029
2030 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (KlattGridPlayOptions, Daata, 0);
2031
2032 static void KlattGridPlayOptions_setDefaultscxx . . $ KlattGridPlayOptions_setDefaults(e1465f8b78f1d48b). (KlattGridPlayOptions me, KlattGrid thee) {
2033 mycxx . . $ `melder/melder.h:44:9`! samplingFrequency = 44100.0;
2034 mycxx . . $ `melder/melder.h:44:9`! scalePeak = 1;
2035 mycxx . . $ `melder/melder.h:44:9`! xmin = thycxx . . $ `melder/melder.h:45:9`! xmincxx . . $ structFunction#xmin.;
2036 mycxx . . $ `melder/melder.h:44:9`! xmax = thycxx . . $ `melder/melder.h:45:9`! xmaxcxx . . $ structFunction#xmax.;
2037 }
2038
2039 autoKlattGridPlayOptions KlattGridPlayOptions_createcxx . . $ KlattGridPlayOptions_create(786b39040a52ba10). () {
2040 try {
2041 autoKlattGridPlayOptions me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (KlattGridPlayOptions);
2042 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
2043 } catch (MelderErrorcxx . . $ MelderError#) {
2044 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"KlattGridPlayOptions not created.");
2045 }
2046 }
2047
2048 void KlattGrid_setDefaultPlayOptionscxx . . $ KlattGrid_setDefaultPlayOptions(132f1834de956411). (KlattGrid me) {
2049 KlattGridPlayOptions_setDefaultscxx . . $ KlattGridPlayOptions_setDefaults(e1465f8b78f1d48b). (mycxx . . $ `melder/melder.h:44:9`! options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), me);
2050 PhonationGridPlayOptions_setDefaultscxx . . $ PhonationGridPlayOptions_setDefaults(e4af3a3aa7d7d11c). (mycxx . . $ `melder/melder.h:44:9`! phonation ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2051 VocalTractGridPlayOptions_setDefaultscxx . . $ VocalTractGridPlayOptions_setDefaults(33821518a87c09fe). (mycxx . . $ `melder/melder.h:44:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! vocalTract.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2052 CouplingGridPlayOptions_setDefaultscxx . . $ CouplingGridPlayOptions_setDefaults(d6a4c69477c8deb1). (mycxx . . $ `melder/melder.h:44:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! coupling.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2053 FricationGridPlayOptions_setDefaultscxx . . $ FricationGridPlayOptions_setDefaults(122cf50fa96454a9). (mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! frication.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2054 }
2055
2056 /************************ KlattGrid *********************************************/
2057
2058 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (KlattGrid, Function, 0);
2059
2060 void structKlattGrid :: v1_info () {
2061 structDaatacxx . . $ structDaata# :: v1_infocxx . . $ structThing#v1_info(49f6e7a06ebc5aa8). ();
2062 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Time domain:");
2063 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Start time: ", xmincxx . . $ structFunction#xmin., U" seconds");
2064 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" End time: ", xmaxcxx . . $ structFunction#xmax., U" seconds");
2065 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Total duration: ", xmaxcxx . . $ structFunction#xmax. - xmincxx . . $ structFunction#xmin., U" seconds");
2066 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\n--- PhonationGrid ---\n");
2067 ourcxx . . $ `melder/melder.h:42:9`! phonation ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). v1_info ();
2068 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\n--- VocalTractGrid ---\n");
2069 ourcxx . . $ `melder/melder.h:42:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). v1_info ();
2070 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\n--- CouplingGrid ---\n");
2071 ourcxx . . $ `melder/melder.h:42:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). v1_info ();
2072 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\n--- FricationGrid ---\n");
2073 ourcxx . . $ `melder/melder.h:42:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). v1_info ();
2074 }
2075
2076 void KlattGrid_setNamescxx . . $ KlattGrid_setNames(132f1834de956411). (KlattGrid me) {
2077 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! phonation.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"phonation");
2078 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! vocalTract.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"vocalTract");
2079 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! coupling.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"coupling");
2080 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! frication.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"frication");
2081 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (mycxx . . $ `melder/melder.h:44:9`! gain.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"gain");
2082 }
2083
2084 autoKlattGrid KlattGrid_createcxx . . $ KlattGrid_create(f5096f7ce2feecc). (double tmin, double tmax, integercxx . . $ integer# numberOfFormants, integercxx . . $ integer# numberOfNasalFormants, integercxx . . $ integer# numberOfNasalAntiFormants, integercxx . . $ integer# numberOfTrachealFormants, integercxx . . $ integer# numberOfTrachealAntiFormants, integercxx . . $ integer# numberOfFricationFormants, integercxx . . $ integer# numberOfDeltaFormants) {
2085 try {
2086 autoKlattGrid me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (KlattGrid);
2087 Function_initcxx . . $ Function_init(ac72a71dd6ac1bfb). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tmin, tmax);
2088 mycxx . . $ `melder/melder.h:44:9`! phonation =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). PhonationGrid_createcxx . . $ PhonationGrid_create(1eb73ff0364c97d9). (tmin, tmax);
2089 mycxx . . $ `melder/melder.h:44:9`! vocalTract =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). VocalTractGrid_createcxx . . $ VocalTractGrid_create(4a8bbb8d1f5632c). (tmin, tmax, numberOfFormants, numberOfNasalFormants, numberOfNasalAntiFormants);
2090 mycxx . . $ `melder/melder.h:44:9`! coupling =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). CouplingGrid_createcxx . . $ CouplingGrid_create(502c0db2238ea6a8). (tmin, tmax, numberOfTrachealFormants, numberOfTrachealAntiFormants, numberOfDeltaFormants);
2091 mycxx . . $ `melder/melder.h:44:9`! frication =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). FricationGrid_createcxx . . $ FricationGrid_create(bb0e3bcfa5311da1). (tmin, tmax, numberOfFricationFormants);
2092 mycxx . . $ `melder/melder.h:44:9`! gain =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). IntensityTier_createcxx . . $ IntensityTier_create(3d279d9ea4a74662). (tmin, tmax);
2093 mycxx . . $ `melder/melder.h:44:9`! options =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). KlattGridPlayOptions_createcxx . . $ KlattGridPlayOptions_create(786b39040a52ba10). ();
2094
2095 KlattGrid_setDefaultPlayOptionscxx . . $ KlattGrid_setDefaultPlayOptions(132f1834de956411). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2096 KlattGrid_setNamescxx . . $ KlattGrid_setNames(132f1834de956411). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2097 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
2098 } catch (MelderErrorcxx . . $ MelderError#) {
2099 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"KlattGrid not created.");
2100 }
2101 }
2102
2103 autoKlattGrid KlattGrid_createExamplecxx . . $ KlattGrid_createExample(cb75463099c377fa). () {
2104 try {
2105 autoKlattTablecxx . . $ autoKlattTable# thee = KlattTable_createExamplecxx . . $ KlattTable_createExample(d5028150d994f9fd). ();
2106 autoKlattGrid me = KlattTable_to_KlattGridcxx . . $ KlattTable_to_KlattGrid(778709ee4ae4c02c). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.005);
2107 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
2108 } catch (MelderErrorcxx . . $ MelderError#) {
2109 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"KlattGrid example not created.");
2110 };
2111 }
2112
2113 // y is the height in units of the height of one section,
2114 // y1 is the height from the top to the split between the upper, non-diffed, and lower diffed part
2115 static void _KlattGrid_queryParallelSplitcxx . . $ _KlattGrid_queryParallelSplit(890fa9c4a5e75c4f). (KlattGrid me, double dy, double *out_y, double *out_y1) {
2116 const integercxx . . $ integer# ny = mycxx . . $ `melder/melder.h:44:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nasal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size. +
2117 mycxx . . $ `melder/melder.h:44:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). oral_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size. + mycxx . . $ `melder/melder.h:44:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). tracheal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
2118 const integercxx . . $ integer# n1 = mycxx . . $ `melder/melder.h:44:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nasal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size. +
2119 ( mycxx . . $ `melder/melder.h:44:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). oral_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size. > 0 ? 1 : 0 );
2120
2121 const integercxx . . $ integer# n2 = ny - n1;
2122 double y = 0.0, y1 = 0.0;
2123 if (ny != 0) {
2124 y = ny + (ny - 1) * dy;
2125
2126 if (n1 == 0)
2127 y1 = 0.5;
2128 else if (n2 == 0)
2129 y1 = y - 0.5;
2130 else
2131 y1 = n1 + (n1 - 1) * dy + 0.5 * dy;
2132 }
2133 if (out_y)
2134 *out_y = y;
2135 if (out_y1)
2136 *out_y1 = y1;
2137 return;
2138 }
2139
2140 static void getYpositionscxx . . $ getYpositions(6340e5116ba6697d). (double h1, double h2, double h3, double h4, double h5, double fractionOverlap, double *out_dy, double *out_ymin1, double *out_ymax1, double *out_ymin2, double *out_ymax2, double *out_ymin3, double *out_ymax3) {
2141 // Given: five 'blocks' with relative heights h1..h5 in arbitrary units.
2142 // Problem: scale all h1..h5 such that:
2143 // 1. blocks h1 and h2 form one unit, with h1 on top of h2, the quotient h1/h2 is fixed
2144 // 2. blocks h3 and h4 form one unit, with h3 on top of h4, the quotient h3/h4 is fixed
2145 // 3. blocks h1 and h3 have the same baseline.
2146 // 4. h5 is always underneath (h1,h2) but may partially overlap (0.45) with h4.
2147 // 5. After scaling the new h1+h2 >= 0.3
2148 // 6. Optimally use the vertical space from 0.. 1, i.e the top of h1 or h3 is at 1,
2149 // the bottom of h5 is at 0. Preferably scale all blocks with the same factor, if not possible than
2150 // scale h3,h4 and h5 the same
2151 //
2152 // h1 h3
2153 // h2 h4
2154 // h5
2155 /* Cases:
2156 x x ^
2157 x x x x x x |
2158 h1 x x x x x x x x h3 | h13
2159 -----------------------------------------------------------
2160 h2 x x x x x x x x h4
2161 x x x x x x
2162 x x
2163 x x x x x x
2164 h5 x x x x
2165 x x x x
2166 */
2167 double h; // h12_min = 0.3; not yet
2168 const double h13 = ( h1 > h3 ? h1 : h3 ); // baselines are now equal
2169 if (h2 >= h4) {
2170 h = h13 + h2 + h5;
2171 } else { // h2 < h4
2172 double maximumOverlap3 = fractionOverlap * h5;
2173 if (maximumOverlap3 < h1 + h2)
2174 maximumOverlap3 = 0.0;
2175 else if (maximumOverlap3 > h4 - h2)
2176 maximumOverlap3 = h4 - h2;
2177 h = h13 + h4 + h5 - maximumOverlap3;
2178 }
2179 const double dy = 1.0 / (1.1 * h);
2180 const double ymin1 = 1.0 - (h13 + h2) * dy;
2181 const double ymax1 = ymin1 + (h1 + h2) * dy;
2182 const double ymin2 = 1.0 - (h13 + h4) * dy;
2183 const double ymax2 = ymin2 + (h3 + h4) * dy;
2184 const double ymin3 = 0.0;
2185 const double ymax3 = h5 * dy;
2186 if (out_dy)
2187 *out_dy = dy;
2188 if (out_ymin1)
2189 *out_ymin1 = ymin1;
2190 if (out_ymax1)
2191 *out_ymax1 = ymax1;
2192 if (out_ymin2)
2193 *out_ymin2 = ymin2;
2194 if (out_ymax2)
2195 *out_ymax2 = ymax2;
2196 if (out_ymin3)
2197 *out_ymin3 = ymin3;
2198 if (out_ymax3)
2199 *out_ymax3 = ymax3;
2200 }
2201
2202 void KlattGrid_drawVocalTractcxx . . $ KlattGrid_drawVocalTract(4ffc1b12745185eb). (KlattGrid me, Graphicscxx . . $ Graphics# g, kKlattGridFilterModelcxx . . $ kKlattGridFilterModel# filterModel, int withTrachea) {
2203 VocalTractGrid_CouplingGrid_drawcxx . . $ VocalTractGrid_CouplingGrid_draw(dbb176e308ddbe60). (mycxx . . $ `melder/melder.h:44:9`! vocalTract.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), withTrachea ? mycxx . . $ `melder/melder.h:44:9`! coupling.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).() : nullptr, g, filterModel);
2204 }
2205
2206 void KlattGrid_drawcxx . . $ KlattGrid_draw(a019a18387aacc6e). (KlattGrid me, Graphicscxx . . $ Graphics# g, kKlattGridFilterModelcxx . . $ kKlattGridFilterModel# filterModel) {
2207 const double xmin = 0.0, xmax = 1.0, ymin = 0.0, ymax = 1.0;
2208 const double xmax2 = 0.90, xmax3 = 0.95;
2209 const double dy_phonation = 0.5, dy_vocalTract_p = 0.5, dy_frication = 0.5;
2210
2211 connectionscxx . . $ connections# tf;
2212 try {
2213 tf = connections_createcxx . . $ connections_create(bd2eacb064a285e2). (2);
2214 } catch (MelderErrorcxx . . $ MelderError#) {
2215 Melder_clearErrorcxx . . $ Melder_clearError(49f6e7a06ebc5aa8). ();
2216 return;
2217 }
2218
2219 Graphics_setInnercxx . . $ Graphics_setInner(2d838ed765120c5d). (g);
2220
2221 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (g, xmin, xmax, ymin, ymax);
2222 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (g, kGraphics_horizontalAlignmentcxx . . $ kGraphics_horizontalAlignment#::CENTREcxx . . $ kGraphics_horizontalAlignment#CENTRE., Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!);
2223 Graphics_setLineWidthcxx . . $ Graphics_setLineWidth(2514a1c07b6be5e2). (g, 2);
2224
2225 const integercxx . . $ integer# nff = mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). frication_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size. - 1 + 1;
2226 const double yh_frication = ( nff > 0 ? nff + (nff - 1) * dy_frication : 1.0 );
2227 const double yh_phonation = 1.0 + dy_phonation + 1.0;
2228 double yout_phonation, yout_frication, yout_vocalTract;
2229 double height_phonation = 0.3;
2230 double dy = height_phonation / yh_phonation; // 1 vertical unit in source section height units
2231
2232 double xs1, xs2, ys1, ys2, xf1, xf2, yf1, yf2;
2233 double xp1, xp2, yp1, yp2, xc1, xc2, yc1, yc2;
2234 // {phonationPart, line, vocalTractPart,
2235 autoVECcxx . . $ autoVEC# relativeWidthscxx . . $ autovector#autovector(8de98f561e977378). { 1.75, 0.125, 3.0, 0.25, 0.125 }, accumulatedWidths = zero_VECcxx . . $ zero_VEC(e4395f764b859b1e). (relativeWidths.sizecxx . . $ autovector#size.);
2236 scaleRelativeAndAccumulatedWidthscxx . . $ scaleRelativeAndAccumulatedWidths(d9ca4354eebefd12). (relativeWidths.getcxx . . $ autovector#get(e8d1da7fe68a6585).(), accumulatedWidths.getcxx . . $ autovector#get(e8d1da7fe68a6585).(), xmax2 - xmin);
2237
2238 if (filterModel == kKlattGridFilterModelcxx . . $ kKlattGridFilterModel#::CASCADEcxx . . $ kKlattGridFilterModel#CASCADE.) { // Cascade section
2239 /*
2240 limit height of frication unit dy !
2241 */
2242 height_phonation = yh_phonation / (yh_phonation + yh_frication);
2243 if (height_phonation < 0.3)
2244 height_phonation = 0.3;
2245 dy = height_phonation / yh_phonation;
2246
2247 xs1 = xmin;
2248 xs2 = xs1 + relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1];
2249 ys2 = ymax;
2250 ys1 = ys2 - height_phonation;
2251 PhonationGrid_draw_insidecxx . . $ PhonationGrid_draw_inside(d340f301efa05e04). (mycxx . . $ `melder/melder.h:44:9`! phonation.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), g, xs1, xs2, ys1, ys2, dy_phonation, & yout_phonation);
2252
2253 // units in cascade have same height as units in source part.
2254
2255 xc1 = xmin + accumulatedWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2]; // end of phonation
2256 xc2 = xc1 + relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).3]; // same width as vocaltract
2257 yc2 = yout_phonation + dy / 2.0;
2258 yc1 = yc2 - dy;
2259 double yin_vocalTract_cascade;
2260 VocalTractGrid_CouplingGrid_drawCascade_inplacecxx . . $ VocalTractGrid_CouplingGrid_drawCascade_inplace(7e7c8f605c7af396). (mycxx . . $ `melder/melder.h:44:9`! vocalTract.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! coupling.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), g, xc1, xc2, yc1, yc2, & yin_vocalTract_cascade, & yout_vocalTract);
2261
2262 tf -> xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1] = xc2;
2263 tf -> ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1] = yout_vocalTract;
2264
2265 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, xs2, yout_phonation, xc1, yin_vocalTract_cascade);
2266
2267 xf1 = xmin + accumulatedWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2];
2268 xf2 = xf1 + relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).3];
2269 yf2 = ymax - height_phonation;
2270 yf1 = 0.0;
2271
2272 FricationGrid_draw_insidecxx . . $ FricationGrid_draw_inside(b3d61a9f6dae8f1b). (mycxx . . $ `melder/melder.h:44:9`! frication.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), g, xf1, xf2, yf1, yf2, dy_frication, &yout_frication);
2273 } else { // Parallel
2274 /*
2275 optimize the vertical space for source, parallel and frication
2276 source part is relatively fixed. let the number of vertical section units be the divisor
2277 connector line from source to parallel has to be horizontal
2278 determine y's of source and parallel section
2279 */
2280 double yf_parallel, yh_parallel, yh_overlap = 0.3, yin_vocalTract_parallel;
2281 _KlattGrid_queryParallelSplitcxx . . $ _KlattGrid_queryParallelSplit(890fa9c4a5e75c4f). (me, dy_vocalTract_p, &yh_parallel, & yf_parallel);
2282 if (yh_parallel == 0.0) {
2283 yh_parallel = yh_phonation;
2284 yf_parallel = yh_parallel / 2.0;
2285 yh_overlap = -0.1;
2286 }
2287
2288 height_phonation = yh_phonation / (yh_phonation + yh_frication);
2289 if (height_phonation < 0.3) {
2290 height_phonation = 0.3;
2291 }
2292 //double yunit = (ymax - ymin) / (yh_parallel + (1 - yh_overlap) * yh_frication); // some overlap
2293
2294 //double ycs = ymax - 0.5 * height_phonation; // source output connector
2295 //double ycp = ymax - yf_parallel * yunit; // parallel input connector
2296 //double ytrans_phonation = ycs > ycp ? ycp - ycs : 0;
2297 //double ytrans_parallel = ycp > ycs ? ycs - ycp : 0;
2298
2299 // source, tract, frication
2300 xs1 = xmin;
2301 xs2 = xs1 + relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1];
2302
2303 const double h1 = yh_phonation / 2.0, h2 = h1, h3 = yf_parallel, h4 = yh_parallel - h3, h5 = yh_frication;
2304 getYpositionscxx . . $ getYpositions(6340e5116ba6697d). (h1, h2, h3, h4, h5, yh_overlap, & dy, & ys1, & ys2, & yp1, & yp2, & yf1, & yf2);
2305
2306 PhonationGrid_draw_insidecxx . . $ PhonationGrid_draw_inside(d340f301efa05e04). (mycxx . . $ `melder/melder.h:44:9`! phonation.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), g, xs1, xs2, ys1, ys2, dy_phonation, & yout_phonation);
2307
2308 xp1 = xmin + accumulatedWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2];
2309 xp2 = xp1 + relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).3];
2310 VocalTractGrid_CouplingGrid_drawParallel_inplacecxx . . $ VocalTractGrid_CouplingGrid_drawParallel_inplace(aa3dba8479e4b9ca). (mycxx . . $ `melder/melder.h:44:9`! vocalTract.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! coupling.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), g, xp1, xp2, yp1, yp2, dy_vocalTract_p, & yin_vocalTract_parallel, & yout_vocalTract);
2311
2312 tf -> xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1] = xp2;
2313 tf -> ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1] = yout_vocalTract;
2314
2315 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, xs2, yout_phonation, xp1, yin_vocalTract_parallel);
2316
2317 xf1 = xmin /* + 0.5 * accumulatedWidths [1] */;
2318 xf2 = xf1 + 0.55 * (relativeWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2] + accumulatedWidths [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).3]);
2319
2320 FricationGrid_draw_insidecxx . . $ FricationGrid_draw_inside(b3d61a9f6dae8f1b). (mycxx . . $ `melder/melder.h:44:9`! frication.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), g, xf1, xf2, yf1, yf2, dy_frication, & yout_frication);
2321 }
2322
2323 tf -> xcxx . . $ structconnections#x. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2] = xf2;
2324 tf -> ycxx . . $ structconnections#y. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).2] = yout_frication;
2325 const double r = (xmax3 - xmax2) / 2.0;
2326 const double xs = xmax2 + r / 2.0;
2327 const double ys = (yout_vocalTract + yout_frication) / 2.0;//(ymax - ymin) / 2.0;
2328
2329 summer_drawConnectionscxx . . $ summer_drawConnections(45f02620acd1b9a1). (g, xs, ys, r, tf, true, 0.6);
2330
2331 Graphics_arrowcxx . . $ Graphics_arrow(72bdb7937dbb13da). (g, xs + r, ys, xmax, ys);
2332
2333 Graphics_unsetInnercxx . . $ Graphics_unsetInner(2d838ed765120c5d). (g);
2334 connections_freecxx . . $ connections_free(5c23632b7bdbbe2b). (tf);
2335 }
2336
2337 /**** Query, Add, Remove, Extract Replace ********/
2338
2339 #define PhonationGrid_QUERY_ADD_REMOVE_EXTRACT_REPLACEcxx . . $ `dwtools/KlattGrid.cpp:2339:9`!(Name,name,tierType) \
2340 double KlattGrid_get##Name##AtTime (KlattGrid me, double t) \
2341 { return RealTier_getValueAtTime (mycxx . . $ `melder/melder.h:44:9`! phonation -> name.get(), t); } \
2342 void KlattGrid_add##Name##Point (KlattGrid me, double t, double value) \
2343 { RealTier_addPoint (mycxx . . $ `melder/melder.h:44:9`! phonation -> name.get(), t, value);} \
2344 void KlattGrid_remove##Name##Points (KlattGrid me, double t1, double t2) \
2345 { AnyTier_removePointsBetween (mycxx . . $ `melder/melder.h:44:9`! phonation -> name.get()->asAnyTier(), t1, t2); } \
2346 auto##tierType KlattGrid_extract##Name##Tier (KlattGrid me) \
2347 { return Data_copy (mycxx . . $ `melder/melder.h:44:9`! phonation -> name.get()); } \
2348 void KlattGrid_replace##Name##Tier (KlattGrid me, tierType thee) \
2349 { try {\
2350 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! xmin == thycxx . . $ `melder/melder.h:45:9`! xmin && mycxx . . $ `melder/melder.h:44:9`! xmax == thycxx . . $ `melder/melder.h:45:9`! xmax, U"Domains should be equal"); \
2351 auto##tierType any = Data_copy (thee); \
2352 mycxx . . $ `melder/melder.h:44:9`! phonation -> name = any.move(); \
2353 } catch (MelderError) { Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": tier not replaced."); } \
2354 }
2355
2356 // Generate 55 functions
2357 PhonationGrid_QUERY_ADD_REMOVE_EXTRACT_REPLACEcxx . . $ `dwtools/KlattGrid.cpp:2339:9`! (Pitch, pitch, PitchTier)
2358 PhonationGrid_QUERY_ADD_REMOVE_EXTRACT_REPLACEcxx . . $ `dwtools/KlattGrid.cpp:2339:9`! (VoicingAmplitude, voicingAmplitude, IntensityTier)
2359 PhonationGrid_QUERY_ADD_REMOVE_EXTRACT_REPLACEcxx . . $ `dwtools/KlattGrid.cpp:2339:9`! (Flutter, flutter, RealTier)
2360 PhonationGrid_QUERY_ADD_REMOVE_EXTRACT_REPLACEcxx . . $ `dwtools/KlattGrid.cpp:2339:9`! (Power1, power1, RealTier)
2361 PhonationGrid_QUERY_ADD_REMOVE_EXTRACT_REPLACEcxx . . $ `dwtools/KlattGrid.cpp:2339:9`! (Power2, power2, RealTier)
2362 PhonationGrid_QUERY_ADD_REMOVE_EXTRACT_REPLACEcxx . . $ `dwtools/KlattGrid.cpp:2339:9`! (OpenPhase, openPhase, RealTier)
2363 PhonationGrid_QUERY_ADD_REMOVE_EXTRACT_REPLACEcxx . . $ `dwtools/KlattGrid.cpp:2339:9`! (CollisionPhase, collisionPhase, RealTier)
2364 PhonationGrid_QUERY_ADD_REMOVE_EXTRACT_REPLACEcxx . . $ `dwtools/KlattGrid.cpp:2339:9`! (DoublePulsing, doublePulsing, RealTier)
2365 PhonationGrid_QUERY_ADD_REMOVE_EXTRACT_REPLACEcxx . . $ `dwtools/KlattGrid.cpp:2339:9`! (SpectralTilt, spectralTilt, IntensityTier)
2366 PhonationGrid_QUERY_ADD_REMOVE_EXTRACT_REPLACEcxx . . $ `dwtools/KlattGrid.cpp:2339:9`! (AspirationAmplitude, aspirationAmplitude, IntensityTier)
2367 PhonationGrid_QUERY_ADD_REMOVE_EXTRACT_REPLACEcxx . . $ `dwtools/KlattGrid.cpp:2339:9`! (BreathinessAmplitude, breathinessAmplitude, IntensityTier)
2368
2369 autoFormantGridcxx . . $ autoFormantGrid#* KlattGrid_getAddressOfFormantGridcxx . . $ KlattGrid_getAddressOfFormantGrid(7842227f7b4c6554). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType) {
2370 return formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::ORALcxx . . $ kKlattGridFormantType#ORAL. ? & mycxx . . $ `melder/melder.h:44:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). oral_formants :
2371 formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::NASALcxx . . $ kKlattGridFormantType#NASAL. ? & mycxx . . $ `melder/melder.h:44:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nasal_formants :
2372 formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::FRICATIONcxx . . $ kKlattGridFormantType#FRICATION. ? & mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). frication_formants :
2373 formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::TRACHEALcxx . . $ kKlattGridFormantType#TRACHEAL. ? & mycxx . . $ `melder/melder.h:44:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). tracheal_formants :
2374 formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::NASAL_ANTIcxx . . $ kKlattGridFormantType#NASAL_ANTI. ? & mycxx . . $ `melder/melder.h:44:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nasal_antiformants :
2375 formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::TRACHEAL_ANTIcxx . . $ kKlattGridFormantType#TRACHEAL_ANTI. ? & mycxx . . $ `melder/melder.h:44:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). tracheal_antiformants :
2376 & mycxx . . $ `melder/melder.h:44:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). delta_formants; // kKlattGridFormantType::Delta
2377 }
2378
2379 OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* KlattGrid_getAddressOfAmplitudescxx . . $ KlattGrid_getAddressOfAmplitudes(f8d2ccdcfbbb2b0f). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType) {
2380 return formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::ORALcxx . . $ kKlattGridFormantType#ORAL. ? & mycxx . . $ `melder/melder.h:44:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). oral_formants_amplitudes :
2381 formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::NASALcxx . . $ kKlattGridFormantType#NASAL. ? & mycxx . . $ `melder/melder.h:44:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nasal_formants_amplitudes :
2382 formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::FRICATIONcxx . . $ kKlattGridFormantType#FRICATION. ? & mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). frication_formants_amplitudes :
2383 formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::TRACHEALcxx . . $ kKlattGridFormantType#TRACHEAL. ? & mycxx . . $ `melder/melder.h:44:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). tracheal_formants_amplitudes : nullptr;
2384 }
2385
2386 #define KlattGrid_QUERY_ADD_REMOVEcxx . . $ `dwtools/KlattGrid.cpp:2386:9`!(Name) \
2387 double KlattGrid_get##Name##AtTime (KlattGrid me, kKlattGridFormantType formantType, integer iformant, double t) \
2388 { \
2389 autoFormantGrid* fg = KlattGrid_getAddressOfFormantGrid (me, formantType); \
2390 return FormantGrid_get##Name##AtTime (fg->get(), iformant, t); \
2391 } \
2392 void KlattGrid_add##Name##Point (KlattGrid me, kKlattGridFormantType formantType, integer iformant, double t, double value) \
2393 { \
2394 autoFormantGrid* fg = KlattGrid_getAddressOfFormantGrid (me, formantType); \
2395 FormantGrid_add##Name##Point (fg->get(), iformant, t, value); \
2396 } \
2397 void KlattGrid_remove##Name##Points (KlattGrid me, kKlattGridFormantType formantType, integer iformant, double t1, double t2) \
2398 { \
2399 autoFormantGrid* fg = KlattGrid_getAddressOfFormantGrid (me, formantType); \
2400 FormantGrid_remove##Name##PointsBetween (fg->get(), iformant, t1, t2); \
2401 }
2402
2403 // 6 functions
2404 KlattGrid_QUERY_ADD_REMOVEcxx . . $ `dwtools/KlattGrid.cpp:2386:9`! (Formant)
2405 KlattGrid_QUERY_ADD_REMOVEcxx . . $ `dwtools/KlattGrid.cpp:2386:9`! (Bandwidth)
2406
2407 void KlattGrid_formula_frequenciescxx . . $ KlattGrid_formula_frequencies(178948df15e21bc). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, conststring32cxx . . $ conststring32# expression, Interpretercxx . . $ Interpreter# interpreter) {
2408 autoFormantGridcxx . . $ autoFormantGrid#* fg = KlattGrid_getAddressOfFormantGridcxx . . $ KlattGrid_getAddressOfFormantGrid(7842227f7b4c6554). (me, formantType);
2409 FormantGrid_formula_frequenciescxx . . $ FormantGrid_formula_frequencies(e82ad802bc23bc8c). (fg->getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), expression, interpreter, nullptr);
2410 }
2411
2412 void KlattGrid_formula_bandwidthscxx . . $ KlattGrid_formula_bandwidths(178948df15e21bc). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, conststring32cxx . . $ conststring32# expression, Interpretercxx . . $ Interpreter# interpreter) {
2413 autoFormantGridcxx . . $ autoFormantGrid#* fg = KlattGrid_getAddressOfFormantGridcxx . . $ KlattGrid_getAddressOfFormantGrid(7842227f7b4c6554). (me, formantType);
2414
2415 FormantGrid_formula_bandwidthscxx . . $ FormantGrid_formula_bandwidths(e82ad802bc23bc8c). (fg->getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), expression, interpreter, nullptr);
2416 }
2417
2418 void KlattGrid_formula_amplitudescxx . . $ KlattGrid_formula_amplitudes(178948df15e21bc). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, conststring32cxx . . $ conststring32# expression, Interpretercxx . . $ Interpreter# interpreter) {
2419 try {
2420 const OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* ordered = KlattGrid_getAddressOfAmplitudescxx . . $ KlattGrid_getAddressOfAmplitudes(f8d2ccdcfbbb2b0f). (me, formantType);
2421 for (integercxx . . $ integer# irow = 1; irow <= ordered->sizecxx . . $ CollectionOf#size.; irow ++) {
2422 const IntensityTiercxx . . $ IntensityTier# amplitudes = ordered->atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).irow];
2423 Formula_compilecxx . . $ Formula_compile(3f9bc12732facfd). (interpreter, amplitudes, expression, kFormula_EXPRESSION_TYPE_NUMERICcxx . . $ `sys/Formula.h:24:9`!, true);
2424 Formula_Resultcxx . . $ Formula_Result# resultcxx . . $ Formula_Result#Formula_Result(49f6e7a06ebc5aa8).;
2425 for (integercxx . . $ integer# icol = 1; icol <= amplitudes -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.; icol ++) {
2426 Formula_runcxx . . $ Formula_run(4cd939002183d562). (irow, icol, & result);
2427 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (isdefined (result. numericResult),
2428 U"Cannot put an undefined value into the tier.\nFormula not finished.");
2429 amplitudes -> pointscxx . . $ structRealTier#points..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).icol] -> valuecxx . . $ structRealPoint#value. = result. numericResultcxx . . $ Formula_Result#numericResult.;
2430 }
2431 }
2432 } catch (MelderErrorcxx . . $ MelderError#) {
2433 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": formula not finished on amplitudes.");
2434 }
2435 }
2436
2437 double KlattGrid_getAmplitudeAtTimecxx . . $ KlattGrid_getAmplitudeAtTime(fedc8e4464755a48). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, integercxx . . $ integer# iformant, double t) {
2438 const OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* ordered = KlattGrid_getAddressOfAmplitudescxx . . $ KlattGrid_getAddressOfAmplitudes(f8d2ccdcfbbb2b0f). (me, formantType);
2439 if (iformant < 1 || iformant > ordered->sizecxx . . $ CollectionOf#size.)
2440 return undefinedcxx . . $ undefined.;
2441 return RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (ordered->atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant], t);
2442 }
2443
2444 void KlattGrid_addAmplitudePointcxx . . $ KlattGrid_addAmplitudePoint(29d3189245619d0b). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, integercxx . . $ integer# iformant, double t, double value) {
2445 const OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* ordered = KlattGrid_getAddressOfAmplitudescxx . . $ KlattGrid_getAddressOfAmplitudes(f8d2ccdcfbbb2b0f). (me, formantType);
2446 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (iformant > 0 && iformant <= ordered->size,
2447 U"Formant amplitude tier ", iformant, U"does not exist.");
2448 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (ordered->atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant], t, value);
2449 }
2450
2451 void KlattGrid_removeAmplitudePointscxx . . $ KlattGrid_removeAmplitudePoints(29d3189245619d0b). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, integercxx . . $ integer# iformant, double t1, double t2) {
2452 const OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* ordered = KlattGrid_getAddressOfAmplitudescxx . . $ KlattGrid_getAddressOfAmplitudes(f8d2ccdcfbbb2b0f). (me, formantType);
2453 if (ordered && iformant > 0 && iformant <= ordered->sizecxx . . $ CollectionOf#size.) {
2454 AnyTier_removePointsBetweencxx . . $ AnyTier_removePointsBetween(15327dad64b67f1a). (ordered->atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant]->asAnyTiercxx . . $ structRealTier#asAnyTier(2fecc017ee6dfbab).(), t1, t2);
2455 }
2456 }
2457
2458 autoIntensityTiercxx . . $ autoIntensityTier# KlattGrid_extractAmplitudeTiercxx . . $ KlattGrid_extractAmplitudeTier(f44fe89412d879d2). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, integercxx . . $ integer# iformant) {
2459 try {
2460 const OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* ordered = KlattGrid_getAddressOfAmplitudescxx . . $ KlattGrid_getAddressOfAmplitudes(f8d2ccdcfbbb2b0f). (me, formantType);
2461 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (ordered != nullptr,
2462 U"This amplitude tier does not exist.");
2463 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (iformant > 0 && iformant <= ordered->size,
2464 U"Formant amplitude tier ", iformant, U"does not exist.");
2465 autoIntensityTiercxx . . $ autoIntensityTier# thee = Data_copycxx . . $ Data_copy(97a542a26794c80e). (ordered->atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).iformant]);
2466 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
2467 } catch (MelderErrorcxx . . $ MelderError#) {
2468 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no IntensityTier extracted.");
2469 }
2470 }
2471
2472 void KlattGrid_replaceAmplitudeTiercxx . . $ KlattGrid_replaceAmplitudeTier(fe637c5c862d6e4a). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, integercxx . . $ integer# iformant, IntensityTiercxx . . $ IntensityTier# thee) {
2473 try {
2474 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! xmin == thycxx . . $ `melder/melder.h:45:9`! xmin && mycxx . . $ `melder/melder.h:44:9`! xmax == thycxx . . $ `melder/melder.h:45:9`! xmax,
2475 U"Domains should be equal.");
2476 OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* ordered = KlattGrid_getAddressOfAmplitudescxx . . $ KlattGrid_getAddressOfAmplitudes(f8d2ccdcfbbb2b0f). (me, formantType);
2477 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (ordered != nullptr,
2478 U"This amplitude tier does not exist.");
2479 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (iformant > 0 && iformant <= ordered->size,
2480 U"Formant amplitude tier ", iformant, U" does not exist.");
2481 autoIntensityTiercxx . . $ autoIntensityTier# any = Data_copycxx . . $ Data_copy(97a542a26794c80e). (thee);
2482 ordered -> replaceItem_movecxx . . $ CollectionOf#replaceItem_move(ca501a207ce7a6c1). (anycxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).(), iformant);
2483 } catch (MelderErrorcxx . . $ MelderError#) {
2484 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no ampitude tier replaced.");
2485 }
2486 }
2487
2488 autoFormantGridcxx . . $ autoFormantGrid# KlattGrid_extractFormantGridcxx . . $ KlattGrid_extractFormantGrid(840d31f26c28207b). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType) {
2489 try {
2490 autoFormantGridcxx . . $ autoFormantGrid#* fg = KlattGrid_getAddressOfFormantGridcxx . . $ KlattGrid_getAddressOfFormantGrid(7842227f7b4c6554). (me, formantType);
2491 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! ((*fg) -> formants.size > 0,
2492 KlattGrid_getFormantName (formantType), U"s are not defined.");
2493 autoFormantGridcxx . . $ autoFormantGrid# thee = Data_copycxx . . $ Data_copy(97a542a26794c80e). (fg->getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2494 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
2495 } catch (MelderErrorcxx . . $ MelderError#) {
2496 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no FormantGrid extracted.");
2497 }
2498 }
2499
2500 void KlattGrid_replaceFormantGridcxx . . $ KlattGrid_replaceFormantGrid(3dbe8696c60bf8c). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, FormantGridcxx . . $ FormantGrid# thee) {
2501 try {
2502 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! xmin == thycxx . . $ `melder/melder.h:45:9`! xmin && mycxx . . $ `melder/melder.h:44:9`! xmax == thycxx . . $ `melder/melder.h:45:9`! xmax,
2503 U"Domains should be equal");
2504 autoFormantGridcxx . . $ autoFormantGrid# *fg = KlattGrid_getAddressOfFormantGridcxx . . $ KlattGrid_getAddressOfFormantGrid(7842227f7b4c6554). (me, formantType);
2505 *fg =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (thee);
2506 } catch (MelderErrorcxx . . $ MelderError#) {
2507 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no FormantGrid replaced.");
2508 }
2509 }
2510
2511 void KlattGrid_addFormantAmplitudeTiercxx . . $ KlattGrid_addFormantAmplitudeTier(69f595c7b893d654). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, integercxx . . $ integer# position) {
2512 try {
2513 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (formantType != kKlattGridFormantType::NASAL_ANTI && formantType != kKlattGridFormantType::TRACHEAL_ANTI && formantType != kKlattGridFormantType::DELTA,
2514 U"Cannot add amplitude tier to this formant type.");
2515 OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* ordered = KlattGrid_getAddressOfAmplitudescxx . . $ KlattGrid_getAddressOfAmplitudes(f8d2ccdcfbbb2b0f). (me, formantType);
2516 const integercxx . . $ integer# noa = ordered->sizecxx . . $ CollectionOf#size.;
2517 if (position > noa || position < 1)
2518 position = noa + 1;
2519 autoIntensityTiercxx . . $ autoIntensityTier# tier = IntensityTier_createcxx . . $ IntensityTier_create(3d279d9ea4a74662). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax.);
2520 ordered -> addItemAtPosition_movecxx . . $ OrderedOf#addItemAtPosition_move(ca501a207ce7a6c1). (tiercxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).(), position);
2521 } catch (MelderErrorcxx . . $ MelderError#) {
2522 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no formant amplitude tier added.");
2523 }
2524 }
2525
2526 void KlattGrid_removeFormantAmplitudeTiercxx . . $ KlattGrid_removeFormantAmplitudeTier(69f595c7b893d654). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, integercxx . . $ integer# position) {
2527 try {
2528 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (formantType != kKlattGridFormantType::NASAL_ANTI && formantType != kKlattGridFormantType::TRACHEAL_ANTI && formantType != kKlattGridFormantType::DELTA,
2529 U"Cannot remove amplitude tier from this formant type.");
2530 OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* ordered = KlattGrid_getAddressOfAmplitudescxx . . $ KlattGrid_getAddressOfAmplitudes(f8d2ccdcfbbb2b0f). (me, formantType);
2531 if (position > 0 && position <= ordered->sizecxx . . $ CollectionOf#size.)
2532 ordered -> removeItemcxx . . $ CollectionOf#removeItem(1624ee8275b10bda). (position);
2533 } catch (MelderErrorcxx . . $ MelderError#) {
2534 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no formant amplitude tier removed.");
2535 }
2536 }
2537
2538 // The following two routines are deprecated.
2539 // We do this in two separate steps now
2540 void KlattGrid_addFormantcxx . . $ KlattGrid_addFormant(69f595c7b893d654). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, integercxx . . $ integer# position) {
2541 try {
2542 autoFormantGridcxx . . $ autoFormantGrid#* fg = KlattGrid_getAddressOfFormantGridcxx . . $ KlattGrid_getAddressOfFormantGrid(7842227f7b4c6554). (me, formantType);
2543
2544 const integercxx . . $ integer# nof = (*fg) ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
2545 if (position > nof || position < 1)
2546 position = nof + 1;
2547
2548 if (formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::NASAL_ANTIcxx . . $ kKlattGridFormantType#NASAL_ANTI. || formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::TRACHEAL_ANTIcxx . . $ kKlattGridFormantType#TRACHEAL_ANTI. ||
2549 formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::DELTAcxx . . $ kKlattGridFormantType#DELTA.)
2550 {
2551 FormantGrid_addFormantAndBandwidthTierscxx . . $ FormantGrid_addFormantAndBandwidthTiers(47ebe458dfc3e98c). (fg->getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), position);
2552 return;
2553 }
2554
2555 OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* ordered = KlattGrid_getAddressOfAmplitudescxx . . $ KlattGrid_getAddressOfAmplitudes(f8d2ccdcfbbb2b0f). (me, formantType);
2556 const integercxx . . $ integer# noa = ordered->sizecxx . . $ CollectionOf#size.;
2557 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (nof == noa,
2558 U"The number of formants (", nof, U") and the number of amplitudes (", noa, U") should be equal.");
2559
2560 FormantGrid_addFormantAndBandwidthTierscxx . . $ FormantGrid_addFormantAndBandwidthTiers(47ebe458dfc3e98c). (fg->getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), position);
2561 try {
2562 autoIntensityTiercxx . . $ autoIntensityTier# tier = IntensityTier_createcxx . . $ IntensityTier_create(3d279d9ea4a74662). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax.);
2563 ordered -> addItemAtPosition_movecxx . . $ OrderedOf#addItemAtPosition_move(ca501a207ce7a6c1). (tiercxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).(), position);
2564 } catch (MelderErrorcxx . . $ MelderError#) { // restore original
2565 FormantGrid_removeFormantAndBandwidthTierscxx . . $ FormantGrid_removeFormantAndBandwidthTiers(47ebe458dfc3e98c). (fg->getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), position);
2566 }
2567 } catch (MelderErrorcxx . . $ MelderError#) {
2568 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no formant added.");
2569 }
2570 }
2571
2572 void KlattGrid_removeFormantcxx . . $ KlattGrid_removeFormant(69f595c7b893d654). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, integercxx . . $ integer# position) {
2573 autoFormantGridcxx . . $ autoFormantGrid#* fg = KlattGrid_getAddressOfFormantGridcxx . . $ KlattGrid_getAddressOfFormantGrid(7842227f7b4c6554). (me, formantType);
2574 const integercxx . . $ integer# nof = (*fg) ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..sizecxx . . $ CollectionOf#size.;
2575 if (formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::NASAL_ANTIcxx . . $ kKlattGridFormantType#NASAL_ANTI. || formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::TRACHEAL_ANTIcxx . . $ kKlattGridFormantType#TRACHEAL_ANTI. ||
2576 formantType == kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::DELTAcxx . . $ kKlattGridFormantType#DELTA.) {
2577 if (position < 1 || position > nof)
2578 return;
2579 FormantGrid_removeFormantAndBandwidthTierscxx . . $ FormantGrid_removeFormantAndBandwidthTiers(47ebe458dfc3e98c). (fg->getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), position);
2580 } else {
2581 // oral & nasal & tracheal formants can have amplitudes
2582 // only remove a formant and its amplitude tier if number of formants and amplitudes are the same
2583 OrderedOfcxx . . $ OrderedOf#<structIntensityTiercxx . . $ structIntensityTier#>* ordered = KlattGrid_getAddressOfAmplitudescxx . . $ KlattGrid_getAddressOfAmplitudes(f8d2ccdcfbbb2b0f). (me, formantType);
2584 const integercxx . . $ integer# noa = ordered->sizecxx . . $ CollectionOf#size.;
2585 if (position < 1 || position > nof || position > noa) {
2586 if (nof != noa) {
2587 Melder_warningcxx . . $ Melder_warning(6298c93241566110). (U"The number of formant tiers (", nof, U") and the number of amplitude tiers (",
2588 noa, U") don't match. Nothing removed.");
2589 }
2590 return;
2591 }
2592 FormantGrid_removeFormantAndBandwidthTierscxx . . $ FormantGrid_removeFormantAndBandwidthTiers(47ebe458dfc3e98c). (fg->getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), position);
2593 ordered -> removeItemcxx . . $ CollectionOf#removeItem(1624ee8275b10bda). (position);
2594 }
2595 }
2596
2597 void KlattGrid_addFormantFrequencyAndBandwidthTierscxx . . $ KlattGrid_addFormantFrequencyAndBandwidthTiers(69f595c7b893d654). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, integercxx . . $ integer# position) {
2598 autoFormantGridcxx . . $ autoFormantGrid#* fg = KlattGrid_getAddressOfFormantGridcxx . . $ KlattGrid_getAddressOfFormantGrid(7842227f7b4c6554). (me, formantType);
2599 FormantGrid_addFormantAndBandwidthTierscxx . . $ FormantGrid_addFormantAndBandwidthTiers(47ebe458dfc3e98c). (fg->getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), position);
2600 }
2601
2602 void KlattGrid_removeFormantFrequencyAndBandwidthTierscxx . . $ KlattGrid_removeFormantFrequencyAndBandwidthTiers(69f595c7b893d654). (KlattGrid me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType# formantType, integercxx . . $ integer# position) {
2603 autoFormantGridcxx . . $ autoFormantGrid#* fg = KlattGrid_getAddressOfFormantGridcxx . . $ KlattGrid_getAddressOfFormantGrid(7842227f7b4c6554). (me, formantType);
2604 FormantGrid_removeFormantAndBandwidthTierscxx . . $ FormantGrid_removeFormantAndBandwidthTiers(47ebe458dfc3e98c). (fg->getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), position);
2605 }
2606
2607 double KlattGrid_getDeltaFormantAtTimecxx . . $ KlattGrid_getDeltaFormantAtTime(c3bdb988f14e3a33). (KlattGrid me, integercxx . . $ integer# iformant, double t) {
2608 return FormantGrid_getFormantAtTimecxx . . $ FormantGrid_getFormantAtTime(175baec10880f703). (mycxx . . $ `melder/melder.h:44:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). delta_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), iformant, t);
2609 }
2610 void KlattGrid_addDeltaFormantPointcxx . . $ KlattGrid_addDeltaFormantPoint(494c0dc0fc0d65c9). (KlattGrid me, integercxx . . $ integer# iformant, double t, double value) {
2611 FormantGrid_addFormantPointcxx . . $ FormantGrid_addFormantPoint(a8593809562a6688). (mycxx . . $ `melder/melder.h:44:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). delta_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), iformant, t, value);
2612 }
2613 void KlattGrid_removeDeltaFormantPointscxx . . $ KlattGrid_removeDeltaFormantPoints(494c0dc0fc0d65c9). (KlattGrid me, integercxx . . $ integer# iformant, double t1, double t2) {
2614 FormantGrid_removeFormantPointsBetweencxx . . $ FormantGrid_removeFormantPointsBetween(a8593809562a6688). (mycxx . . $ `melder/melder.h:44:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). delta_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), iformant, t1, t2);
2615 }
2616 double KlattGrid_getDeltaBandwidthAtTimecxx . . $ KlattGrid_getDeltaBandwidthAtTime(c3bdb988f14e3a33). (KlattGrid me, integercxx . . $ integer# iformant, double t) {
2617 return FormantGrid_getBandwidthAtTimecxx . . $ FormantGrid_getBandwidthAtTime(175baec10880f703). (mycxx . . $ `melder/melder.h:44:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). delta_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), iformant, t);
2618 }
2619 void KlattGrid_addDeltaBandwidthPointcxx . . $ KlattGrid_addDeltaBandwidthPoint(494c0dc0fc0d65c9). (KlattGrid me, integercxx . . $ integer# iformant, double t, double value) {
2620 FormantGrid_addBandwidthPointcxx . . $ FormantGrid_addBandwidthPoint(a8593809562a6688). (mycxx . . $ `melder/melder.h:44:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). delta_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), iformant, t, value);
2621 }
2622 void KlattGrid_removeDeltaBandwidthPointscxx . . $ KlattGrid_removeDeltaBandwidthPoints(494c0dc0fc0d65c9). (KlattGrid me, integercxx . . $ integer# iformant, double t1, double t2) {
2623 FormantGrid_removeBandwidthPointsBetweencxx . . $ FormantGrid_removeBandwidthPointsBetween(a8593809562a6688). (mycxx . . $ `melder/melder.h:44:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). delta_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), iformant, t1, t2);
2624 }
2625
2626 autoFormantGridcxx . . $ autoFormantGrid# KlattGrid_extractDeltaFormantGridcxx . . $ KlattGrid_extractDeltaFormantGrid(78727e6ee714115c). (KlattGrid me) {
2627 try {
2628 autoFormantGridcxx . . $ autoFormantGrid#* fg = KlattGrid_getAddressOfFormantGridcxx . . $ KlattGrid_getAddressOfFormantGrid(7842227f7b4c6554). (me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::DELTAcxx . . $ kKlattGridFormantType#DELTA.);
2629 autoFormantGridcxx . . $ autoFormantGrid# thee = Data_copycxx . . $ Data_copy(97a542a26794c80e). (fg->getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2630 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
2631 } catch (MelderErrorcxx . . $ MelderError#) {
2632 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no delta FormantGrid extracted.");
2633 }
2634 }
2635
2636 void KlattGrid_replaceDeltaFormantGridcxx . . $ KlattGrid_replaceDeltaFormantGrid(79944da13057273e). (KlattGrid me, FormantGridcxx . . $ FormantGrid# thee) {
2637 try {
2638 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! xmin == thycxx . . $ `melder/melder.h:45:9`! xmin && mycxx . . $ `melder/melder.h:44:9`! xmax == thycxx . . $ `melder/melder.h:45:9`! xmax,
2639 U"Domains should be equal");
2640 autoFormantGridcxx . . $ autoFormantGrid#* fg = KlattGrid_getAddressOfFormantGridcxx . . $ KlattGrid_getAddressOfFormantGrid(7842227f7b4c6554). (me, kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::DELTAcxx . . $ kKlattGridFormantType#DELTA.);
2641 autoFormantGridcxx . . $ autoFormantGrid# him = Data_copycxx . . $ Data_copy(97a542a26794c80e). (thee);
2642 *fg =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). him.movecxx . . $ autoSomeThing#move(25acc3554b7d1642).();
2643 } catch (MelderErrorcxx . . $ MelderError#) {
2644 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no delta FormantGrid replaced.");
2645 }
2646 }
2647
2648 autoFormantGridcxx . . $ autoFormantGrid# KlattGrid_to_oralFormantGrid_openPhasescxx . . $ KlattGrid_to_oralFormantGrid_openPhases(ff650c3cb427c608). (KlattGrid me, double fadeFraction) {
2649 try {
2650 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! vocalTract -> oral_formants -> formants.size > 0 || mycxx . . $ `melder/melder.h:44:9`! vocalTract -> oral_formants -> bandwidths.size > 0,
2651 U"Formant grid should not be empty.");
2652
2653 Melder_clipLeftcxx . . $ Melder_clipLeft(6245cd023a7d1552). (0.0, & fadeFraction);
2654 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (fadeFraction < 0.5,
2655 U"Fade fraction should be smaller than 0.5");
2656
2657 mycxx . . $ `melder/melder.h:44:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). options ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). fadeFraction = fadeFraction;
2658 autoFormantGridcxx . . $ autoFormantGrid# thee = Data_copycxx . . $ Data_copy(97a542a26794c80e). ( (FormantGridcxx . . $ FormantGrid#) mycxx . . $ `melder/melder.h:44:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). oral_formants.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2659 KlattGrid_setGlottisCouplingcxx . . $ KlattGrid_setGlottisCoupling(132f1834de956411). (me);
2660 FormantGrid_CouplingGrid_updateOpenPhasescxx . . $ FormantGrid_CouplingGrid_updateOpenPhases(2c9adfc90b41d318). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! coupling.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2661 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
2662 } catch (MelderErrorcxx . . $ MelderError#) {
2663 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no \"open phase\" oral FormantGrid created.");
2664 }
2665 }
2666
2667 autoPointProcesscxx . . $ autoPointProcess# KlattGrid_extractPointProcess_glottalClosurescxx . . $ KlattGrid_extractPointProcess_glottalClosures(81aa0b496172520f). (KlattGrid me) {
2668 try {
2669 // Update PhonationTier
2670 autoPhonationTier pt = PhonationGrid_to_PhonationTiercxx . . $ PhonationGrid_to_PhonationTier(dfa2e4f6c40d1ed). (mycxx . . $ `melder/melder.h:44:9`! phonation.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2671 autoPointProcesscxx . . $ autoPointProcess# thee = PhonationTier_to_PointProcess_closurescxx . . $ PhonationTier_to_PointProcess_closures(9c5ff66da6d77826). (pt.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2672 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
2673 } catch (MelderErrorcxx . . $ MelderError#) {
2674 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no glottal closure points extracted.");
2675 }
2676 }
2677
2678 double KlattGrid_getFricationAmplitudeAtTimecxx . . $ KlattGrid_getFricationAmplitudeAtTime(bfa3676bec2e11d5). (KlattGrid me, double t) {
2679 return RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). fricationAmplitude.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t);
2680 }
2681
2682 void KlattGrid_addFricationAmplitudePointcxx . . $ KlattGrid_addFricationAmplitudePoint(3ed8da27117dae09). (KlattGrid me, double t, double value) {
2683 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). fricationAmplitude.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t, value);
2684 }
2685
2686 void KlattGrid_removeFricationAmplitudePointscxx . . $ KlattGrid_removeFricationAmplitudePoints(3ed8da27117dae09). (KlattGrid me, double t1, double t2) {
2687 AnyTier_removePointsBetweencxx . . $ AnyTier_removePointsBetween(15327dad64b67f1a). (mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). fricationAmplitude.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()->asAnyTiercxx . . $ structRealTier#asAnyTier(2fecc017ee6dfbab).(), t1, t2);
2688 }
2689
2690 autoIntensityTiercxx . . $ autoIntensityTier# KlattGrid_extractFricationAmplitudeTiercxx . . $ KlattGrid_extractFricationAmplitudeTier(fbf918b62e782781). (KlattGrid me) {
2691 return Data_copycxx . . $ Data_copy(97a542a26794c80e). (mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). fricationAmplitude.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2692 }
2693
2694 void KlattGrid_replaceFricationAmplitudeTiercxx . . $ KlattGrid_replaceFricationAmplitudeTier(dc9421b87609e234). (KlattGrid me, IntensityTiercxx . . $ IntensityTier# thee) {
2695 try {
2696 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! xmin == thycxx . . $ `melder/melder.h:45:9`! xmin && mycxx . . $ `melder/melder.h:44:9`! xmax == thycxx . . $ `melder/melder.h:45:9`! xmax,
2697 U"Domains should be equal");
2698 mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). fricationAmplitude =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (thee);
2699 } catch (MelderErrorcxx . . $ MelderError#) {
2700 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no frication amplitude tier replaced.");
2701 }
2702 }
2703
2704 double KlattGrid_getFricationBypassAtTimecxx . . $ KlattGrid_getFricationBypassAtTime(bfa3676bec2e11d5). (KlattGrid me, double t) {
2705 return RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bypass.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t);
2706 }
2707
2708 void KlattGrid_addFricationBypassPointcxx . . $ KlattGrid_addFricationBypassPoint(3ed8da27117dae09). (KlattGrid me, double t, double value) {
2709 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bypass.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t, value);
2710 }
2711
2712 void KlattGrid_removeFricationBypassPointscxx . . $ KlattGrid_removeFricationBypassPoints(3ed8da27117dae09). (KlattGrid me, double t1, double t2) {
2713 AnyTier_removePointsBetweencxx . . $ AnyTier_removePointsBetween(15327dad64b67f1a). (mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bypass.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()->asAnyTiercxx . . $ structRealTier#asAnyTier(2fecc017ee6dfbab).(), t1, t2);
2714 }
2715
2716 autoIntensityTiercxx . . $ autoIntensityTier# KlattGrid_extractFricationBypassTiercxx . . $ KlattGrid_extractFricationBypassTier(fbf918b62e782781). (KlattGrid me) {
2717 return Data_copycxx . . $ Data_copy(97a542a26794c80e). (mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bypass.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2718 }
2719
2720 void KlattGrid_replaceFricationBypassTiercxx . . $ KlattGrid_replaceFricationBypassTier(dc9421b87609e234). (KlattGrid me, IntensityTiercxx . . $ IntensityTier# thee) {
2721 try {
2722 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! xmin == thycxx . . $ `melder/melder.h:45:9`! xmin && mycxx . . $ `melder/melder.h:44:9`! xmax == thycxx . . $ `melder/melder.h:45:9`! xmax,
2723 U"Domains should be equal");
2724 mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bypass =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (thee);
2725 } catch (MelderErrorcxx . . $ MelderError#) {
2726 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no frication bypass tier replaced.");
2727 }
2728 }
2729
2730 void KlattGrid_setGlottisCouplingcxx . . $ KlattGrid_setGlottisCoupling(132f1834de956411). (KlattGrid me) {
2731 try {
2732 mycxx . . $ `melder/melder.h:44:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). glottis =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). PhonationGrid_to_PhonationTiercxx . . $ PhonationGrid_to_PhonationTier(dfa2e4f6c40d1ed). (mycxx . . $ `melder/melder.h:44:9`! phonation.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2733 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! coupling -> glottis,
2734 U"Phonation tier should not be empty.");
2735 } catch (MelderErrorcxx . . $ MelderError#) {
2736 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no coupling could be set.");
2737 }
2738 }
2739
2740 #if 0
2741 static autoSound KlattGrid_to_Sound_aspiration (KlattGrid me, double samplingFrequency) {
2742 return PhonationGrid_to_Sound_aspiration (my phonation.get(), samplingFrequency);
2743 }
2744 #endif
2745
2746 autoSoundcxx . . $ autoSound# KlattGrid_to_Sound_phonationcxx . . $ KlattGrid_to_Sound_phonation(4d0d5ded7f97051d). (KlattGrid me) {
2747 return PhonationGrid_to_Soundcxx . . $ PhonationGrid_to_Sound(91d3261e423536d3). (mycxx . . $ `melder/melder.h:44:9`! phonation.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0, mycxx . . $ `melder/melder.h:44:9`! options ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). samplingFrequency);
2748 }
2749
2750 autoSoundcxx . . $ autoSound# KlattGrid_to_Soundcxx . . $ KlattGrid_to_Sound(4d0d5ded7f97051d). (KlattGrid me) {
2751 try {
2752 autoSoundcxx . . $ autoSound# theecxx . . $ autoSomeThing#autoSomeThing(49f6e7a06ebc5aa8).;
2753 const PhonationGridPlayOptions pp = mycxx . . $ `melder/melder.h:44:9`! phonation ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
2754 const FricationGridPlayOptions pf = mycxx . . $ `melder/melder.h:44:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
2755 const double samplingFrequency = mycxx . . $ `melder/melder.h:44:9`! options ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). samplingFrequency;
2756
2757 if (pp -> voicing)
2758 KlattGrid_setGlottisCouplingcxx . . $ KlattGrid_setGlottisCoupling(132f1834de956411). (me);
2759
2760 if (pp -> aspiration || pp -> voicing) { // No vocal tract filtering if no glottal source signal present
2761 autoSoundcxx . . $ autoSound# source = PhonationGrid_to_Soundcxx . . $ PhonationGrid_to_Sound(91d3261e423536d3). (mycxx . . $ `melder/melder.h:44:9`! phonation.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! coupling.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), samplingFrequency);
2762 thee =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Sound_VocalTractGrid_CouplingGrid_filtercxx . . $ Sound_VocalTractGrid_CouplingGrid_filter(51132d8301f8bc48). (source.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! vocalTract.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! coupling.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2763 }
2764
2765 if (pf -> endFricationFormant > 0 || pf -> bypass) {
2766 autoSoundcxx . . $ autoSound# frication = FricationGrid_to_Soundcxx . . $ FricationGrid_to_Sound(38e320daed217d9d). (mycxx . . $ `melder/melder.h:44:9`! frication.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), samplingFrequency);
2767 if (thee)
2768 _Sounds_add_inplacecxx . . $ _Sounds_add_inplace(3740d3b02ef916dc). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), frication.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2769 else
2770 thee =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). frication.movecxx . . $ autoSomeThing#move(25acc3554b7d1642).();
2771 }
2772
2773 if (! thee)
2774 thee =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Sound_createEmptyMonocxx . . $ Sound_createEmptyMono(e34f441442c8776d). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., samplingFrequency);
2775
2776 if (mycxx . . $ `melder/melder.h:44:9`! options ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). scalePeak)
2777 Vector_scalecxx . . $ Vector_scale(54f31cdb89d1acde). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.99);
2778
2779 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
2780 } catch (MelderErrorcxx . . $ MelderError#) {
2781 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no Sound created.");
2782 }
2783 }
2784
2785 void KlattGrid_playSpecialcxx . . $ KlattGrid_playSpecial(cff2bf275a7c2f11). (KlattGrid me, Sound_PlayCallbackcxx . . $ Sound_PlayCallback# callback, Thingcxx . . $ Thing# boss) {
2786 try {
2787 autoSoundcxx . . $ autoSound# thee = KlattGrid_to_Soundcxx . . $ KlattGrid_to_Sound(4d0d5ded7f97051d). (me);
2788 const KlattGridPlayOptions him = mycxx . . $ `melder/melder.h:44:9`! options.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
2789 if (hiscxx . . $ `melder/melder.h:47:9`! scalePeak)
2790 Vector_scalecxx . . $ Vector_scale(54f31cdb89d1acde). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.99);
2791 if (hiscxx . . $ `melder/melder.h:47:9`! xmin == 0.0 && hiscxx . . $ `melder/melder.h:47:9`! xmax == 0.0) {
2792 hiscxx . . $ `melder/melder.h:47:9`! xmin = mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin.;
2793 hiscxx . . $ `melder/melder.h:47:9`! xmax = mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax.;
2794 }
2795 Sound_playPartcxx . . $ Sound_playPart(4a8b47ed00757136). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), hiscxx . . $ `melder/melder.h:47:9`! xmin, hiscxx . . $ `melder/melder.h:47:9`! xmax, callback, boss);
2796 } catch (MelderErrorcxx . . $ MelderError#) {
2797 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not played.");
2798 }
2799 }
2800
2801 void KlattGrid_playcxx . . $ KlattGrid_play(cff2bf275a7c2f11). (KlattGrid me, Sound_PlayCallbackcxx . . $ Sound_PlayCallback# callback, Thingcxx . . $ Thing# boss) {
2802 KlattGrid_setDefaultPlayOptionscxx . . $ KlattGrid_setDefaultPlayOptions(132f1834de956411). (me);
2803 KlattGrid_playSpecialcxx . . $ KlattGrid_playSpecial(cff2bf275a7c2f11). (me, callback, boss);
2804 }
2805
2806 /************************* Sound(s) & KlattGrid **************************************************/
2807
2808 autoSoundcxx . . $ autoSound# Sound_KlattGrid_filter_fricationcxx . . $ Sound_KlattGrid_filter_frication(8c8ab1f859eff651). (Soundcxx . . $ Sound# me, KlattGrid thee) {
2809 return Sound_FricationGrid_filtercxx . . $ Sound_FricationGrid_filter(86b9b8f8e04c2f5d). (me, thycxx . . $ `melder/melder.h:45:9`! frication.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2810 }
2811
2812 autoSoundcxx . . $ autoSound# Sound_KlattGrid_filterByVocalTractcxx . . $ Sound_KlattGrid_filterByVocalTract(d2473620210bcbb2). (Soundcxx . . $ Sound# me, KlattGrid thee, kKlattGridFilterModelcxx . . $ kKlattGridFilterModel# filterModel) {
2813 try {
2814 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! xmin == thycxx . . $ `melder/melder.h:45:9`! xmin && mycxx . . $ `melder/melder.h:44:9`! xmax == thycxx . . $ `melder/melder.h:45:9`! xmax,
2815 U"Domains should be equal.");
2816 KlattGrid_setDefaultPlayOptionscxx . . $ KlattGrid_setDefaultPlayOptions(132f1834de956411). (thee);
2817 thycxx . . $ `melder/melder.h:45:9`! coupling ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). options ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). openglottis = 0; // don't trust openglottis info!
2818 thycxx . . $ `melder/melder.h:45:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). options ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). filterModel = filterModel;
2819 return Sound_VocalTractGrid_CouplingGrid_filtercxx . . $ Sound_VocalTractGrid_CouplingGrid_filter(51132d8301f8bc48). (me, thycxx . . $ `melder/melder.h:45:9`! vocalTract.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), thycxx . . $ `melder/melder.h:45:9`! coupling.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2820 } catch (MelderErrorcxx . . $ MelderError#) {
2821 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not filtered by KlattGrid.");
2822 }
2823 }
2824
2825 /******************* KlattTable to KlattGrid *********************/
2826
2827 autoKlattGrid KlattTable_to_KlattGridcxx . . $ KlattTable_to_KlattGrid(778709ee4ae4c02c). (KlattTablecxx . . $ KlattTable# me, double frameDuration) {
2828 try {
2829 Tablecxx . . $ Table# kt = (Tablecxx . . $ Table#) me;
2830
2831 const integercxx . . $ integer# numberOfRows = mycxx . . $ `melder/melder.h:44:9`! rowscxx . . $ structTable#rows..sizecxx . . $ CollectionOf#size.;
2832 const double tmin = 0, tmax = numberOfRows * frameDuration;
2833 constexpr double dBNul = -300;
2834 const double dB_offset = -20.0 * log10cxx . . $ log10(fee4f1d22bc8e617). (2.0e-5) - 87.0; // in KlattTable maximum in DB_to_LIN is at 87 dB : 32767
2835 const double dB_offset_voicing = 20.0 * log10cxx . . $ log10(7759b11ec49fe502). (320000 / 32767); // V' [n] in range (-320000,32000)
2836 const double dB_offset_noise = -20.0 * log10cxx . . $ log10(fee4f1d22bc8e617). (32.767 / 8.192); // noise in range (-8192,8192)
2837 // double dB_offset_noise = -20 * log10 (320000/32767) - 20 * log10 (32.767 / 8.192);
2838 const double ap [7] = {0, 0.4, 0.15, 0.06, 0.04, 0.022, 0.03 };
2839 const integercxx . . $ integer# numberOfFormants = 6;
2840 const integercxx . . $ integer# numberOfNasalFormants = 1;
2841 const integercxx . . $ integer# numberOfNasalAntiFormants = numberOfNasalFormants;
2842 const integercxx . . $ integer# numberOfTrachealFormants = 0;
2843 const integercxx . . $ integer# numberOfTrachealAntiFormants = numberOfTrachealFormants;
2844 const integercxx . . $ integer# numberOfFricationFormants = 6;
2845 const integercxx . . $ integer# numberOfDeltaFormants = 1;
2846
2847 autoKlattGrid thee = KlattGrid_createcxx . . $ KlattGrid_create(f5096f7ce2feecc). (tmin, tmax, numberOfFormants, numberOfNasalFormants,
2848 numberOfNasalAntiFormants, numberOfTrachealFormants, numberOfTrachealAntiFormants,
2849 numberOfFricationFormants, numberOfDeltaFormants);
2850 for (integercxx . . $ integer# irow = 1; irow <= numberOfRows; irow ++) {
2851 const double t = (irow - 1) * frameDuration;
2852
2853 integercxx . . $ integer# icol = 1;
2854 double val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, icol) / 10.0; // F0hz10
2855 const double f0 = val;
2856 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! phonation ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pitch.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t, f0);
2857
2858 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // AVdb
2859 // dB values below 13 were put to zero in the DBtoLIN function
2860 val -= 7.0;
2861 if (val < 13.0)
2862 val = dBNul;
2863
2864 // RealTier_addPoint (thy source -> voicingAmplitude, t, val);
2865
2866 for (integercxx . . $ integer# kf = 1; kf <= 6; kf ++) {
2867 const double fk = val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // Fhz
2868 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). oral_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).kf], t, val);
2869 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). frication_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).kf], t, val); // only amplitudes and bandwidths in frication section
2870 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // Bhz
2871 if (val <= 0.0)
2872 val = fk / 10.0;
2873 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). oral_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bandwidthscxx . . $ structFormantGrid#bandwidths..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).kf], t, val);
2874 }
2875
2876 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // FNZhz
2877 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nasal_antiformants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).1], t, val);
2878
2879 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // BNZhz
2880 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nasal_antiformants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bandwidthscxx . . $ structFormantGrid#bandwidths..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).1], t, val);
2881
2882 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // FNPhz
2883 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nasal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). formantscxx . . $ structFormantGrid#formants..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).1], t, val);
2884
2885 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // BNPhz
2886 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nasal_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bandwidthscxx . . $ structFormantGrid#bandwidths..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).1], t, val);
2887
2888 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // ah
2889 if (val < 13.0)
2890 val = dBNul;
2891 else
2892 val += 20.0 * log10cxx . . $ log10(fee4f1d22bc8e617). (0.05) + dB_offset_noise;
2893
2894 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! phonation ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). aspirationAmplitude.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t, val);
2895
2896 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // Kopen
2897 const double openPhase = ( f0 > 0.0 ? (val / 16000.0) * f0 : 0.7 );
2898 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! phonation ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). openPhase.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t, openPhase);
2899
2900 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // Aturb breathinessAmplitude during voicing (max is 8192)
2901 if (val < 13.0)
2902 val = dBNul;
2903 else
2904 val += 20.0 * log10cxx . . $ log10(fee4f1d22bc8e617). (0.1) + dB_offset_noise;
2905
2906 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! phonation ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). breathinessAmplitude.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t, val);
2907
2908 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // TLTdb
2909 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! phonation ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). spectralTilt.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t, val);
2910
2911 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // AF
2912 if (val < 13.0)
2913 val = dBNul;
2914 else
2915 val += 20.0 * log10cxx . . $ log10(fee4f1d22bc8e617). (0.25) + dB_offset_noise;
2916
2917 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). fricationAmplitude.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t, val);
2918
2919 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // Kskew ???
2920 //RealTier_addPoint (, t, val);
2921
2922 for (integercxx . . $ integer# kf = 1; kf <= 6; kf ++) {
2923 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // Ap
2924 if (val < 13.0)
2925 val = dBNul;
2926 else
2927 val += 20.0 * log10cxx . . $ log10(fee4f1d22bc8e617). (ap [kf]) + dB_offset;
2928
2929 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). oral_formants_amplitudes.atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).kf], t, val);
2930 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). frication_formants_amplitudes.atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).kf], t, val);
2931 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // Bhz
2932 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). frication_formants ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bandwidthscxx . . $ structFormantGrid#bandwidths..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).kf], t, val);
2933 }
2934
2935 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // ANP
2936 if (val < 13.0)
2937 val = dBNul;
2938 else
2939 val += 20.0 * log10cxx . . $ log10(fee4f1d22bc8e617). (0.6) + dB_offset;
2940
2941 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! vocalTract ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nasal_formants_amplitudes.atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).1], t, val);
2942
2943 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // AB
2944 if (val < 13.0)
2945 val = dBNul;
2946 else
2947 val += 20.0 * log10cxx . . $ log10(fee4f1d22bc8e617). (0.05) + dB_offset_noise;
2948
2949 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! frication ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bypass.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t, val);
2950
2951 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // AVpdb
2952 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! phonation ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). voicingAmplitude.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t, val + dB_offset_voicing);
2953
2954 val = Table_getNumericValue_acxx . . $ Table_getNumericValue_a(2893554ada103e3b). (kt, irow, ++ icol); // Gain0
2955 val -= 3.0;
2956 if (val <= 0.0)
2957 val = 57.0;
2958 RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thycxx . . $ `melder/melder.h:45:9`! gain.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t, val + dB_offset);
2959 }
2960 // We don't need the following low-pass: we do not use oversampling !!
2961 //RealTier_addPoint (thy tracheal_formants -> formants->at [1], 0.5*(tmin+tmax), 0.095*samplingFrequency);
2962 //RealTier_addPoint (thy tracheal_formants -> bandwidths->at [1], 0.5*(tmin+tmax), 0.063*samplingFrequency);
2963 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
2964 } catch (MelderErrorcxx . . $ MelderError#) {
2965 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no KlattGrid created.");
2966 }
2967 }
2968
2969 autoKlattGrid Sound_to_KlattGrid_simplecxx . . $ Sound_to_KlattGrid_simple(1d2a0823941b12a8). (Soundcxx . . $ Sound# me, double timeStep, integercxx . . $ integer# maximumNumberOfFormants, double maximumFormantFrequency,
2970 double windowLength, double preEmphasisFrequency, double pitchFloor, double pitchCeiling, double pitchFloorForIntensity, int subtractMean)
2971 {
2972 try {
2973 const integercxx . . $ integer# numberOfFormants = maximumNumberOfFormants;
2974 const integercxx . . $ integer# numberOfNasalFormants = 1;
2975 const integercxx . . $ integer# numberOfNasalAntiFormants = numberOfNasalFormants;
2976 const integercxx . . $ integer# numberOfTrachealFormants = 1;
2977 const integercxx . . $ integer# numberOfTrachealAntiFormants = numberOfTrachealFormants;
2978 const integercxx . . $ integer# numberOfFricationFormants = maximumNumberOfFormants;
2979 const integercxx . . $ integer# numberOfDeltaFormants = 1;
2980 autoSoundcxx . . $ autoSound# sound = Data_copycxx . . $ Data_copy(97a542a26794c80e). (me);
2981 Vector_subtractMeancxx . . $ Vector_subtractMean(8ab8c8e01f03cabf). (sound.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2982 autoFormantcxx . . $ autoFormant# formant = Sound_to_Formant_burgcxx . . $ Sound_to_Formant_burg(d30006947cf564ad). (sound.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), timeStep, maximumNumberOfFormants,
2983 maximumFormantFrequency, windowLength, preEmphasisFrequency);
2984 autoFormantGridcxx . . $ autoFormantGrid# formantGrid = Formant_downto_FormantGridcxx . . $ Formant_downto_FormantGrid(e5fbb1b24a0773f9). (formant.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2985 autoPitchcxx . . $ autoPitch# pitch = Sound_to_Pitchcxx . . $ Sound_to_Pitch(c773ddec40eb7e2b). (sound.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), timeStep, pitchFloor, pitchCeiling);
2986 autoPitchTiercxx . . $ autoPitchTier# pitchTier = Pitch_to_PitchTiercxx . . $ Pitch_to_PitchTier(511873a878854c23). (pitch.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2987 autoIntensitycxx . . $ autoIntensity# intensity = Sound_to_Intensitycxx . . $ Sound_to_Intensity(523838029c3b40bd). (sound.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pitchFloorForIntensity, timeStep, subtractMean);
2988 autoIntensityTiercxx . . $ autoIntensityTier# intensityTier = Intensity_downto_IntensityTiercxx . . $ Intensity_downto_IntensityTier(2cd22a554f648163). (intensity.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2989 autoKlattGrid thee = KlattGrid_createcxx . . $ KlattGrid_create(f5096f7ce2feecc). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., numberOfFormants, numberOfNasalFormants, numberOfNasalAntiFormants,
2990 numberOfTrachealFormants, numberOfTrachealAntiFormants, numberOfFricationFormants, numberOfDeltaFormants);
2991 KlattGrid_replacePitchTiercxx . . $ KlattGrid_replacePitchTier(c26aa2dbc63783a3). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), pitchTier.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2992 KlattGrid_replaceFormantGridcxx . . $ KlattGrid_replaceFormantGrid(3dbe8696c60bf8c). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::ORALcxx . . $ kKlattGridFormantType#ORAL., formantGrid.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2993 KlattGrid_replaceVoicingAmplitudeTiercxx . . $ KlattGrid_replaceVoicingAmplitudeTier(dc9421b87609e234). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), intensityTier.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
2994 return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
2995 } catch (MelderErrorcxx . . $ MelderError#) {
2996 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no simple KlattGrid created.");
2997 }
2998 }
2999
3000 autoKlattGrid KlattGrid_createFromVowelcxx . . $ KlattGrid_createFromVowel(75833dcfdf630c3d). (double duration, double f0start, double f1, double b1, double f2, double b2, double f3, double b3, double f4,
3001 double bandWidthFraction, double formantFrequencyInterval)
3002 {
3003 const integercxx . . $ integer# numberOfOralFormants = 15;
3004 const double tstart = 0.0;
3005 autoKlattGrid me = KlattGrid_createcxx . . $ KlattGrid_create(f5096f7ce2feecc). (0.0, duration, numberOfOralFormants, 0, 0, 0, 0, 0, 0);
3006 KlattGrid_addPitchPointcxx . . $ KlattGrid_addPitchPoint(3ed8da27117dae09). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tstart, f0start);
3007 KlattGrid_addVoicingAmplitudePointcxx . . $ KlattGrid_addVoicingAmplitudePoint(3ed8da27117dae09). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tstart, 90.0);
3008 if (f1 > 0.0) {
3009 KlattGrid_addFormantPointcxx . . $ KlattGrid_addFormantPoint(29d3189245619d0b). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::ORALcxx . . $ kKlattGridFormantType#ORAL., 1, tstart, f1);
3010 KlattGrid_addBandwidthPointcxx . . $ KlattGrid_addBandwidthPoint(29d3189245619d0b). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::ORALcxx . . $ kKlattGridFormantType#ORAL., 1, tstart, b1);
3011 }
3012 if (f2 > 0.0) {
3013 KlattGrid_addFormantPointcxx . . $ KlattGrid_addFormantPoint(29d3189245619d0b). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::ORALcxx . . $ kKlattGridFormantType#ORAL., 2, tstart, f2);
3014 KlattGrid_addBandwidthPointcxx . . $ KlattGrid_addBandwidthPoint(29d3189245619d0b). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::ORALcxx . . $ kKlattGridFormantType#ORAL., 2, tstart, b2);
3015 }
3016 if (f3 > 0.0) {
3017 KlattGrid_addFormantPointcxx . . $ KlattGrid_addFormantPoint(29d3189245619d0b). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::ORALcxx . . $ kKlattGridFormantType#ORAL., 3, tstart, f3);
3018 KlattGrid_addBandwidthPointcxx . . $ KlattGrid_addBandwidthPoint(29d3189245619d0b). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::ORALcxx . . $ kKlattGridFormantType#ORAL., 3, tstart, b3);
3019 }
3020 if (f4 > 0.0) {
3021 KlattGrid_addFormantPointcxx . . $ KlattGrid_addFormantPoint(29d3189245619d0b). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::ORALcxx . . $ kKlattGridFormantType#ORAL., 4, tstart, f4);
3022 KlattGrid_addBandwidthPointcxx . . $ KlattGrid_addBandwidthPoint(29d3189245619d0b). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::ORALcxx . . $ kKlattGridFormantType#ORAL., 4, tstart, f4 * bandWidthFraction);
3023 }
3024 if (formantFrequencyInterval > 0.0) {
3025 const double startFrequency = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a). (stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a). (f1, f2), stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a). (f3, f4));
3026 for (integercxx . . $ integer# iformant = 5; iformant <= numberOfOralFormants; iformant ++) {
3027 const double frequency = startFrequency + (iformant - 4) * formantFrequencyInterval;
3028 KlattGrid_addFormantPointcxx . . $ KlattGrid_addFormantPoint(29d3189245619d0b). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::ORALcxx . . $ kKlattGridFormantType#ORAL., iformant, tstart, frequency);
3029 KlattGrid_addBandwidthPointcxx . . $ KlattGrid_addBandwidthPoint(29d3189245619d0b). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), kKlattGridFormantTypecxx . . $ kKlattGridFormantType#::ORALcxx . . $ kKlattGridFormantType#ORAL., iformant, tstart, frequency * bandWidthFraction);
3030 }
3031 }
3032 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
3033 }
3034
3035 /* End of file KlattGrid.cpp */