1 /* praat_LPC_init.cpp
2  *
3  * Copyright (C) 1994-2021 David Weenink
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 2 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 /*
20  djmw 20030613 Latest modification
21  djmw 20040414 Forms texts.
22  djmw 20060428 Latest modification
23  djmw 20061218 Changed to Melder_information<x> format.
24  djmw 20070902 Melder_error<1...>
25  djmw 20071011 REQUIRE requires L"".
26  djmw 20080313 Cepstrum_formula
27  djmw 20100212 Analysis window length is now "Window length"
28 */
29 
30 #include "Cepstrumc.h"
31 #include "Cepstrogram.h"
UefiRuntimeServicesTableLibConstructor(IN EFI_HANDLE ImageHandle,IN EFI_SYSTEM_TABLE * SystemTable)32 #include "Cepstrum_and_Spectrum.h"
33 #include "DTW.h"
34 #include "FilterBank.h"
35 #include "Formant_extensions.h"
36 #include "FormantPath.h"
37 #include "FormantPathEditor.h"
38 #include "LPC.h"
39 #include "MFCC.h"
40 #include "LFCC.h"
41 #include "LPC_and_Cepstrumc.h"
42 #include "LPC_and_Formant.h"
43 #include "LPC_and_LFCC.h"
44 #include "LPC_and_LineSpectralFrequencies.h"
45 #include "LPC_and_Polynomial.h"
46 #include "LPC_and_Tube.h"
47 #include "LPC_to_Spectrogram.h"
48 #include "LPC_to_Spectrum.h"
49 #include "NUM2.h"
50 #include "PowerCepstrum.h"
51 #include "PowerCepstrogram.h"
52 #include "Sound_and_LPC.h"
53 #include "Sound_and_LPC_robust.h"
54 #include "Sound_and_Cepstrum.h"
55 #include "Sound_to_MFCC.h"
56 #include "VocalTractTier.h"
57 
58 #include "praat_TimeFrameSampled.h"
59 #include "praat_Matrix.h"
60 
61 #define praat_Quefrency_RANGE(fromQuefrency,toQuefrency) \
62 	REAL (fromQuefrency, U"left Quefrency range (s)", U"0.0") \
63 	REAL (toQuefrency, U"right Quefrency range (s)", U"0.0 (= all)")
64 
65 static const conststring32 DRAW_BUTTON    = U"Draw -";
66 static const conststring32 QUERY_BUTTON   = U"Query -";
67 static const conststring32 MODIFY_BUTTON   = U"Modify -";
68 
69 void praat_CC_init (ClassInfo klas);
70 void praat_TimeFrameSampled_query_init (ClassInfo klas);
71 
72 DIRECT (HELP__FormantPath_help) {
73 	HELP (U"FormantPath")
74 }
75 
76 static void cb_FormantPathEditor_publication (Editor /* editor */, autoDaata publication) {
77 	/*
78 	 * Keep the gate for error handling.
79 	 */
80 	try {
81 		praat_new (publication.move());
82 		praat_updateSelection ();
83 	} catch (MelderError) {
84 		Melder_flushError ();
85 	}
86 }
87 
88 DIRECT (EDITOR_ONE_FormantPath_viewAndEditAlone) {
89 	EDITOR_ONE (a,FormantPath)
90 		autoFormantPathEditor editor = FormantPathEditor_create (ID_AND_FULL_NAME, me, nullptr, nullptr);
91 		Editor_setPublicationCallback (editor.get(), cb_FormantPathEditor_publication);
92 	EDITOR_ONE_END
93 }
94 
95 DIRECT (HINT__FormantPath_Sound_viewAndEdit) {
96 	INFO_NONE
97 		Melder_information (U"To include a Sound in your FormantPath window:\n"
98 			"select a FormantPath and a Sound, and click \"View & Edit\".");
99 	INFO_NONE_END
100 }
101 
102 FORM (GRAPHICS_EACH__FormantPath_drawAsGrid, U"FormantPath: Draw as grid", nullptr) {
103 	REAL (tmin, U"left Time range (s)", U"0.0")
104 	REAL (tmax, U"right Time range (s)", U"0.1")
105 	POSITIVE (fmax, U"Maximum frequency", U"6200.0")
106 	NATURAL (fromFormant, U"left Formant range", U"1")
107 	NATURAL (toFormant, U"right Formant range", U"5")
108 	BOOLEAN (showBandwidths, U"Show bandwidths", true)
109 	COLOUR (odd, U"Colour of F1, F3, F5", U"red")
110 	COLOUR (even, U"Colour of F2, F4", U"purple")
111 	INTEGER (numberOfRows, U"Number of rows", U"0")
112 	INTEGER (numberOfColumns, U"Number of columns", U"0")
113 	POSITIVE (xSpaceFraction, U"X space fraction", U"0.1")
114 	POSITIVE (ySpaceFraction, U"Y space fraction", U"0.1")
115 	POSITIVE (lineEvery_Hz, U"Horizontal line every (Hz)", U"1000.0")
116 	REAL (xCursor, U"X cursor line at (s)", U"-0.1 (=no line)")
117 	REAL (yCursor, U"Y cursor at (Hz)", U"-100.0 (=no line)")
118 	NATURALVECTOR (parameters, U"Coefficients by track", WHITESPACE_SEPARATED_, U"7 7 7 7")
119 	BOOLEAN (markCandidatesWithinPath, U"Mark candidates within path", false)
120 	COLOUR (markColour, U"Mark colour", U"{0.984,0.984, 0.7}")
121 	BOOLEAN (showStress, U"Show stress", true)
122 	POSITIVE (powerf, U"Power", U"1.25")
123 	BOOLEAN (showEstimatedModels, U"Show estimated models", true)
124 	BOOLEAN (garnish, U"Garnish", true)
125 	OK
126 DO
127 	GRAPHICS_EACH (FormantPath)
128 		FormantPath_drawAsGrid (me, GRAPHICS, tmin, tmax, fmax, fromFormant, toFormant,
129 			showBandwidths, odd, even, numberOfRows, numberOfColumns, xSpaceFraction, ySpaceFraction, lineEvery_Hz,
130 			xCursor, yCursor, markColour, parameters, markCandidatesWithinPath, showStress, powerf, showEstimatedModels, garnish
131 		);
132 	GRAPHICS_EACH_END
133 }
134 
135 FORM (NEW__FormantPath_downTo_Table_optimalInterval, U"FormantPath: Down to Table (optimal interval)...",
136 	U"FormantPath: Down to Table (optimal interval)...")
137 {
138 	REAL (tmin, U"left Time range (s)", U"0.1")
139 	REAL (tmax, U"right Time range (s)", U"0.2")
140 	NATURALVECTOR (parameters, U"Coefficients by track", WHITESPACE_SEPARATED_, U"3 3 3")
141 	POSITIVE (powerf, U"Power", U"1.25")
142 	BOOLEAN (includeFrameNumber, U"Include frame number", false)
143 	BOOLEAN (includeTime, U"Include time", true)
144 	NATURAL (numberOfTimeDecimals, U"Number of time decimals", U"6")
145 	BOOLEAN (includeIntensity, U"Include intensity", false)
146 	NATURAL (numberOfIntensityDecimals, U"Number of intensity decimals", U"3")
147 	BOOLEAN (includeNumberOfFormants, U"Include number of formants", true)
148 	NATURAL (numberOfFrequencyDecimals, U"Number of frequency decimals", U"3")
149 	BOOLEAN (includeBandwidths, U"Include bandwidths", true)
150 	BOOLEAN (includeOptimumCeiling, U"Include optimal ceiling", true)
151 	BOOLEAN (includeMinimumStress, U"Include minimum stress", false)
152 	OK
153 DO
154 	CONVERT_EACH_TO_ONE (FormantPath)
155 		autoTable result = FormantPath_downTo_Table_optimalInterval (me, tmin, tmax, parameters, powerf,
156 			includeFrameNumber, includeTime, numberOfTimeDecimals,
157 			includeIntensity, numberOfIntensityDecimals, includeNumberOfFormants, numberOfFrequencyDecimals,
158 			includeBandwidths, includeOptimumCeiling, includeMinimumStress
159 		);
160 	CONVERT_EACH_TO_ONE_END (my name.get())
161 }
162 
163 FORM (NEW__FormantPath_downTo_Table_stresses, U"FormantPath: Down to Table (stresses)", U"FormantPath: Down to Table (stresses)...") {
164 	REAL (tmin, U"left Time range (s)", U"0.1")
165 	REAL (tmax, U"right Time range (s)", U"0.2")
166 	NATURALVECTOR (parameters, U"Coefficients by track", WHITESPACE_SEPARATED_, U"3 3 3")
167 	POSITIVE (powerf, U"Power", U"1.25")
168 	NATURAL (numberOfStressDecimals, U"Number of stress decimals", U"2")
169 	BOOLEAN (includeIntervalTimes, U"Include interval times", true)
170 	NATURAL (numberOfTimeDecimals, U"Number of time decimals", U"6")
171 	OK
172 DO
173 	CONVERT_EACH_TO_ONE (FormantPath)
174 		autoTable result = FormantPath_downTo_Table_stresses (me, tmin, tmax, parameters,
175 			numberOfStressDecimals, powerf, includeIntervalTimes, numberOfTimeDecimals);
176 	CONVERT_EACH_TO_ONE_END (my name.get())
177 }
178 
179 DIRECT (QUERY_ONE_FOR_REAL__FormantPath_getNumberOfCandidates) {
180 	QUERY_ONE_FOR_REAL (FormantPath)
181 		const integer result = my ceilings.size;
182 	QUERY_ONE_FOR_REAL_END (U"")
183 }
184 
185 DIRECT (QUERY_ONE_FOR_REAL_VECTOR__FormantPath_listCeilingFrequencies) {
186 	QUERY_ONE_FOR_REAL_VECTOR (FormantPath)
187 		autoVEC result = copy_VEC (my ceilings.get());
188 	QUERY_ONE_FOR_REAL_VECTOR_END
189 }
190 
191 FORM (CONVERT_EACH_TO_ONE__FormantPath_to_Matrix_stress, U"FormantPath: To Matrix (stress)", nullptr) {
192 	POSITIVE (windowLength, U"Window length", U"0.025")
193 	NATURALVECTOR (parameters, U"Coefficients by track", WHITESPACE_SEPARATED_, U"3 3 3 3")
194 	POSITIVE (powerf, U"Power", U"1.25")
195 	OK
196 DO
197 	CONVERT_EACH_TO_ONE (FormantPath)
198 		autoMatrix result = FormantPath_to_Matrix_stress (me, windowLength, parameters, powerf);
199 	CONVERT_EACH_TO_ONE_END (my name.get())
200 }
201 
202 FORM (CONVERT_EACH_TO_ONE__FormantPath_to_Matrix_qsums, U"FormantPath: To Matrix (qsums)", nullptr) {
203 	INTEGER (numberOfTracks, U"Number of tracks", U"4")
204 	OK
205 DO
206 	CONVERT_EACH_TO_ONE (FormantPath)
207 		autoMatrix result = FormantPath_to_Matrix_qSums (me, numberOfTracks);
208 	CONVERT_EACH_TO_ONE_END (my name.get())
209 }
210 
211 FORM (CONVERT_EACH_TO_ONE__FormantPath_to_Matrix_transition,  U"FormantPath: To Matrix (transition)", nullptr) {
212 	INTEGER (numberOfTracks, U"Number of tracks", U"4")
213 	BOOLEAN (maximumCosts, U"Maximum costs", false)
214 	OK
215 DO
216 	CONVERT_EACH_TO_ONE (FormantPath)
217 		autoMatrix result = FormantPath_to_Matrix_transition (me, numberOfTracks, maximumCosts);
218 	CONVERT_EACH_TO_ONE_END (my name.get())
219 }
220 
221 FORM (CONVERT_EACH_TO_ONE__FormantPath_to_Matrix_deltas,  U"FormantPath: To Matrix (deltas)", nullptr) {
222 	LABEL (U"Within frame:")
223 	REAL (qWeight, U"F/B weight (0-1)", U"1.0")
224 	LABEL (U"Between frames:")
225 	REAL (frequencyChangeWeight, U"Frequency change weight (0-1)", U"1.0")
226 	REAL (stressWeight, U"Stress weight (0-1)", U"1.0")
227 	REAL (ceilingChangeWeight, U"Ceiling change weight (0-1)", U"1.0")
228 	POSITIVE (intensityModulationStepSize, U"Intensity modulation step size (dB)", U"5.0")
229 	LABEL (U"Global stress parameters:")
230 	POSITIVE (windowLength, U"Window length", U"0.035")
231 	NATURALVECTOR (parameters, U"Coefficients by track", WHITESPACE_SEPARATED_, U"3 3 3 3")
232 	POSITIVE (powerf, U"Power", U"1.25")
233 	OK
234 DO
235 	CONVERT_EACH_TO_ONE (FormantPath)
236 		autoMatrix result;
237 		Melder_require (qWeight >= 0 && qWeight <= 1.0 &&
238 			frequencyChangeWeight >= 0 && frequencyChangeWeight <= 1.0 &&
239 			stressWeight >= 0 && stressWeight <= 1.0 &&
240 			ceilingChangeWeight >= 0 && ceilingChangeWeight <= 1.0,
241 			U"A weight should be greater or equal 0.0 and smaller or equal 1.0.");
242 		autoINTVEC path = FormantPath_getOptimumPath (me, qWeight, frequencyChangeWeight, stressWeight, ceilingChangeWeight,
243 				windowLength, intensityModulationStepSize, parameters, powerf, & result);
244 	CONVERT_EACH_TO_ONE_END (my name.get())
245 }
246 
247 FORM (MODIFY_EACH__FormantPath_pathFinder,  U"FormantPath: Path finder", nullptr) {
248 	LABEL (U"Within frame:")
249 	REAL (qWeight, U"F/B weight (0-1)", U"1.0")
250 	LABEL (U"Between frames:")
251 	REAL (frequencyChangeWeight, U"Frequency change weight (0-1)", U"1.0")
252 	REAL (stressWeight, U"Stress weight (0-1)", U"1.0")
253 	REAL (ceilingChangeWeight, U"Ceiling change weight (0-1)", U"1.0")
254 	POSITIVE (intensityModulationStepSize, U"Intensity modulation step size (dB)", U"5.0")
255 	LABEL (U"Global stress parameters:")
256 	POSITIVE (windowLength, U"Window length", U"0.035")
257 	NATURALVECTOR (parameters, U"Coefficients by track", WHITESPACE_SEPARATED_, U"3 3 3 3")
258 	POSITIVE (powerf, U"Power", U"1.25")
259 	OK
260 DO
261 	MODIFY_EACH (FormantPath)
262 		Melder_require (qWeight >= 0 && qWeight <= 1.0 &&
263 			frequencyChangeWeight >= 0 && frequencyChangeWeight <= 1.0 &&
264 			stressWeight >= 0 && stressWeight <= 1.0 &&
265 			ceilingChangeWeight >= 0 && ceilingChangeWeight <= 1.0,
266 			U"A weight should be greater than or equal to 0.0 and smaller than or equal to 1.0.");
267 		FormantPath_pathFinder (me, qWeight, frequencyChangeWeight, stressWeight, ceilingChangeWeight, intensityModulationStepSize, windowLength, parameters, powerf);
268 	MODIFY_EACH_END
269 }
270 
271 DIRECT (CONVERT_EACH_TO_ONE__FormantPath_extractFormant) {
272 	CONVERT_EACH_TO_ONE (FormantPath)
273 		autoFormant result = FormantPath_extractFormant (me);
274 	CONVERT_EACH_TO_ONE_END (my name.get())
275 }
276 
277 DIRECT (EDITOR_ONE_WITH_ONE_AND_ONE__Sound_TextGrid_FormantPath_createFormantPathEditor) {
278 	EDITOR_ONE_WITH_ONE_AND_ONE (a,FormantPath, Sound, TextGrid)
279 		autoFormantPathEditor editor = FormantPathEditor_create (ID_AND_FULL_NAME, me, you, him);
280 		Editor_setPublicationCallback (editor.get(), cb_FormantPathEditor_publication);
281 	EDITOR_ONE_WITH_ONE_AND_ONE_END
282 }
283 
284 DIRECT (EDITOR_ONE_WITH_ONE_Sound_FormantPath_createFormantPathEditor) {
285 	EDITOR_ONE_WITH_ONE (a,FormantPath, Sound)
286 		autoFormantPathEditor editor = FormantPathEditor_create (ID_AND_FULL_NAME, me, you, nullptr);
287 		Editor_setPublicationCallback (editor.get(), cb_FormantPathEditor_publication);
288 	EDITOR_ONE_WITH_ONE_END
289 }
290 
291 /********************** Cepstrum  ****************************************/
292 
293 DIRECT (CONVERT_EACH_TO_ONE__Cepstrum_downto_PowerCepstrum) {
294 	CONVERT_EACH_TO_ONE (Cepstrum)
295 		autoPowerCepstrum result = Cepstrum_downto_PowerCepstrum (me);
296 	CONVERT_EACH_TO_ONE_END (my name.get())
297 }
298 
299 DIRECT (HELP__PowerCepstrum_help) {
300 	HELP (U"PowerCepstrum")
301 }
302 
303 FORM (GRAPHICS_EACH__Cepstrum_drawLinear, U"Cepstrum: Draw linear", U"Cepstrum: Draw (linear)...") {
304 	praat_Quefrency_RANGE (fromQuefrency, toQuefrency)
305 	REAL (ymin, U"Minimum", U"0.0")
306 	REAL (ymax, U"Maximum", U"0.0")
307 	BOOLEAN (garnish, U"Garnish", true)
308 	OK
309 DO
310 	GRAPHICS_EACH (Cepstrum)
311 		Cepstrum_drawLinear (me, GRAPHICS, fromQuefrency, toQuefrency, ymin, ymax, garnish);
312 	GRAPHICS_EACH_END
313 }
314 
315 FORM (GRAPHICS_EACH__PowerCepstrum_draw, U"PowerCepstrum: Draw", U"PowerCepstrum: Draw...") {
316 	praat_Quefrency_RANGE(fromQuefrency,toQuefrency)
317 	REAL (fromAmplitude_dB, U"left Amplitude range (dB)", U"0.0")
318 	REAL (toAmplitude_dB, U"right Amplitude range (dB)", U"0.0")
319 	BOOLEAN (garnish, U"Garnish", true)
320 	OK
321 DO
322 	GRAPHICS_EACH (PowerCepstrum)
323 		PowerCepstrum_draw (me, GRAPHICS, fromQuefrency, toQuefrency, fromAmplitude_dB, toAmplitude_dB, garnish);
324 	GRAPHICS_EACH_END
325 }
326 
327 FORM (GRAPHICS_EACH__PowerCepstrum_drawTrendLine, U"PowerCepstrum: Draw trend line", U"PowerCepstrum: Draw trend line...") {
328 	praat_Quefrency_RANGE(fromQuefrency,toQuefrency)
329 	REAL (fromAmplitude_dB, U"left Amplitude range (dB)", U"0.0")
330 	REAL (toAmplitude_dB, U"right Amplitude range (dB)", U"0.0")
331 	LABEL (U"Parameters for the trend line fit")
332 	REAL (fromQuefrency_trendLine, U"left Trend line quefrency range (s)", U"0.001")
333 	REAL (toQuefrency_trendLine, U"right Trend line quefrency range (s)", U"0.05")
334 	OPTIONMENU_ENUM (kCepstrum_trendType, lineType, U"Trend type", kCepstrum_trendType::DEFAULT)
335 	OPTIONMENU_ENUM (kCepstrum_trendFit, fitMethod, U"Fit method", kCepstrum_trendFit::DEFAULT)
336 	OK
337 DO
338 	GRAPHICS_EACH (PowerCepstrum)
339 		PowerCepstrum_drawTrendLine (me, GRAPHICS, fromQuefrency, toQuefrency,fromAmplitude_dB,toAmplitude_dB, fromQuefrency_trendLine, toQuefrency_trendLine, lineType, fitMethod);
340 	GRAPHICS_EACH_END
341 }
342 
343 FORM (MODIFY_EACH__PowerCepstrum_formula, U"PowerCepstrum: Formula...", U"PowerCepstrum: Formula...") {
344 	LABEL (U"y := y1; for row := 1 to nrow do { x := x1; "
345 		"for col := 1 to ncol do { self [row, col] := `formula' ; x := x + dx } y := y + dy }")
346 	FORMULA (formula, U"Formula", U"self")
347 	OK
348 DO
349 	MODIFY_EACH_WEAK (PowerCepstrum)
350 		Matrix_formula (me, formula, interpreter, nullptr);
351 	MODIFY_EACH_WEAK_END
352 }
353 
354 FORM (QUERY_ONE_FOR_REAL__PowerCepstrum_getPeak, U"PowerCepstrum: Get peak", U"PowerCepstrum: Get peak...") {
355 	REAL (fromPitch, U"left Search peak in pitch range (Hz)", U"60.0")
356 	REAL (toPitch, U"right Search peak in pitch range (Hz)", U"333.3")
357 	RADIO_ENUM (kVector_peakInterpolation, peakInterpolationType,
358 			U"Interpolation", kVector_peakInterpolation :: PARABOLIC)
359 	OK
360 DO
361 	QUERY_ONE_FOR_REAL (PowerCepstrum)
362 		double result;
363 		PowerCepstrum_getMaximumAndQuefrency (me, fromPitch, toPitch, peakInterpolationType, & result, nullptr);
364 	QUERY_ONE_FOR_REAL_END (U" dB")
365 }
366 
367 FORM (QUERY_ONE_FOR_REAL__PowerCepstrum_getQuefrencyOfPeak, U"PowerCepstrum: Get quefrency of peak", U"PowerCepstrum: Get quefrency of peak...") {
368 	REAL (fromPitch, U"left Search peak in pitch range (Hz)", U"60.0")
369 	REAL (toPitch, U"right Search peak in pitch range (Hz)", U"333.3")
370 	RADIO_ENUM (kVector_peakInterpolation, peakInterpolationType,
371 			U"Interpolation", kVector_peakInterpolation :: PARABOLIC)
372 	OK
373 DO
374 	QUERY_ONE_FOR_REAL (PowerCepstrum)
375 		double result;
376 		PowerCepstrum_getMaximumAndQuefrency (me, fromPitch, toPitch, peakInterpolationType, nullptr, & result);
377 		double f = 1.0 / result;
378 	QUERY_ONE_FOR_REAL_END (U" seconds (f = ", f, U" Hz)")
379 }
380 
381 FORM (QUERY_ONE_FOR_REAL__PowerCepstrum_getRNR, U"PowerCepstrum: Get rhamonics to noise ration", nullptr) {
382 	REAL (fromPitch, U"left Pitch range (Hz)", U"60.0")
383 	REAL (toPitch, U"right Pitch range (Hz)", U"333.3")
384 	POSITIVE (fractionalWidth, U"Fractional width (0-1)", U"0.025")
385 	OK
386 DO
387 	QUERY_ONE_FOR_REAL (PowerCepstrum)
388 		const double result = PowerCepstrum_getRNR (me, fromPitch, toPitch, fractionalWidth);
389 	QUERY_ONE_FOR_REAL_END (U" (rnr)")
390 }
391 
392 DIRECT (QUERY_ONE_FOR_REAL__PowerCepstrum_getStartQuefrency) {
393 	QUERY_ONE_FOR_REAL (PowerCepstrum)
394 		const double result = my xmin;
395 	QUERY_ONE_FOR_REAL_END (U" seconds")
396 }
397 
398 DIRECT (QUERY_ONE_FOR_REAL__PowerCepstrum_getEndQuefrency) {
399 	QUERY_ONE_FOR_REAL (PowerCepstrum)
400 		const double result = my xmax;
401 	QUERY_ONE_FOR_REAL_END (U" seconds")
402 }
403 
404 DIRECT (QUERY_ONE_FOR_INTEGER__PowerCepstrum_getNumberOfQuefrencyBins) {
405 	QUERY_ONE_FOR_INTEGER (PowerCepstrum)
406 		const integer result = my nx;
407 	QUERY_ONE_FOR_INTEGER_END (U" samples")
408 }
409 
410 DIRECT (QUERY_ONE_FOR_REAL__PowerCepstrum_getQuefrencyStep) {
411 	QUERY_ONE_FOR_REAL (PowerCepstrum)
412 		const double result = my dx;
413 	QUERY_ONE_FOR_REAL_END (U" seconds")
414 }
415 
416 FORM (QUERY_ONE_FOR_REAL__PowerCepstrum_getQuefrencyFromIndex, U"PowerCepstrum: Get quefrency from index", nullptr) {
417 	NATURAL (index, U"Quefrency index", U"1")
418 	OK
419 DO
420 	QUERY_ONE_FOR_REAL (PowerCepstrum)
421 		const double result = Sampled_indexToX (me, index);
422 	QUERY_ONE_FOR_REAL_END (U" seconds")
423 }
424 
425 FORM (QUERY_ONE_FOR_REAL__PowerCepstrum_getIndexFromQuefrency, U"PowerCepstrum: Get index from quefrency", nullptr) {
426 	REAL (quefrency, U"Quefrency (s)", U"0.01")
427 	OK
428 DO
429 	QUERY_ONE_FOR_REAL (PowerCepstrum)
430 		const double result = Sampled_xToIndex (me, quefrency);
431 	QUERY_ONE_FOR_REAL_END (U" (index at quefrency ", quefrency, U" seconds)")
432 }
433 
434 FORM (QUERY_ONE_FOR_REAL__PowerCepstrum_getPeakProminence_hillenbrand, U"PowerCepstrum: Get peak prominence (hillenbrand)", U"PowerCepstrum: Get peak prominence (hillenbrand)...") {
435 	REAL (fromPitch, U"left Search peak in pitch range (Hz)", U"60.0")
436 	REAL (toPitch, U"right Search peak in pitch range (Hz)", U"333.3")
437 	OK
438 DO
439 	QUERY_ONE_FOR_REAL (PowerCepstrum)
440 		double qpeak;
441 		const double result = PowerCepstrum_getPeakProminence_hillenbrand (me, fromPitch, toPitch, & qpeak);
442 	QUERY_ONE_FOR_REAL_END (U" dB; quefrency=", qpeak, U" s (f=", 1.0 / qpeak, U" Hz).")
443 }
444 
445 FORM (QUERY_ONE_FOR_REAL__PowerCepstrum_getTrendLineSlope, U"PowerCepstrum: Get trend line slope", U"PowerCepstrum: Get trend line slope...") {
446 	REAL (fromQuefrency_trendLine, U"left Trend line quefrency range (s)", U"0.001")
447 	REAL (toQuefrency_trendLine, U"right Trend line quefrency range (s)", U"0.05")
448 	OPTIONMENU_ENUM (kCepstrum_trendType, lineType, U"Trend type", kCepstrum_trendType::DEFAULT)
449 	OPTIONMENU_ENUM (kCepstrum_trendFit, fitMethod, U"Fit method", kCepstrum_trendFit::DEFAULT)
450 	OK
451 DO
452 	QUERY_ONE_FOR_REAL (PowerCepstrum)
453 		double result;
454 		PowerCepstrum_fitTrendLine (me, fromQuefrency_trendLine, toQuefrency_trendLine, & result, nullptr, lineType, fitMethod);
455 	QUERY_ONE_FOR_REAL_END (U" dB / ", lineType == kCepstrum_trendType::LINEAR ? U"s" : U"ln (s)");
456 }
457 
458 FORM (QUERY_ONE_FOR_REAL__PowerCepstrum_getTrendLineIntercept, U"PowerCepstrum: Get trend line intercept", U"PowerCepstrum: Get trend line intercept...") {
459 	REAL (fromQuefrency_trendLine, U"left Trend line quefrency range (s)", U"0.001")
460 	REAL (toQuefrency_trendLine, U"right Trend line quefrency range (s)", U"0.05")
461 	OPTIONMENU_ENUM (kCepstrum_trendType, lineType, U"Trend type", kCepstrum_trendType::DEFAULT)
462 	OPTIONMENU_ENUM (kCepstrum_trendFit, fitMethod, U"Fit method", kCepstrum_trendFit::DEFAULT)
463 	OK
464 DO
465 	QUERY_ONE_FOR_REAL (PowerCepstrum)
466 		double result;
467 		PowerCepstrum_fitTrendLine (me, fromQuefrency_trendLine, toQuefrency_trendLine, nullptr, & result, lineType, fitMethod);
468 	QUERY_ONE_FOR_REAL_END (U" dB")
469 }
470 
471 FORM (QUERY_ONE_FOR_REAL__PowerCepstrum_getValueInBin, U"PowerCepstrum: Get value in bin", nullptr) {
472 	NATURAL (binNumber, U"Bin number", U"100")
473 	OK
474 DO
475 	QUERY_ONE_FOR_REAL (PowerCepstrum)
476 		Melder_require (binNumber <= my nx,
477 			U"Bin number should not exceed the number of bins.");
478 		double result = my v_getValueAtSample (binNumber, 1, 1);
479 	QUERY_ONE_FOR_REAL_END (U" (value in bin ", binNumber, U")")
480 }
481 
482 FORM (QUERY_ONE_FOR_REAL__PowerCepstrum_getPeakProminence, U"PowerCepstrum: Get peak prominence", U"PowerCepstrum: Get peak prominence...") {
483 	REAL (fromPitch, U"left Search peak in pitch range (Hz)", U"60.0")
484 	REAL (toPitch, U"right Search peak in pitch range (Hz)", U"333.3")
485 	RADIO_ENUM (kVector_peakInterpolation, peakInterpolationType,
486 			U"Interpolation", kVector_peakInterpolation :: PARABOLIC)
487 	REAL (fromQuefrency_trendLine, U"left Trend line quefrency range (s)", U"0.001")
488 	REAL (toQuefrency_trendLine, U"right Trend line quefrency range (s)", U"0.05")
489 	OPTIONMENU_ENUM (kCepstrum_trendType, lineType, U"Trend type", kCepstrum_trendType::DEFAULT)
490 	OPTIONMENU_ENUM (kCepstrum_trendFit, fitMethod, U"Fit method", kCepstrum_trendFit::DEFAULT)
491 	OK
492 DO
493 	QUERY_ONE_FOR_REAL (PowerCepstrum)
494 		double qpeak;
495 		const double result = PowerCepstrum_getPeakProminence (me, fromPitch, toPitch, peakInterpolationType, fromQuefrency_trendLine, toQuefrency_trendLine, lineType, fitMethod, & qpeak);
496 	QUERY_ONE_FOR_REAL_END (U" dB; quefrency=", qpeak, U" s (f=", 1.0 / qpeak, U" Hz).");
497 }
498 
499 FORM (MODIFY_EACH__PowerCepstrum_subtractTrend_inplace, U"PowerCepstrum: Subtract trend (in-place)", U"PowerCepstrum: Subtract trend...") {
500 	REAL (fromQuefrency_trendLine, U"left Trend line quefrency range (s)", U"0.001")
501 	REAL (toQuefrency_trendLine, U"right Trend line quefrency range (s)", U"0.05")
502 
503 	OPTIONMENU_ENUM (kCepstrum_trendType, lineType, U"Trend type", kCepstrum_trendType::DEFAULT)
504 	OPTIONMENU_ENUM (kCepstrum_trendFit, fitMethod, U"Fit method", kCepstrum_trendFit::DEFAULT)
505 	OK
506 DO
507 	MODIFY_EACH (PowerCepstrum)
508 		PowerCepstrum_subtractTrend_inplace (me, fromQuefrency_trendLine, toQuefrency_trendLine, lineType, fitMethod);
509 	MODIFY_EACH_END
510 }
511 
512 FORM (MODIFY_EACH__PowerCepstrum_smooth_inplace, U"PowerCepstrum: Smooth (in-place)", U"PowerCepstrum: Smooth...") {
513 	REAL (quefrencySmoothingWindowDuration, U"Quefrency averaging window (s)", U"0.0005")
514 	NATURAL (numberOfIterations, U"Number of iterations", U"1");
515 	OK
516 DO
517 	MODIFY_EACH (PowerCepstrum)
518 		PowerCepstrum_smooth_inplace (me, quefrencySmoothingWindowDuration, numberOfIterations);
519 	MODIFY_EACH_END
520 }
521 
522 FORM (CONVERT_EACH_TO_ONE__PowerCepstrum_smooth, U"PowerCepstrum: Smooth", U"PowerCepstrum: Smooth...") {
523 	REAL (quefrencySmoothingWindowDuration, U"Quefrency averaging window (s)", U"0.0005")
524 	NATURAL (numberOfIterations, U"Number of iterations", U"1");
525 	OK
526 DO
527 	CONVERT_EACH_TO_ONE (PowerCepstrum)
528 		autoPowerCepstrum result = PowerCepstrum_smooth (me, quefrencySmoothingWindowDuration, numberOfIterations);
529 	CONVERT_EACH_TO_ONE_END (my name.get(), U"_smooth")
530 }
531 
532 FORM (CONVERT_EACH_TO_ONE__PowerCepstrum_subtractTrend, U"PowerCepstrum: Subtract trend", U"PowerCepstrum: Subtract trend...") {
533 	REAL (fromQuefrency_trendLine, U"left Trend line quefrency range (s)", U"0.001")
534 	REAL (toQuefrency_trendLine, U"right Trend line quefrency range (s)", U"0.05")
535 	OPTIONMENU_ENUM (kCepstrum_trendType, lineType, U"Trend type", kCepstrum_trendType::DEFAULT)
536 	OPTIONMENU_ENUM (kCepstrum_trendFit, fitMethod, U"Fit method", kCepstrum_trendFit::DEFAULT)
537 	OK
538 DO
539 	CONVERT_EACH_TO_ONE (PowerCepstrum)
540 		autoPowerCepstrum result = PowerCepstrum_subtractTrend (me, fromQuefrency_trendLine, toQuefrency_trendLine, lineType, fitMethod);
541 	CONVERT_EACH_TO_ONE_END (my name.get(), U"_minusTrend")
542 }
543 
544 DIRECT (CONVERT_EACH_TO_ONE__Cepstrum_to_Spectrum) {
545 	CONVERT_EACH_TO_ONE (Cepstrum)
546 		autoSpectrum result = Cepstrum_to_Spectrum (me);
547 	CONVERT_EACH_TO_ONE_END (my name.get())
548 }
549 
550 DIRECT (CONVERT_EACH_TO_ONE__PowerCepstrum_to_Matrix) {
551 	CONVERT_EACH_TO_ONE (PowerCepstrum)
552 		autoMatrix result = PowerCepstrum_to_Matrix (me);
553 	CONVERT_EACH_TO_ONE_END (my name.get())
554 }
555 
556 /********************** Cepstrogram  ****************************************/
557 
558 DIRECT (HELP__PowerCepstrogram_help) {
559 	HELP (U"PowerCepstrogram")
560 }
561 
562 FORM (GRAPHICS_EACH__old_PowerCepstrogram_paint, U"PowerCepstrogram: Paint", nullptr) {
563 	praat_TimeFunction_RANGE (fromTime, toTime)
564 	praat_Quefrency_RANGE (fromQuefrency, toQuefrency)
565 	REAL (minimum_dB, U"Minimum (dB)", U"0.0")
566 	REAL (maximum_dB, U"Maximum (dB)", U"0.0")
567 	BOOLEAN (garnish, U"Garnish", true);
568 	OK
569 DO
570 	GRAPHICS_EACH (PowerCepstrogram)
571 		PowerCepstrogram_paint (me, GRAPHICS, fromTime, toTime, fromQuefrency, toQuefrency, maximum_dB, false, maximum_dB - minimum_dB, 0.0, garnish);
572     GRAPHICS_EACH_END
573 }
574 
575 FORM (GRAPHICS_EACH__PowerCepstrogram_paint, U"PowerCepstrogram: Paint", U"PowerCepstrogram: Paint...") {
576 	praat_TimeFunction_RANGE (fromTime, toTime)
577 	praat_Quefrency_RANGE (fromQuefrency, toQuefrency)
578 	REAL (maximum_dB, U"Maximum (dB)", U"80.0")
579 	BOOLEAN (autoscaling, U"Autoscaling", false);
580 	REAL (dynamicRange_dB, U"Dynamic range (dB)", U"30.0");
581 	REAL (compression, U"Dynamic compression (0-1)", U"0.0");
582 	BOOLEAN (garnish, U"Garnish", true);
583 	OK
584 DO_ALTERNATIVE (GRAPHICS_EACH__old_PowerCepstrogram_paint)
585 	GRAPHICS_EACH (PowerCepstrogram)
586 		PowerCepstrogram_paint (me, GRAPHICS, fromTime, toTime, fromQuefrency, toQuefrency, maximum_dB, autoscaling, dynamicRange_dB, compression, garnish);
587 	GRAPHICS_EACH_END
588 }
589 
590 FORM (CONVERT_EACH_TO_ONE__PowerCepstrogram_smooth, U"PowerCepstrogram: Smooth", U"PowerCepstrogram: Smooth...") {
591 	REAL (smoothingWindowDuration, U"Time averaging window (s)", U"0.02")
592 	REAL (quefrencySmoothingWindowDuration, U"Quefrency averaging window (s)", U"0.0005")
593 	OK
594 DO
595 	CONVERT_EACH_TO_ONE (PowerCepstrogram)
596 		autoPowerCepstrogram result = PowerCepstrogram_smooth (me, smoothingWindowDuration, quefrencySmoothingWindowDuration);
597 	CONVERT_EACH_TO_ONE_END (my name.get(), U"_smoothed")
598 }
599 
600 DIRECT (QUERY_ONE_FOR_REAL__PowerCepstrogram_getStartQuefrency) {
601 	QUERY_ONE_FOR_REAL (PowerCepstrogram)
602 		const double result = my ymin;
603 	QUERY_ONE_FOR_REAL_END (U" seconds")
604 }
605 
606 DIRECT (QUERY_ONE_FOR_REAL__PowerCepstrogram_getEndQuefrency) {
607 	QUERY_ONE_FOR_REAL (PowerCepstrogram)
608 		const double result = my ymax;
609 	QUERY_ONE_FOR_REAL_END (U" seconds")
610 }
611 
612 DIRECT (QUERY_ONE_FOR_INTEGER__PowerCepstrogram_getNumberOfQuefrencyBins) {
613 	QUERY_ONE_FOR_INTEGER (PowerCepstrogram)
614 		const integer result = my ny;
615 	QUERY_ONE_FOR_INTEGER_END (U" quefrency bins")
616 }
617 
618 DIRECT (QUERY_ONE_FOR_REAL__PowerCepstrogram_getQuefrencyStep) {
619 	QUERY_ONE_FOR_REAL (PowerCepstrogram)
620 		const double result = my dy;
621 	QUERY_ONE_FOR_REAL_END (U" seconds (quefrency step)")
622 }
623 
624 FORM (CONVERT_EACH_TO_ONE__PowerCepstrogram_subtractTrend, U"PowerCepstrogram: Subtract trend", nullptr) {
625 	REAL (fromQuefrency_trendLine, U"left Trend line quefrency range (s)", U"0.001")
626 	REAL (toQuefrency_trendLine, U"right Trend line quefrency range (s)", U"0.05)")
627 	OPTIONMENU_ENUM (kCepstrum_trendType, lineType, U"Trend type", kCepstrum_trendType::DEFAULT)
628 	OPTIONMENU_ENUM (kCepstrum_trendFit, fitMethod, U"Fit method", kCepstrum_trendFit::DEFAULT)
629 	OK
630 DO
631 	CONVERT_EACH_TO_ONE (PowerCepstrogram)
632 		autoPowerCepstrogram result = PowerCepstrogram_subtractTrend (me, fromQuefrency_trendLine, toQuefrency_trendLine, lineType, fitMethod);
633 	CONVERT_EACH_TO_ONE_END (my name.get(), U"_minusTrend")
634 }
635 
636 FORM (MODIFY_EACH__PowerCepstrogram_subtractTrend_inplace, U"PowerCepstrogram: Subtract trend (in-place)", nullptr) {
637 	REAL (fromQuefrency_trendLine, U"left Trend line quefrency range (s)", U"0.001")
638 	REAL (toQuefrency_trendLine, U"right Trend line quefrency range (s)", U"0.05)")
639 	OPTIONMENU_ENUM (kCepstrum_trendType, lineType, U"Trend type", kCepstrum_trendType::DEFAULT)
640 	OPTIONMENU_ENUM (kCepstrum_trendFit, fitMethod, U"Fit method", kCepstrum_trendFit::DEFAULT)
641 	OK
642 DO
643 	MODIFY_EACH (PowerCepstrogram)
644 		PowerCepstrogram_subtractTrend_inplace (me, fromQuefrency_trendLine, toQuefrency_trendLine, lineType, fitMethod);
645 	MODIFY_EACH_END
646 }
647 
648 FORM (QUERY_ONE_FOR_REAL__PowerCepstrogram_getCPPS_hillenbrand, U"PowerCepstrogram: Get CPPS", nullptr) {
649 	LABEL (U"Smoothing:")
650 	BOOLEAN (subtractTrendBeforeSmoothing, U"Subtract trend before smoothing", true)
651 	REAL (smoothinWindowDuration, U"Time averaging window (s)", U"0.001")
652 	REAL (quefrencySmoothinWindowDuration, U"Quefrency averaging window (s)", U"0.00005")
653 	LABEL (U"Peak search:")
654 	REAL (fromPitch, U"left Peak search pitch range (Hz)", U"60.0")
655 	REAL (toPitch, U"right Peak search pitch range (Hz)", U"330.0")
656 	OK
657 DO
658 	QUERY_ONE_FOR_REAL (PowerCepstrogram)
659 		const double result = PowerCepstrogram_getCPPS_hillenbrand (me, subtractTrendBeforeSmoothing, smoothinWindowDuration, quefrencySmoothinWindowDuration, fromPitch, toPitch);
660 	QUERY_ONE_FOR_REAL_END (U" dB")
661 }
662 
663 FORM (QUERY_ONE_FOR_REAL__PowerCepstrogram_getCPPS, U"PowerCepstrogram: Get CPPS", U"PowerCepstrogram: Get CPPS...") {
664 	LABEL (U"Smoothing of the Cepstrogram")
665 	BOOLEAN (subtractTrendBeforeSmoothing, U"Subtract trend before smoothing", true)
666 	REAL (smoothingWindowDuration, U"Time averaging window (s)", U"0.02")
667 	REAL (quefrencySmoothingWindowDuration, U"Quefrency averaging window (s)", U"0.0005")
668 	LABEL (U"Peak search:")
669 	REAL (fromPitch, U"left Peak search pitch range (Hz)", U"60.0")
670 	REAL (toPitch, U"right Peak search pitch range (Hz)", U"330.0")
671 	POSITIVE (tolerance, U"Tolerance (0-1)", U"0.05")
672 	RADIO_ENUM (kVector_peakInterpolation, peakInterpolationType,
673 			U"Interpolation", kVector_peakInterpolation :: PARABOLIC)
674 	LABEL (U"Trend line:")
675 	REAL (fromQuefrency_trendLine, U"left Trend line quefrency range (s)", U"0.001")
676 	REAL (toQuefrency_trendLine, U"right Trend line quefrency range (s)", U"0.05")
677 	OPTIONMENU_ENUM (kCepstrum_trendType, lineType, U"Trend type", kCepstrum_trendType::DEFAULT)
678 	OPTIONMENU_ENUM (kCepstrum_trendFit, fitMethod, U"Fit method", kCepstrum_trendFit::DEFAULT)
679 	OK
680 DO
681 	QUERY_ONE_FOR_REAL (PowerCepstrogram)
682 		const double result = PowerCepstrogram_getCPPS (me, subtractTrendBeforeSmoothing, smoothingWindowDuration, quefrencySmoothingWindowDuration, fromPitch, toPitch, tolerance, peakInterpolationType, fromQuefrency_trendLine, toQuefrency_trendLine, lineType, fitMethod);
683 	QUERY_ONE_FOR_REAL_END (U" dB");
684 }
685 
686 FORM (MODIFY__EACH_WEAK__PowerCepstrogram_formula, U"PowerCepstrogram: Formula", nullptr) {
687 	LABEL (U"Do for all times and quefrencies:")
688 	LABEL (U"   `x` is the time in seconds")
689 	LABEL (U"   `y` is the quefrency in seconds")
690 	LABEL (U"   `self` is the current value")
691 	FORMULA (formula, U"   Replace all values with", U"sqrt(self)")
692 	OK
693 DO
694 	MODIFY_EACH_WEAK (PowerCepstrogram)
695 		Matrix_formula (me, formula, interpreter, nullptr);
696 	MODIFY_EACH_WEAK_END
697 }
698 
699 FORM (CONVERT_EACH_TO_ONE__PowerCepstrogram_to_PowerCepstrum_slice, U"PowerCepstrogram: To PowerCepstrum (slice)", nullptr) {
700 	REAL (time, U"Time (s)", U"0.1")
701 	OK
702 DO
703 	CONVERT_EACH_TO_ONE (PowerCepstrogram)
704 		autoPowerCepstrum result = PowerCepstrogram_to_PowerCepstrum_slice (me, time);
705 	CONVERT_EACH_TO_ONE_END (my name.get(), NUMnumber_as_stringWithDotReplacedByUnderscore (time));
706 }
707 
708 FORM (LIST__PowerCepstrogram_listCPP, U"PowerCepstrogram: List cepstral peak prominences", U"PowerCepstrogram: To Table (cepstral peak prominences)...") {
709 	BOOLEAN (includeFrameNumbers, U"Include frame numbers", false)
710 	BOOLEAN (includeTimes, U"Include times", true)
711 	NATURAL (numberOfTimeDecimals, U"Number of time decimals", U"6")
712 	NATURAL (numberOfCPPdecimals, U"Number of CPP decimals", U"3")
713 	BOOLEAN (includePeakQuefrency, U"Include peak quefrency", false)
714 	NATURAL (numberOfQuefrencyDecimals, U"Number of quefrency decimals", U"3")
715 	REAL (fromPitch, U"left Peak search pitch range (Hz)", U"60.0")
716 	REAL (toPitch, U"right Peak search pitch range (Hz)", U"330.0")
717 	POSITIVE (tolerance, U"Tolerance (0-1)", U"0.05")
718 	RADIO_ENUM (kVector_peakInterpolation, peakInterpolationType,
719 			U"Interpolation", kVector_peakInterpolation :: PARABOLIC)
720 	REAL (fromQuefrency_trendLine, U"left Trend line quefrency range (s)", U"0.001")
721 	REAL (toQuefrency_trendLine, U"right Trend line quefrency range (s)", U"0.05")
722 	OPTIONMENU_ENUM (kCepstrum_trendType, lineType, U"Trend type", kCepstrum_trendType::DEFAULT)
723 	OPTIONMENU_ENUM (kCepstrum_trendFit, fitMethod, U"Fit method", kCepstrum_trendFit::DEFAULT)
724 	OK
725 DO
726 	INFO_ONE (PowerCepstrogram)
727 		PowerCepstrogram_listCPP (me, includeFrameNumbers,includeTimes, numberOfTimeDecimals,
728 			numberOfCPPdecimals, includePeakQuefrency, numberOfQuefrencyDecimals, fromPitch, toPitch, tolerance,
729 			peakInterpolationType, fromQuefrency_trendLine, toQuefrency_trendLine, lineType, fitMethod);
730 	INFO_ONE_END
731 }
732 
733 FORM (NEW__PowerCepstrogram_to_Table_CPP, U"PowerCepstrogram: To Table (cepstral peak prominences)", U"PowerCepstrogram: To Table (cepstral peak prominences)...") {
734 	BOOLEAN (includeFrameNumbers, U"Include frame numbers", false)
735 	BOOLEAN (includeTimes, U"Include times", true)
736 	NATURAL (numberOfTimeDecimals, U"Number of time decimals", U"6")
737 	NATURAL (numberOfCPPdecimals, U"Number of CPP decimals", U"3")
738 	BOOLEAN (includePeakQuefrency, U"Include peak quefrency", false)
739 	NATURAL (numberOfQuefrencyDecimals, U"Number of quefrency decimals", U"3")
740 	REAL (fromPitch, U"left Peak search pitch range (Hz)", U"60.0")
741 	REAL (toPitch, U"right Peak search pitch range (Hz)", U"330.0")
742 	POSITIVE (tolerance, U"Tolerance (0-1)", U"0.05")
743 	RADIO_ENUM (kVector_peakInterpolation, peakInterpolationType,
744 			U"Interpolation", kVector_peakInterpolation :: PARABOLIC)
745 	REAL (fromQuefrency_trendLine, U"left Trend line quefrency range (s)", U"0.001")
746 	REAL (toQuefrency_trendLine, U"right Trend line quefrency range (s)", U"0.05")
747 	OPTIONMENU_ENUM (kCepstrum_trendType, lineType, U"Trend type", kCepstrum_trendType::DEFAULT)
748 	OPTIONMENU_ENUM (kCepstrum_trendFit, fitMethod, U"Fit method", kCepstrum_trendFit::DEFAULT)
749 	OK
750 DO
751 	CONVERT_EACH_TO_ONE (PowerCepstrogram)
752 		autoTable result = PowerCepstrogram_to_Table_CPP (me, includeFrameNumbers,includeTimes, numberOfTimeDecimals,
753 			numberOfCPPdecimals, includePeakQuefrency, numberOfQuefrencyDecimals, fromPitch, toPitch, tolerance,
754 			peakInterpolationType, fromQuefrency_trendLine, toQuefrency_trendLine, lineType, fitMethod);
755 	CONVERT_EACH_TO_ONE_END (my name.get(), U"_cpp");
756 }
757 
758 FORM (CONVERT_EACH_TO_ONE__PowerCepstrogram_to_Table_hillenbrand, U"PowerCepstrogram: To Table (hillenbrand)", U"PowerCepstrogram: To Table (peak prominences)...") {
759 	REAL (fromPitch, U"left Peak search pitch range (Hz)", U"60.0")
760 	REAL (toPitch, U"right Peak search pitch range (Hz)", U"330.0")
761 	OK
762 DO
763 	CONVERT_EACH_TO_ONE (PowerCepstrogram)
764 		autoTable result = PowerCepstrogram_to_Table_hillenbrand (me,fromPitch, toPitch);
765 	CONVERT_EACH_TO_ONE_END (my name.get(), U"_cpp")
766 }
767 
768 DIRECT (CONVERT_EACH_TO_ONE__PowerCepstrogram_to_Matrix) {
769 	CONVERT_EACH_TO_ONE (PowerCepstrogram)
770 		autoMatrix result = PowerCepstrogram_to_Matrix (me);
771 	CONVERT_EACH_TO_ONE_END (my name.get())
772 }
773 
774 /********************** Cepstrumc  ****************************************/
775 
776 DIRECT (CONVERT_EACH_TO_ONE__Cepstrumc_to_LPC) {
777 	CONVERT_EACH_TO_ONE (Cepstrumc)
778 		autoLPC result = Cepstrumc_to_LPC (me);
779 	CONVERT_EACH_TO_ONE_END (my name.get())
780 }
781 
782 FORM (CONVERT_TWO_TO_ONE__Cepstrumc_to_DTW, U"Cepstrumc: To DTW", U"Cepstrumc: To DTW...") {
783 	LABEL (U"Distance calculation between Cepstra")
784 	REAL (cepstralWeight, U"Cepstral weight", U"1.0")
785 	REAL (logEnergyWeight, U"Log energy weight", U"0.0")
786 	REAL (regressionWeight, U"Regression weight", U"0.0")
787 	REAL (regressionLogEnergyWeight, U"Regression weight log energy", U"0.0")
788 	REAL (windowDuration, U"Window for regression coefficients (seconds)", U"0.056")
789 	LABEL (U"Boundary conditions for time warp")
790 	BOOLEAN (matchBeginPositions, U"Match begin positions", false)
791 	BOOLEAN (matchEndPositions, U"Match end positions", false)
792 	RADIO (slopeConstraintType, U"Slope constraints", 1)
793 		RADIOBUTTON (U"no restriction")
794 		RADIOBUTTON (U"1/3 < slope < 3")
795 		RADIOBUTTON (U"1/2 < slope < 2")
796 		RADIOBUTTON (U"2/3 < slope < 3/2")
797 	OK
798 DO
799 	CONVERT_TWO_TO_ONE (Cepstrumc)
800 		autoDTW result = Cepstrumc_to_DTW (me, you, cepstralWeight, logEnergyWeight, regressionWeight, regressionLogEnergyWeight, windowDuration, matchBeginPositions, matchEndPositions, slopeConstraintType);
801 	CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
802 }
803 
804 DIRECT (CONVERT_EACH_TO_ONE__Cepstrumc_to_Matrix) {
805 	CONVERT_EACH_TO_ONE (Cepstrumc)
806 		autoMatrix result = Cepstrumc_to_Matrix (me);
807 	CONVERT_EACH_TO_ONE_END (my name.get())
808 }
809 
810 /******************** Formant ********************************************/
811 
812 FORM (QUERY_ONE_FOR_REAL_VECTOR__Formant_listFormantSlope, U"Formant: List formant slope", U"Formant: List formant slope...") {
813 	NATURAL (formantNumber, U"Formant number", U"1")
814 	REAL (tmin, U"left Time range (s)", U"0.0")
815 	REAL (tmax, U"right Time range (s)", U"0.0 (=all)")
816 	OPTIONMENU_ENUM (kSlopeCurve, slopeCurve, U"Slope curve", kSlopeCurve::DEFAULT)
817 	OK
818 DO
819 	QUERY_ONE_FOR_REAL_VECTOR (Formant)
820 		autoVEC result = Formant_listFormantSlope (me, formantNumber, tmin, tmax, slopeCurve);
821 	QUERY_ONE_FOR_REAL_VECTOR_END
822 }
823 
824 FORM (CONVERT_EACH_TO_ONE__Formant_to_LPC, U"Formant: To LPC", nullptr) {
825 	POSITIVE (samplingFrequency, U"Sampling frequency (Hz)", U"16000.0")
826 	OK
827 DO
828 	CONVERT_EACH_TO_ONE (Formant)
829 		autoLPC result = Formant_to_LPC (me, 1.0 / samplingFrequency);
830 	CONVERT_EACH_TO_ONE_END (my name.get())
831 }
832 
833 FORM (MODIFY_EACH_WEAK__Formant_formula, U"Formant: Formula", nullptr) {
834 	praat_TimeFunction_RANGE (fromTime, toTime)
835 	NATURAL (fromFormant, U"left Formant range", U"1")
836 	NATURAL (toFormant, U"right Formant range", U"5")
837 	LABEL (U"Formant frequencies in odd numbered rows")
838 	LABEL (U"Formant bandwidths in even numbered rows")
839 	SENTENCE (formula, U"Formula", U"if row mod 2 = 1 and self [row,col] / self [row+1,col] < 5 then 0 else self fi")
840 	OK
841 DO
842 	MODIFY_EACH_WEAK (Formant)
843 		Formant_formula (me, fromTime, toTime, fromFormant, toFormant, interpreter, formula);
844 	MODIFY_EACH_WEAK_END
845 }
846 
847 /******************** Formant & Spectrogram ************************************/
848 
849 FORM (CONVERT_ONE_AND_ONE_TO_ONE__Formant_Spectrogram_to_IntensityTier, U"Formant & Spectrogram: To IntensityTier", U"Formant & Spectrogram: To IntensityTier...") {
850 	NATURAL (formantNumber, U"Formant number", U"1")
851 	OK
852 DO
853 	CONVERT_ONE_AND_ONE_TO_ONE (Formant, Spectrogram)
854 		autoIntensityTier result = Formant_Spectrogram_to_IntensityTier (me, you, formantNumber);
855 	CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", formantNumber)
856 }
857 
858 /********************LFCC ********************************************/
859 
860 DIRECT (HELP__LFCC_help) {
861 	HELP (U"LFCC")
862 }
863 
864 FORM (CONVERT_EACH_TO_ONE__LFCC_to_LPC, U"LFCC: To LPC", U"LFCC: To LPC...") {
865 	INTEGER (numberOfCoefficients, U"Number of coefficients", U"0")
866 	OK
867 DO
868 	Melder_require (numberOfCoefficients >= 0, U"Number of coefficients should not be less than zero.");
869 	CONVERT_EACH_TO_ONE (LFCC)
870 		autoLPC result = LFCC_to_LPC (me, numberOfCoefficients);
871 	CONVERT_EACH_TO_ONE_END (my name.get());
872 }
873 
874 /********************LineSpectralFrequencies ********************************************/
875 
876 DIRECT (HELP__LineSpectralFrequencies_help) {
877 	HELP (U"LineSpectralFrequencies")
878 }
879 
880 FORM (GRAPHICS_EACH__LineSpectralFrequencies_drawFrequencies, U"LineSpectralFrequencies: Draw frequencies", nullptr) {
881 	praat_TimeFunction_RANGE (fromTime, toTime)
882 	REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
883 	REAL (toFrequency, U"right Frequency range (Hz)", U"5000.0")
884 	BOOLEAN (garnish, U"Garnish", true)
885 	OK
886 DO
887 	GRAPHICS_EACH (LineSpectralFrequencies)
888 		LineSpectralFrequencies_drawFrequencies (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish);
889 	GRAPHICS_EACH_END
890 }
891 
892 FORM (QUERY_ONE_FOR_INTEGER__LineSpectralFrequencies_getNumberOfFrequencies, U"LineSpectralFrequencies: Get number of frequencies", U"LineSpectralFrequencies: Get number of frequencies...") {
893 	NATURAL (frameNumber, U"Frame number", U"2")
894 	OK
895 DO
896 	QUERY_ONE_FOR_INTEGER (LineSpectralFrequencies)
897 		my checkIndex (frameNumber);
898 		const integer result = my d_frames [frameNumber]. numberOfFrequencies;
899 	QUERY_ONE_FOR_INTEGER_END (U" frequencies")
900 }
901 
902 FORM (QUERY_ONE_FOR_REAL_VECTOR__LineSpectralFrequencies_listFrequenciesInFrame, U"LineSpectralFrequencies: List all frequencies in frame", U"") {
903 	NATURAL (frameNumber, U"Frame number", U"10")
904 	OK
905 DO
906 	QUERY_ONE_FOR_REAL_VECTOR (LineSpectralFrequencies)
907 		autoVEC result = LineSpectralFrequencies_listFrequenciesInFrame (me, frameNumber);
908 	QUERY_ONE_FOR_REAL_VECTOR_END
909 }
910 
911 DIRECT (QUERY_ONE_FOR_MATRIX__LineSpectralFrequencies_listAllFrequencies) {
912 	QUERY_ONE_FOR_MATRIX (LineSpectralFrequencies)
913 		autoMAT result = LineSpectralFrequencies_listAllFrequencies (me);
914 	QUERY_ONE_FOR_MATRIX_END
915 }
916 
917 DIRECT (CONVERT_EACH_TO_ONE__LineSpectralFrequencies_to_LPC) {
918 	CONVERT_EACH_TO_ONE (LineSpectralFrequencies)
919 		autoLPC result = LineSpectralFrequencies_to_LPC (me);
920 	CONVERT_EACH_TO_ONE_END (my name.get());
921 }
922 
923 /********************LPC ********************************************/
924 
925 DIRECT (HELP__LPC_help) {
926 	HELP (U"LPC")
927 }
928 
929 FORM (GRAPHICS_EACH__LPC_drawGain, U"LPC: Draw gain", U"LPC: Draw gain...") {
930 	praat_TimeFunction_RANGE (fromTime, toTime)
931 	REAL (minimumGain, U"Minimum gain", U"0.0")
932 	REAL (maximumGain, U"Maximum gain", U"0.0")
933 	BOOLEAN (garnish, U"Garnish", true)
934 	OK
935 DO
936 	GRAPHICS_EACH (LPC)
937 		LPC_drawGain (me, GRAPHICS, fromTime, toTime, minimumGain, maximumGain, garnish);
938 	GRAPHICS_EACH_END
939 }
940 
941 DIRECT (QUERY_ONE_FOR_REAL__LPC_getSamplingInterval) {
942 	QUERY_ONE_FOR_REAL (LPC)
943 		const double result = my samplingPeriod;
944 	QUERY_ONE_FOR_REAL_END (U" s");
945 }
946 
947 FORM (QUERY_ONE_FOR_INTEGER__LPC_getNumberOfCoefficients, U"LPC: Get number of coefficients", U"LPC: Get number of coefficients...") {
948 	NATURAL (frameNumber, U"Frame number", U"1")
949 	OK
950 DO
951 	QUERY_ONE_FOR_INTEGER (LPC)
952 		my checkIndex (frameNumber);
953 		const integer result = my d_frames [frameNumber]. nCoefficients;
954 	QUERY_ONE_FOR_INTEGER_END (U" coefficients")
955 }
956 
957 FORM (QUERY_ONE_FOR_REAL_VECTOR_LPC_listAllCoefficientsInFrame, U"", U"") {
958 	NATURAL (frameNumber, U"Frame number", U"10")
959 	OK
960 DO
961 	QUERY_ONE_FOR_REAL_VECTOR (LPC)
962 		autoVEC result = LPC_listCoefficientsInFrame (me, frameNumber);
963 	QUERY_ONE_FOR_REAL_VECTOR_END
964 }
965 
966 DIRECT (QUERY_ONE_FOR_MATRIX__LPC_listAllCoefficients) {
967 	QUERY_ONE_FOR_MATRIX (LPC)
968 		autoMAT result = LPC_listAllCoefficients (me);
969 	QUERY_ONE_FOR_MATRIX_END
970 }
971 
972 FORM (QUERY_ONE_FOR_REAL__LPC_getGainInFrame, U"LPC: Get gain in frame", U"LPC: Get gain in frame...") {
973 	NATURAL (frameNumber, U"Frame number", U"10")
974 	OK
975 DO
976 	QUERY_ONE_FOR_REAL (LPC)
977 		double result = undefined;
978 		if (frameNumber > 0 && frameNumber <= my nx)
979 			result = my d_frames [frameNumber] .gain;
980 	QUERY_ONE_FOR_REAL_END (U" gain in frame ", frameNumber)
981 }
982 
983 DIRECT (QUERY_ONE_FOR_REAL_VECTOR_LPC_listAllGains) {
984 	QUERY_ONE_FOR_REAL_VECTOR (LPC)
985 		autoVEC result = LPC_listAllGains (me);
986 	QUERY_ONE_FOR_REAL_VECTOR_END
987 }
988 
989 FORM (GRAPHICS_EACH__LPC_drawPoles, U"LPC: Draw poles", U"LPC: Draw poles...") {
990 	REAL (time, U"Time (seconds)", U"0.0")
991 	BOOLEAN (garnish, U"Garnish", true)
992 	OK
993 DO
994 	GRAPHICS_EACH (LPC)
995 		LPC_drawPoles (me, GRAPHICS, time, garnish);
996 	GRAPHICS_EACH_END
997 }
998 
999 DIRECT (CONVERT_EACH_TO_ONE__LPC_to_Formant) {
1000 	CONVERT_EACH_TO_ONE (LPC)
1001 		autoFormant result = LPC_to_Formant (me, 50.0);
1002 	CONVERT_EACH_TO_ONE_END (my name.get())
1003 }
1004 
1005 DIRECT (CONVERT_EACH_TO_ONE__LPC_to_Formant_keep_all) {
1006 	CONVERT_EACH_TO_ONE (LPC)
1007 		autoFormant result = LPC_to_Formant (me, 0.0);
1008 	CONVERT_EACH_TO_ONE_END (my name.get())
1009 }
1010 
1011 FORM (CONVERT_EACH_TO_ONE__LPC_to_LFCC, U"LPC: To LFCC", U"LPC: To LFCC...") {
1012 	INTEGER (numberOfCoefficients, U"Number of coefficients", U"0")
1013 	OK
1014 DO
1015 	Melder_require (numberOfCoefficients >= 0, U"The number of coefficients should not be less than zero.");
1016 	CONVERT_EACH_TO_ONE (LPC)
1017 		autoLFCC result = LPC_to_LFCC (me, numberOfCoefficients);
1018 	CONVERT_EACH_TO_ONE_END (my name.get())
1019 }
1020 
1021 FORM (CONVERT_EACH_TO_ONE__LPC_to_LineSpectralFrequencies, U"LPC: To LineSpectralFrequencies", nullptr) {
1022 	REAL (gridSize, U"Grid size", U"0.0")
1023 	OK
1024 DO
1025 	CONVERT_EACH_TO_ONE (LPC)
1026 		autoLineSpectralFrequencies result = LPC_to_LineSpectralFrequencies (me, gridSize);
1027 	CONVERT_EACH_TO_ONE_END (my name.get())
1028 }
1029 
1030 FORM (CONVERT_EACH_TO_ONE__LPC_to_Polynomial_slice, U"LPC: To Polynomial", U"LPC: To Polynomial (slice)...") {
1031 	REAL (time, U"Time (s)", U"0.0")
1032 	OK
1033 DO
1034 	CONVERT_EACH_TO_ONE (LPC)
1035 		autoPolynomial result = LPC_to_Polynomial (me, time);
1036 	CONVERT_EACH_TO_ONE_END (my name.get(), NUMnumber_as_stringWithDotReplacedByUnderscore (time))
1037 }
1038 
1039 FORM (CONVERT_EACH_TO_ONE__LPC_to_Spectrum_slice, U"LPC: To Spectrum", U"LPC: To Spectrum (slice)...") {
1040 	REAL (time, U"Time (seconds)", U"0.0")
1041 	REAL (minimumFrequencyResolution, U"Minimum frequency resolution (Hz)", U"20.0")
1042 	REAL (bandwidthReduction, U"Bandwidth reduction (Hz)", U"0.0")
1043 	REAL (deemphasisFrequency, U"De-emphasis frequency (Hz)", U"50.0")
1044 	OK
1045 DO
1046 	CONVERT_EACH_TO_ONE (LPC)
1047 		autoSpectrum result = LPC_to_Spectrum (me, time, minimumFrequencyResolution, bandwidthReduction, deemphasisFrequency);
1048 	CONVERT_EACH_TO_ONE_END (my name.get(), NUMnumber_as_stringWithDotReplacedByUnderscore (time))
1049 }
1050 
1051 FORM (CONVERT_EACH_TO_ONE__LPC_to_Spectrogram, U"LPC: To Spectrogram", U"LPC: To Spectrogram...") {
1052 	REAL (minimumFrequencyResolution, U"Minimum frequency resolution (Hz)", U"20.0")
1053 	REAL (bandwidthReduction, U"Bandwidth reduction (Hz)", U"0.0")
1054 	REAL (deemphasisFrequency, U"De-emphasis frequency (Hz)", U"50.0")
1055 	OK
1056 DO
1057 	CONVERT_EACH_TO_ONE (LPC)
1058 		autoSpectrogram result = LPC_to_Spectrogram (me, minimumFrequencyResolution, bandwidthReduction, deemphasisFrequency);
1059 	CONVERT_EACH_TO_ONE_END (my name.get())
1060 }
1061 
1062 FORM (CONVERT_EACH_TO_ONE__LPC_to_VocalTract_slice_special, U"LPC: To VocalTract", U"LPC: To VocalTract (slice, special)...") {
1063 	REAL (time, U"Time (s)", U"0.0")
1064 	REAL (glottalDamping, U"Glottal damping", U"0.1")
1065 	BOOLEAN (radiationDamping, U"Radiation damping", true)
1066 	BOOLEAN (internalDamping, U"Internal damping", true)
1067 	OK
1068 DO
1069 	CONVERT_EACH_TO_ONE (LPC)
1070 		autoVocalTract result = LPC_to_VocalTract_slice_special (me, time, glottalDamping, radiationDamping, internalDamping);
1071 	CONVERT_EACH_TO_ONE_END (my name.get(), NUMnumber_as_stringWithDotReplacedByUnderscore (time))
1072 }
1073 
1074 FORM (CONVERT_EACH_TO_ONE__LPC_to_VocalTract_slice, U"LPC: To VocalTract", U"LPC: To VocalTract (slice)...") {
1075 	REAL (time, U"Time (s)", U"0.0")
1076 	POSITIVE (length, U"Length (m)", U"0.17")
1077 	OK
1078 DO
1079 	CONVERT_EACH_TO_ONE (LPC)
1080 		autoVocalTract result = LPC_to_VocalTract_slice (me, time, length);
1081 	CONVERT_EACH_TO_ONE_END (my name.get(), NUMnumber_as_stringWithDotReplacedByUnderscore (time))
1082 }
1083 
1084 DIRECT (CONVERT_EACH_TO_ONE__LPC_downto_Matrix_lpc) {
1085 	CONVERT_EACH_TO_ONE (LPC)
1086 		autoMatrix result = LPC_downto_Matrix_lpc (me);
1087 	CONVERT_EACH_TO_ONE_END (my name.get(), U"_lpc")
1088 }
1089 
1090 DIRECT (CONVERT_EACH_TO_ONE__LPC_downto_Matrix_rc) {
1091 	CONVERT_EACH_TO_ONE (LPC)
1092 		autoMatrix result = LPC_downto_Matrix_rc (me);
1093 	CONVERT_EACH_TO_ONE_END (my name.get(), U"_rc");
1094 }
1095 
1096 DIRECT (CONVERT_EACH_TO_ONE__LPC_downto_Matrix_area) {
1097 	CONVERT_EACH_TO_ONE (LPC)
1098 		autoMatrix result = LPC_downto_Matrix_area (me);
1099 	CONVERT_EACH_TO_ONE_END (my name.get(), U"_area");
1100 }
1101 
1102 /********************** Sound *******************************************/
1103 
1104 FORM (CONVERT_EACH_TO_ONE__Sound_to_PowerCepstrogram, U"Sound: To PowerCepstrogram", U"Sound: To PowerCepstrogram...") {
1105 	POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"60.0")
1106 	POSITIVE (timeStep,U"Time step (s)", U"0.002")
1107 	POSITIVE (maximumFrequency, U"Maximum frequency (Hz)", U"5000.0")
1108 	POSITIVE (preEmphasisFrequency, U"Pre-emphasis from (Hz)", U"50.0")
1109 	OK
1110 DO
1111 	CONVERT_EACH_TO_ONE (Sound)
1112 		autoPowerCepstrogram result = Sound_to_PowerCepstrogram (me, pitchFloor, timeStep, maximumFrequency, preEmphasisFrequency);
1113 	CONVERT_EACH_TO_ONE_END (my name.get())
1114 }
1115 
1116 FORM (CONVERT_EACH_TO_ONE__Sound_to_PowerCepstrogram_hillenbrand, U"Sound: To PowerCepstrogram (hillenbrand)", U"Sound: To PowerCepstrogram...") {
1117 	POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"60.0")
1118 	POSITIVE (timeStep, U"Time step (s)", U"0.002")
1119 	OK
1120 DO
1121 	CONVERT_EACH_TO_ONE (Sound)
1122 		autoPowerCepstrogram result = Sound_to_PowerCepstrogram_hillenbrand (me, pitchFloor, timeStep);
1123 	CONVERT_EACH_TO_ONE_END (my name.get())
1124 }
1125 
1126 FORM (CONVERT_EACH_TO_ONE__Sound_to_Formant_robust, U"Sound: To Formant (robust)", U"Sound: To Formant (robust)...") {
1127 	REAL (timeStep, U"Time step (s)", U"0.0 (= auto)")
1128 	POSITIVE (maximumNumberOfFormants, U"Max. number of formants", U"5.0")
1129 	REAL (middleCeiling, U"Formant ceiling (Hz)", U"5500.0 (= adult female)")
1130 	POSITIVE (windowLength, U"Window length (s)", U"0.025")
1131 	POSITIVE (preEmphasisFrequency, U"Pre-emphasis from (Hz)", U"50.0")
1132 	POSITIVE (numberOfStandardDeviations, U"Number of std. dev.", U"1.5")
1133 	NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"5")
1134 	REAL (tolerance, U"Tolerance", U"0.000001")
1135 	OK
1136 DO
1137 	CONVERT_EACH_TO_ONE (Sound)
1138 		autoFormant result = Sound_to_Formant_robust (me, timeStep, maximumNumberOfFormants, middleCeiling, windowLength, preEmphasisFrequency, 50.0, numberOfStandardDeviations, maximumNumberOfIterations, tolerance, 1);
1139 	CONVERT_EACH_TO_ONE_END (my name.get())
1140 }
1141 
1142 FORM (CONVERT_EACH_TO_ONE__Sound_to_FormantPath, U"Sound: To FormantPath", nullptr) {
1143 	REAL (timeStep, U"Time step (s)", U"0.005")
1144 	POSITIVE (maximumNumberOfFormants, U"Max. number of formants", U"5.0")
1145 	REAL (middleFormantCeiling, U"Middle formant ceiling (Hz)", U"5500.0 (= adult female)")
1146 	POSITIVE (windowLength, U"Window length (s)", U"0.025")
1147 	POSITIVE (preEmphasisFrequency, U"Pre-emphasis from (Hz)", U"50.0")
1148 	OPTIONMENU_ENUM (kLPC_Analysis, lpcModel, U"LPC model", kLPC_Analysis::DEFAULT)
1149 	LABEL (U"The maximum and minimum ceilings are determined as:")
1150 	LABEL (U" middleFormantCeiling * exp(+/- ceilingStepSize * numberOfStepsToACeiling).")
1151 	POSITIVE (ceilingStepSize, U"Ceiling step size", U"0.05")
1152 	NATURAL (numberOfStepsToACeiling, U"Number of steps up / down", U"4")
1153 	LABEL (U"For Marple analysis:")
1154 	POSITIVE (marple_tol1, U"Tolerance 1", U"1e-6")
1155 	POSITIVE (marple_tol2, U"Tolerance 2", U"1e-6")
1156 	LABEL (U"For Robust analysis:")
1157 	POSITIVE (huber_numberOfStdDev, U"Number of std. dev.", U"1.5")
1158 	NATURAL (huber_maximumNumberOfIterations, U"Maximum number of iterations", U"5")
1159 	REAL (huber_tolerance, U"Tolerance", U"0.000001")
1160 	BOOLEAN (sourcesAsMultichannel, U"Get sources as multi channel sound", false)
1161 	OK
1162 DO
1163 	CONVERT_EACH_TO_ONE (Sound)
1164 		autoSound multichannel;
1165 		autoFormantPath result = Sound_to_FormantPath_any (me, lpcModel, timeStep, maximumNumberOfFormants, middleFormantCeiling, windowLength, preEmphasisFrequency, ceilingStepSize, numberOfStepsToACeiling, marple_tol1, marple_tol2, huber_numberOfStdDev, huber_tolerance, huber_maximumNumberOfIterations,
1166 			( sourcesAsMultichannel ? & multichannel : nullptr ));
1167 		if (sourcesAsMultichannel)
1168 			praat_new (multichannel.move(), my name.get(), U"_sources");
1169 	CONVERT_EACH_TO_ONE_END (my name.get())
1170 }
1171 
1172 FORM (CONVERT_EACH_TO_ONE__Sound_to_FormantPath_burg, U"Sound: To FormantPath (Burg method)", U"Sound: To FormantPath (burg)...") {
1173 	REAL (timeStep, U"Time step (s)", U"0.005")
1174 	POSITIVE (maximumNumberOfFormants, U"Max. number of formants", U"5.0")
1175 	REAL (middleFormantCeiling, U"Middle formant ceiling (Hz)", U"5500.0 (= adult female)")
1176 	POSITIVE (windowLength, U"Window length (s)", U"0.025")
1177 	POSITIVE (preEmphasisFrequency, U"Pre-emphasis from (Hz)", U"50.0")
1178 	LABEL (U"The maximum and minimum ceilings are determined as:")
1179 	LABEL (U" middleCeiling * exp(+/- ceilingStepSize * numberOfStepsToACeiling).")
1180 	POSITIVE (ceilingStepSize, U"Ceiling step size", U"0.05")
1181 	NATURAL (numberOfStepsToACeiling, U"Number of steps up / down", U"4")
1182 	OK
1183 DO
1184 	CONVERT_EACH_TO_ONE (Sound)
1185 		autoFormantPath result = Sound_to_FormantPath_burg (me, timeStep, maximumNumberOfFormants, middleFormantCeiling, windowLength, preEmphasisFrequency, ceilingStepSize, numberOfStepsToACeiling);
1186 	CONVERT_EACH_TO_ONE_END (my name.get())
1187 }
1188 
1189 #define Sound_to_LPC_addWarning \
1190 	LABEL (U"Warning 1:  for formant analysis, use \"To Formant\" instead.") \
1191 	LABEL (U"Warning 2:  if you do use \"To LPC\", you may want to resample first.") \
1192 	LABEL (U"Click Help for more details.") \
1193 	LABEL (U"")
1194 
1195 FORM (CONVERT_EACH_TO_ONE__Sound_to_LPC_autocorrelation, U"Sound: To LPC (autocorrelation)", U"Sound: To LPC (autocorrelation)...") {
1196 	Sound_to_LPC_addWarning
1197 	NATURAL (predictionOrder, U"Prediction order", U"16")
1198 	POSITIVE (windowLength, U"Window length (s)", U"0.025")
1199 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
1200 	REAL (preEmphasisFrequency, U"Pre-emphasis frequency (Hz)", U"50.0")
1201 	OK
1202 DO
1203 	preEmphasisFrequency = preEmphasisFrequency < 0.0 ? 0.0 : preEmphasisFrequency;
1204 	CONVERT_EACH_TO_ONE (Sound)
1205 		autoLPC result = Sound_to_LPC_autocorrelation (me, predictionOrder, windowLength, timeStep, preEmphasisFrequency);
1206 	CONVERT_EACH_TO_ONE_END (my name.get())
1207 }
1208 
1209 FORM (CONVERT_EACH_TO_ONE__Sound_to_LPC_covariance, U"Sound: To LPC (covariance)", U"Sound: To LPC (covariance)...") {
1210 	Sound_to_LPC_addWarning
1211 	NATURAL (predictionOrder, U"Prediction order", U"16")
1212 	POSITIVE (windowLength, U"Window length (s)", U"0.025")
1213 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
1214 	REAL (preEmphasisFrequency, U"Pre-emphasis frequency (Hz)", U"50.0")
1215 	OK
1216 DO
1217 	preEmphasisFrequency = preEmphasisFrequency < 0.0 ? 0.0 : preEmphasisFrequency;
1218 	CONVERT_EACH_TO_ONE (Sound)
1219 		autoLPC result = Sound_to_LPC_covariance (me, predictionOrder, windowLength, timeStep, preEmphasisFrequency);
1220 	CONVERT_EACH_TO_ONE_END (my name.get())
1221 }
1222 
1223 FORM (CONVERT_EACH_TO_ONE__Sound_to_LPC_burg, U"Sound: To LPC (burg)", U"Sound: To LPC (burg)...") {
1224 	Sound_to_LPC_addWarning
1225 	NATURAL (predictionOrder, U"Prediction order", U"16")
1226 	POSITIVE (windowLength, U"Window length (s)", U"0.025")
1227 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
1228 	REAL (preEmphasisFrequency, U"Pre-emphasis frequency (Hz)", U"50.0")
1229 	OK
1230 DO
1231 	preEmphasisFrequency = preEmphasisFrequency < 0.0 ? 0.0 : preEmphasisFrequency;
1232 	CONVERT_EACH_TO_ONE (Sound)
1233 		autoLPC result = Sound_to_LPC_burg (me, predictionOrder, windowLength, timeStep, preEmphasisFrequency);
1234 	CONVERT_EACH_TO_ONE_END (my name.get())
1235 }
1236 
1237 FORM (CONVERT_EACH_TO_ONE__Sound_to_LPC_marple, U"Sound: To LPC (marple)", U"Sound: To LPC (marple)...") {
1238 	Sound_to_LPC_addWarning
1239 	NATURAL (predictionOrder, U"Prediction order", U"16")
1240 	POSITIVE (windowLength, U"Window length (s)", U"0.025")
1241 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
1242 	REAL (preEmphasisFrequency, U"Pre-emphasis frequency (Hz)", U"50.0")
1243 	POSITIVE (tolerance1, U"Tolerance 1", U"1e-6")
1244 	POSITIVE (tolerance2, U"Tolerance 2", U"1e-6")
1245 	OK
1246 DO
1247 	preEmphasisFrequency = preEmphasisFrequency < 0.0 ? 0.0 : preEmphasisFrequency;
1248 	CONVERT_EACH_TO_ONE (Sound)
1249 		autoLPC result = Sound_to_LPC_marple (me, predictionOrder, windowLength, timeStep, preEmphasisFrequency, tolerance1, tolerance2);
1250 	CONVERT_EACH_TO_ONE_END (my name.get())
1251 }
1252 
1253 FORM (CONVERT_EACH_TO_ONE__Sound_to_MFCC, U"Sound: To MFCC", U"Sound: To MFCC...") {
1254 	NATURAL (numberOfCoefficients, U"Number of coefficients", U"12")
1255 	POSITIVE (windowLength, U"Window length (s)", U"0.015")
1256 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
1257 	LABEL (U"Filter bank parameters")
1258 	POSITIVE (firstFilterFrequency, U"First filter frequency (mel)", U"100.0")
1259 	POSITIVE (distancBetweenFilters, U"Distance between filters (mel)", U"100.0")
1260 	REAL (maximumFrequency, U"Maximum frequency (mel)", U"0.0");
1261 	OK
1262 DO
1263 	Melder_require (numberOfCoefficients < 25, U"The number of coefficients should be less than 25.");
1264 	CONVERT_EACH_TO_ONE (Sound)
1265 		autoMFCC result = Sound_to_MFCC (me, numberOfCoefficients, windowLength, timeStep, firstFilterFrequency, maximumFrequency, distancBetweenFilters);
1266 	CONVERT_EACH_TO_ONE_END (my name.get())
1267 }
1268 
1269 FORM (GRAPHICS_EACH__VocalTract_drawSegments, U"VocalTract: Draw segments", nullptr) {
1270 	POSITIVE (maximumLength, U"Maximum length (cm)", U"20.0")
1271 	POSITIVE (maximumArea, U"Maximum area (cm^2)", U"90.0")
1272 	BOOLEAN (glottisClosed, U"Closed at glottis", true)
1273 	OK
1274 DO
1275 	GRAPHICS_EACH (VocalTract)
1276 		VocalTract_drawSegments (me, GRAPHICS, maximumLength, maximumArea, glottisClosed);
1277 	GRAPHICS_EACH_END
1278 }
1279 
1280 DIRECT (QUERY_ONE_FOR_REAL__VocalTract_getLength) {
1281 	QUERY_ONE_FOR_REAL (VocalTract)
1282 		double result = my xmax - my xmin;
1283 	QUERY_ONE_FOR_REAL_END (U" metres")
1284 }
1285 
1286 FORM (MODIFY_EACH__VocalTract_setLength, U"", nullptr) {
1287 	POSITIVE (length, U"New length (m)", U"0.17")
1288 	OK
1289 DO
1290 	MODIFY_EACH (VocalTract)
1291 		VocalTract_setLength (me, length);
1292 	MODIFY_EACH_END
1293 }
1294 
1295 FORM (CONVERT_EACH_TO_ONE__VocalTract_to_VocalTractTier, U"VocalTract: To VocalTractTier", nullptr) {
1296 	REAL (fromTime, U"Tier start time (s)", U"0.0")
1297 	REAL (toTime, U"Tier end time (s)", U"1.0")
1298 	REAL (time, U"Insert at time (s)", U"0.5")
1299 	OK
1300 DO
1301 	Melder_require (fromTime < toTime, U"Your start time should be before your end time.");
1302 	Melder_require (time >= fromTime && time <= toTime, U"Your insert time should be between your start and end times.");
1303 	CONVERT_EACH_TO_ONE (VocalTract)
1304 		autoVocalTractTier result = VocalTract_to_VocalTractTier (me, fromTime, toTime, time);
1305 	CONVERT_EACH_TO_ONE_END (my name.get())
1306 }
1307 
1308 DIRECT (HELP__VocalTractTier_help) {
1309 	HELP (U"VocalTractTier")
1310 }
1311 
1312 FORM (CONVERT_EACH_TO_ONE__VocalTractTier_to_LPC, U"VocalTractTier: To LPC", nullptr) {
1313 	POSITIVE (timeStep, U"Time step", U"0.005")
1314 	OK
1315 DO
1316 	CONVERT_EACH_TO_ONE (VocalTractTier)
1317 		autoLPC result = VocalTractTier_to_LPC (me, timeStep);
1318 	CONVERT_EACH_TO_ONE_END (my name.get())
1319 }
1320 
1321 FORM (CONVERT_EACH_TO_ONE__VocalTractTier_to_VocalTract, U"", nullptr) {
1322 	REAL (time, U"Time (s)", U"0.1")
1323 	OK
1324 DO
1325 	CONVERT_EACH_TO_ONE (VocalTractTier)
1326 		autoVocalTract result = VocalTractTier_to_VocalTract (me, time);
1327 	CONVERT_EACH_TO_ONE_END (my name.get())
1328 }
1329 
1330 FORM (MODIFY_FIRST_OF_ONE_AND_ONE__VocalTractTier_addVocalTract, U"VocalTractTier: Add VocalTract", nullptr) {
1331 	REAL (time, U"Time (s)", U"0.1")
1332 	OK
1333 DO
1334 	MODIFY_FIRST_OF_ONE_AND_ONE (VocalTractTier, VocalTract)
1335 		VocalTractTier_addVocalTract (me, time, you);
1336 	MODIFY_FIRST_OF_ONE_AND_ONE_END
1337 }
1338 
1339 /******************* LPC & Sound *************************************/
1340 
1341 FORM (CONVERT_ONE_AND_ONE_TO_ONE__LPC_Sound_filter, U"LPC & Sound: Filter", U"LPC & Sound: Filter...") {
1342 	BOOLEAN (useGain, U"Use LPC gain", false)
1343 	OK
1344 DO
1345 	CONVERT_ONE_AND_ONE_TO_ONE (LPC, Sound)
1346 		autoSound result = LPC_Sound_filter (me, you, useGain);
1347 	CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get())
1348 }
1349 
1350 FORM (CONVERT_ONE_AND_ONE_TO_ONE__LPC_Sound_filterWithFilterAtTime, U"LPC & Sound: Filter with one filter at time", U"LPC & Sound: Filter with filter at time...") {
1351 	OPTIONMENU (channel, U"Channel", 2)
1352 		OPTION (U"Both")
1353 		OPTION (U"Left")
1354 		OPTION (U"Right")
1355 	REAL (time, U"Use filter at time (s)", U"0.0")
1356 	OK
1357 DO
1358 	CONVERT_ONE_AND_ONE_TO_ONE (LPC, Sound)
1359 		autoSound result = LPC_Sound_filterWithFilterAtTime (me, you, channel - 1, time);
1360 	CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get())
1361 }
1362 
1363 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__LPC_Sound_filterInverse) {
1364 	CONVERT_ONE_AND_ONE_TO_ONE (LPC, Sound)
1365 		autoSound result = LPC_Sound_filterInverse (me, you);
1366 	CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get())
1367 }
1368 
1369 FORM (CONVERT_ONE_AND_ONE_TO_ONE__LPC_Sound_filterInverseWithFilterAtTime, U"LPC & Sound: Filter (inverse) with filter at time",
1370       U"LPC & Sound: Filter (inverse) with filter at time...") {
1371 	OPTIONMENU (channel, U"Channel", 2)
1372 		OPTION (U"Both")
1373 		OPTION (U"Left")
1374 		OPTION (U"Right")
1375 	REAL (time, U"Use filter at time (s)", U"0.0")
1376 	OK
1377 DO
1378 	CONVERT_ONE_AND_ONE_TO_ONE (LPC, Sound)
1379 		autoSound result = LPC_Sound_filterInverseWithFilterAtTime (me, you, channel - 1, time);
1380 	CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get())
1381 }
1382 
1383 FORM (CONVERT_ONE_AND_ONE_TO_ONE__LPC_Sound_to_LPC_robust, U"Robust LPC analysis", U"LPC & Sound: To LPC (robust)...") {
1384 	POSITIVE (windowLength, U"Window length (s)", U"0.025")
1385 	POSITIVE (preEmphasisFrequency, U"Pre-emphasis frequency (Hz)", U"50.0")
1386 	POSITIVE (numberOfStandardDeviations, U"Number of std. dev.", U"1.5")
1387 	NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"5")
1388 	REAL (tolerance, U"Tolerance", U"0.000001")
1389 	BOOLEAN (locationVariable, U"Variable location", false)
1390 	OK
1391 DO
1392 	CONVERT_ONE_AND_ONE_TO_ONE (LPC, Sound)
1393 		autoLPC result = LPC_Sound_to_LPC_robust (me, you, windowLength, preEmphasisFrequency, numberOfStandardDeviations, maximumNumberOfIterations, tolerance, locationVariable);
1394 	CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_r");
1395 }
1396 
1397 extern void praat_TimeTier_query_init (ClassInfo klas);
1398 extern void praat_TimeTier_modify_init (ClassInfo klas);
1399 
1400 static autoDaata HTKParameterFileRecognizer (integer nread, const char *header, MelderFile file) {
1401 	if (nread < 12 ) // HTK header is 12 bytes
1402 		return autoDaata ();
1403 	auto toint32 = [](const char *h0) -> int32 {
1404 		return (int32)
1405 			((uint32) ((uint32) h0 [0] << 24) | (uint32) ((uint32) h0 [1] << 16) |
1406 			 (uint32) ((uint32) h0 [2] <<  8) | (uint32) h0 [3]);
1407 	};
1408 	auto toint16 = [](const char *h0) -> int16 {
1409 		return (int16) ((uint16) ((uint16) h0 [0] << 8) | (uint16) h0 [1]);
1410 	};
1411 	const integer numberOfFrames = toint32 (& header [0]);
1412 	if (numberOfFrames <= 0)
1413 		return autoDaata ();
1414 	const integer samplePeriodTimes100ns = toint32 (& header [4]);
1415 	if (samplePeriodTimes100ns <= 0)
1416 		return autoDaata ();
1417 	const integer frameSize = toint16 (& header [8]);
1418 	if (frameSize <= 0 || frameSize % 2 != 0) // smallest sample size is 2 bytes
1419 		return autoDaata ();
1420 	const integer htkType = toint16 (& header [10]); // end of 12 header (12 bytes)
1421 	const integer fileSize = MelderFile_length (file);
1422 	if (fileSize == numberOfFrames * frameSize + 12) {
1423 		/*
1424 			This could be a HTK parameter file
1425 			Some extra checks on the htkType might be necessary but the chances that
1426 			we have come here by chance alone are very small.
1427 		*/
1428 		conststring32 fileName = MelderFile_name (file);
1429 		if (Melder_stringMatchesCriterion (fileName, kMelder_string::ENDS_WITH, U".fb", false) &&
1430 			htkType == 9 && frameSize % 8 == 0) // test user type and if it stores (F + B) as r32
1431 		{
1432 			return Formant_readFromHTKParameterFile (file);
1433 		}
1434 	}
1435 	return autoDaata ();
1436 }
1437 
1438 void praat_uvafon_LPC_init ();
1439 void praat_uvafon_LPC_init () {
1440 
1441 	Data_recognizeFileType (HTKParameterFileRecognizer);
1442 
1443 	Thing_recognizeClassesByName (classCepstrumc, classPowerCepstrum, classCepstrogram, classFormantPath, classFormantPathEditor, classPowerCepstrogram, classLPC, classLFCC, classLineSpectralFrequencies, classMFCC, classVocalTractTier, nullptr);
1444 
1445 	structFormantPathEditor  :: f_preferences ();
1446 
1447 
1448 	praat_addAction1 (classCepstrumc, 0, U"Analyse", nullptr,0, nullptr);
1449 	praat_addAction1 (classCepstrumc, 0, U"To LPC", nullptr,0,
1450 			CONVERT_EACH_TO_ONE__Cepstrumc_to_LPC);
1451 	praat_addAction1 (classCepstrumc, 2, U"To DTW...", nullptr,0,
1452 			CONVERT_TWO_TO_ONE__Cepstrumc_to_DTW);
1453 	praat_addAction1 (classCepstrumc, 0, U"Hack", nullptr,0, nullptr);
1454 	praat_addAction1 (classCepstrumc, 0, U"To Matrix", nullptr,0,
1455 			CONVERT_EACH_TO_ONE__Cepstrumc_to_Matrix);
1456 
1457 	praat_addAction1 (classFormant, 0, U"List formant slope...", U"Get standard deviation...", praat_DEPTH_1 + praat_HIDDEN,
1458 			QUERY_ONE_FOR_REAL_VECTOR__Formant_listFormantSlope);
1459 	praat_addAction1 (classFormant, 0, U"Analyse", nullptr,0, nullptr);
1460 	praat_addAction1 (classFormant, 0, U"To LPC...", nullptr,0,
1461 			CONVERT_EACH_TO_ONE__Formant_to_LPC);
1462 	praat_addAction1 (classFormant, 0, U"Formula...", U"Formula (bandwidths)...", 1,
1463 			MODIFY_EACH_WEAK__Formant_formula);
1464 	praat_addAction2 (classFormant, 1, classSpectrogram, 1, U"To IntensityTier...", nullptr,0,
1465 			CONVERT_ONE_AND_ONE_TO_ONE__Formant_Spectrogram_to_IntensityTier);
1466 
1467 	praat_addAction1 (classFormantPath, 0, U"FormantPath help", nullptr,0,
1468 			HELP__FormantPath_help);
1469 	praat_addAction1 (classFormantPath, 1, U"View & Edit alone", nullptr,0,
1470 			EDITOR_ONE_FormantPath_viewAndEditAlone);
1471 	praat_addAction1 (classFormantPath, 1, U"View & Edit with Sound?", nullptr,0,
1472 			HINT__FormantPath_Sound_viewAndEdit);
1473 	praat_addAction1 (classFormantPath, 1, U"Draw as grid...", nullptr,0,
1474 			GRAPHICS_EACH__FormantPath_drawAsGrid);
1475 	praat_addAction1 (classFormantPath, 0, U"Tabulate - " , nullptr, 0, nullptr);
1476 		praat_addAction1 (classFormantPath, 0, U"Down to Table (optimal interval)...", nullptr, 1,
1477 			NEW__FormantPath_downTo_Table_optimalInterval);
1478 		praat_addAction1 (classFormantPath, 0, U"Down to Table (stresses)...", nullptr, 1,
1479 			NEW__FormantPath_downTo_Table_stresses);
1480 	praat_addAction1 (classFormantPath, 0, U"Query -", nullptr, 0, nullptr);
1481 		praat_TimeFrameSampled_query_init (classFormantPath);
1482 		praat_addAction1 (classFormantPath, 0, U"Get number of candidates", nullptr, 1,
1483 			QUERY_ONE_FOR_REAL__FormantPath_getNumberOfCandidates);
1484 		praat_addAction1 (classFormantPath, 0, U"List ceiling frequencies", nullptr, 1,
1485 			QUERY_ONE_FOR_REAL_VECTOR__FormantPath_listCeilingFrequencies);
1486 	praat_addAction1 (classFormantPath, 0, U"Extract Formant", nullptr,0,
1487 			CONVERT_EACH_TO_ONE__FormantPath_extractFormant);
1488 	praat_addAction1 (classFormantPath, 0, U"To Matrix (stress)...", nullptr,0,
1489 			CONVERT_EACH_TO_ONE__FormantPath_to_Matrix_stress);
1490 	praat_addAction1 (classFormantPath, 0, U"To Matrix (qsums)...", nullptr,0,
1491 			CONVERT_EACH_TO_ONE__FormantPath_to_Matrix_qsums);
1492 	praat_addAction1 (classFormantPath, 0, U"To Matrix (transition)...", nullptr,0,
1493 			CONVERT_EACH_TO_ONE__FormantPath_to_Matrix_transition);
1494 	praat_addAction1 (classFormantPath, 0, U"To Matrix (deltas)...", nullptr,0,
1495 			CONVERT_EACH_TO_ONE__FormantPath_to_Matrix_deltas);
1496 	praat_addAction1 (classFormantPath, 0, U"Path finder...", nullptr,0,
1497 			MODIFY_EACH__FormantPath_pathFinder);
1498 
1499 	praat_addAction1 (classLFCC, 0, U"LFCC help", nullptr,0,
1500 			HELP__LFCC_help);
1501 	praat_CC_init (classLFCC);
1502 	praat_addAction1 (classLFCC, 0, U"To LPC...", nullptr,0,
1503 			CONVERT_EACH_TO_ONE__LFCC_to_LPC);
1504 
1505 	praat_addAction1 (classLineSpectralFrequencies, 0, U"LineSpectralFrequencies help", nullptr,0,
1506 			HELP__LineSpectralFrequencies_help);
1507 	praat_addAction1 (classLineSpectralFrequencies, 0, U"Draw frequencies...", nullptr,0,
1508 			GRAPHICS_EACH__LineSpectralFrequencies_drawFrequencies);
1509 	praat_addAction1 (classLineSpectralFrequencies, 0, QUERY_BUTTON, 0, 0, nullptr);
1510 		praat_TimeFrameSampled_query_init (classLineSpectralFrequencies);
1511 		praat_addAction1 (classLineSpectralFrequencies, 1, U"Get number of frequencies...", nullptr,1,
1512 				QUERY_ONE_FOR_INTEGER__LineSpectralFrequencies_getNumberOfFrequencies);
1513 		praat_addAction1 (classLineSpectralFrequencies, 1, U"List frequencies in frame...", nullptr,1,
1514 				QUERY_ONE_FOR_REAL_VECTOR__LineSpectralFrequencies_listFrequenciesInFrame);
1515 		praat_addAction1 (classLineSpectralFrequencies, 1, U"List all frequencies", nullptr,1,
1516 				QUERY_ONE_FOR_MATRIX__LineSpectralFrequencies_listAllFrequencies);
1517 
1518 	praat_addAction1 (classLineSpectralFrequencies, 0, U"To LPC", nullptr, 0,
1519 			CONVERT_EACH_TO_ONE__LineSpectralFrequencies_to_LPC);
1520 
1521 	praat_addAction1 (classLPC, 0, U"LPC help", nullptr, 0,
1522 			HELP__LPC_help);
1523 	praat_addAction1 (classLPC, 0, DRAW_BUTTON, nullptr, 0, nullptr);
1524 	praat_addAction1 (classLPC, 0, U"Draw gain...", nullptr, 1,
1525 			GRAPHICS_EACH__LPC_drawGain);
1526 	praat_addAction1 (classLPC, 0, U"Draw poles...", nullptr, 1,
1527 			GRAPHICS_EACH__LPC_drawPoles);
1528 	praat_addAction1 (classLPC, 0, QUERY_BUTTON, nullptr, 0, nullptr);
1529 		praat_TimeFrameSampled_query_init (classLPC);
1530 		praat_addAction1 (classLPC, 1, U"Get sampling interval", nullptr, 1,
1531 				QUERY_ONE_FOR_REAL__LPC_getSamplingInterval);
1532 		praat_addAction1 (classLPC, 1, U"-- get coefficients --", nullptr, 1, nullptr);
1533 		praat_addAction1 (classLPC, 1, U"Get number of coefficients...", nullptr, 1,
1534 				QUERY_ONE_FOR_INTEGER__LPC_getNumberOfCoefficients);
1535 		praat_addAction1 (classLPC, 1, U"Get coefficients in frame...", nullptr, 1,
1536 				QUERY_ONE_FOR_REAL_VECTOR_LPC_listAllCoefficientsInFrame);
1537 		praat_addAction1 (classLPC, 1, U"List all coefficients", nullptr, 1,
1538 				QUERY_ONE_FOR_MATRIX__LPC_listAllCoefficients);
1539 		praat_addAction1 (classLPC, 1, U"-- get gain --", nullptr, 1,
1540 				nullptr);
1541 		praat_addAction1 (classLPC, 1, U"Get gain in frame...", nullptr, 1,
1542 				QUERY_ONE_FOR_REAL__LPC_getGainInFrame);
1543 		praat_addAction1 (classLPC, 1, U"List all gains", nullptr, 1,
1544 				QUERY_ONE_FOR_REAL_VECTOR_LPC_listAllGains);
1545 	praat_addAction1 (classLPC, 0, MODIFY_BUTTON, nullptr, 0, nullptr);
1546 		praat_TimeFunction_modify_init (classLPC);
1547 	praat_addAction1 (classLPC, 0, U"Extract", nullptr, 0, nullptr);
1548 
1549 	praat_addAction1 (classLPC, 0, U"To Spectrum (slice)...", nullptr, 0,
1550 			CONVERT_EACH_TO_ONE__LPC_to_Spectrum_slice);
1551 	praat_addAction1 (classLPC, 0, U"To VocalTract (slice)...", nullptr, 0,
1552 			CONVERT_EACH_TO_ONE__LPC_to_VocalTract_slice);
1553 	praat_addAction1 (classLPC, 0, U"To VocalTract (slice, special)...", nullptr, 0,
1554 			CONVERT_EACH_TO_ONE__LPC_to_VocalTract_slice_special);
1555 	praat_addAction1 (classLPC, 0, U"To Polynomial (slice)...", nullptr, 0,
1556 			CONVERT_EACH_TO_ONE__LPC_to_Polynomial_slice);
1557 	praat_addAction1 (classLPC, 0, U"Down to Matrix (lpc)", nullptr, 0,
1558 			CONVERT_EACH_TO_ONE__LPC_downto_Matrix_lpc);
1559 	praat_addAction1 (classLPC, 0, U"Down to Matrix (rc)", nullptr, praat_HIDDEN,
1560 			CONVERT_EACH_TO_ONE__LPC_downto_Matrix_rc);
1561 	praat_addAction1 (classLPC, 0, U"Down to Matrix (area)", nullptr, praat_HIDDEN,
1562 			CONVERT_EACH_TO_ONE__LPC_downto_Matrix_area);
1563 	praat_addAction1 (classLPC, 0, U"Analyse", nullptr, 0, nullptr);
1564 	praat_addAction1 (classLPC, 0, U"To Formant", nullptr, 0,
1565 			CONVERT_EACH_TO_ONE__LPC_to_Formant);
1566 	praat_addAction1 (classLPC, 0, U"To Formant (keep all)", nullptr, 0,
1567 			CONVERT_EACH_TO_ONE__LPC_to_Formant_keep_all);
1568 	praat_addAction1 (classLPC, 0, U"To LFCC...", nullptr, 0,
1569 			CONVERT_EACH_TO_ONE__LPC_to_LFCC);
1570 	praat_addAction1 (classLPC, 0, U"To Spectrogram...", nullptr, 0,
1571 			CONVERT_EACH_TO_ONE__LPC_to_Spectrogram);
1572 	praat_addAction1 (classLPC, 0, U"To LineSpectralFrequencies...", nullptr, 0,
1573 			CONVERT_EACH_TO_ONE__LPC_to_LineSpectralFrequencies);
1574 
1575 	praat_addAction2 (classLPC, 1, classSound, 1, U"Analyse", nullptr, 0, nullptr);
1576 	praat_addAction2 (classLPC, 1, classSound, 1, U"Filter...", nullptr, 0,
1577 			CONVERT_ONE_AND_ONE_TO_ONE__LPC_Sound_filter);
1578 	praat_addAction2 (classLPC, 1, classSound, 1, U"Filter (inverse)", nullptr, 0,
1579 			CONVERT_ONE_AND_ONE_TO_ONE__LPC_Sound_filterInverse);
1580 	praat_addAction2 (classLPC, 1, classSound, 1, U"To LPC (robust)...", nullptr, praat_HIDDEN + praat_DEPTH_1,
1581 			CONVERT_ONE_AND_ONE_TO_ONE__LPC_Sound_to_LPC_robust);
1582 	praat_addAction2 (classLPC, 1, classSound, 1, U"Filter with filter at time...", nullptr, 0,
1583 			CONVERT_ONE_AND_ONE_TO_ONE__LPC_Sound_filterWithFilterAtTime);
1584 	praat_addAction2 (classLPC, 1, classSound, 1, U"Filter (inverse) with filter at time...", nullptr, 0,
1585 			CONVERT_ONE_AND_ONE_TO_ONE__LPC_Sound_filterInverseWithFilterAtTime);
1586 
1587 	praat_addAction1 (classPowerCepstrum, 0, U"PowerCepstrum help", nullptr, 0,
1588 			HELP__PowerCepstrum_help);
1589 	praat_addAction1 (classPowerCepstrum, 0, U"Draw...", nullptr, 0,
1590 			GRAPHICS_EACH__PowerCepstrum_draw);
1591 	praat_addAction1 (classPowerCepstrum, 0, U"Draw trend line...", nullptr, 0,
1592 			GRAPHICS_EACH__PowerCepstrum_drawTrendLine);
1593 	praat_addAction1 (classPowerCepstrum, 0, U"Draw tilt line...", nullptr, praat_DEPRECATED_2019,
1594 			GRAPHICS_EACH__PowerCepstrum_drawTrendLine);
1595 	praat_addAction1 (classCepstrum, 0, U"Draw (linear)...", nullptr, praat_HIDDEN,
1596 			GRAPHICS_EACH__Cepstrum_drawLinear);
1597 	praat_addAction1 (classCepstrum, 0, U"Down to PowerCepstrum", nullptr, 0,
1598 			CONVERT_EACH_TO_ONE__Cepstrum_downto_PowerCepstrum);
1599 	praat_addAction1 (classPowerCepstrum, 1, U"Query -", nullptr, 0, nullptr);
1600 		praat_addAction1 (classPowerCepstrum, 1, U"Query quefrency domain", nullptr, 1, nullptr);
1601 			praat_addAction1 (classPowerCepstrum, 1, U"Get start quefrency", nullptr, 2,
1602 					QUERY_ONE_FOR_REAL__PowerCepstrum_getStartQuefrency);
1603 			praat_addAction1 (classPowerCepstrum, 1, U"Get end quefrency", nullptr, 2,
1604 					QUERY_ONE_FOR_REAL__PowerCepstrum_getEndQuefrency);
1605 		praat_addAction1 (classPowerCepstrum, 1, U"Query quefrency sampling", nullptr, 1, nullptr);
1606 			praat_addAction1 (classPowerCepstrum, 1, U"Get number of quefrency bins", nullptr, 2,
1607 					QUERY_ONE_FOR_INTEGER__PowerCepstrum_getNumberOfQuefrencyBins);
1608 			praat_addAction1 (classPowerCepstrum, 1, U"Get quefrency step", nullptr, 2,
1609 					QUERY_ONE_FOR_REAL__PowerCepstrum_getQuefrencyStep);
1610 			praat_addAction1 (classPowerCepstrum, 1, U"Get quefrency from index...", nullptr, 2,
1611 					QUERY_ONE_FOR_REAL__PowerCepstrum_getQuefrencyFromIndex);
1612 			praat_addAction1 (classPowerCepstrum, 1, U"Get index from quefrency...", nullptr, 2,
1613 					QUERY_ONE_FOR_REAL__PowerCepstrum_getIndexFromQuefrency);
1614 		praat_addAction1 (classPowerCepstrum, 0, U"Get peak...", nullptr, 1,
1615 				QUERY_ONE_FOR_REAL__PowerCepstrum_getPeak);
1616 		praat_addAction1 (classPowerCepstrum, 0, U"Get quefrency of peak...", nullptr, 1,
1617 				QUERY_ONE_FOR_REAL__PowerCepstrum_getQuefrencyOfPeak);
1618 		praat_addAction1 (classPowerCepstrum, 0, U"Get peak prominence (hillenbrand)...", nullptr, praat_DEPTH_1 + praat_HIDDEN,
1619 				QUERY_ONE_FOR_REAL__PowerCepstrum_getPeakProminence_hillenbrand);
1620 		praat_addAction1 (classPowerCepstrum, 0, U"Get peak prominence...", nullptr, 1,
1621 				QUERY_ONE_FOR_REAL__PowerCepstrum_getPeakProminence);
1622 		praat_addAction1 (classPowerCepstrum, 0, U"Get trend line slope...", nullptr, 1,
1623 				QUERY_ONE_FOR_REAL__PowerCepstrum_getTrendLineSlope);
1624 		praat_addAction1 (classPowerCepstrum, 0, U"Get trend line intercept...", nullptr, 1,
1625 				QUERY_ONE_FOR_REAL__PowerCepstrum_getTrendLineIntercept);
1626 		praat_addAction1 (classPowerCepstrum, 0, U"Get value in bin...", nullptr, 1,
1627 				QUERY_ONE_FOR_REAL__PowerCepstrum_getValueInBin);
1628 		praat_addAction1 (classPowerCepstrum, 0, U"Get rhamonics to noise ratio...", nullptr, 1,
1629 				QUERY_ONE_FOR_REAL__PowerCepstrum_getRNR);
1630 		praat_addAction1 (classPowerCepstrum, 0, U"Get tilt line slope...", nullptr, praat_DEPRECATED_2019,
1631 				QUERY_ONE_FOR_REAL__PowerCepstrum_getTrendLineSlope);
1632 		praat_addAction1 (classPowerCepstrum, 0, U"Get tilt line intercept...", nullptr, praat_DEPRECATED_2019,
1633 				QUERY_ONE_FOR_REAL__PowerCepstrum_getTrendLineIntercept);
1634 	praat_addAction1 (classPowerCepstrum, 1, U"Modify -", nullptr, 0, nullptr);
1635 		praat_addAction1 (classPowerCepstrum, 0, U"Formula...", nullptr, 1,
1636 				MODIFY_EACH__PowerCepstrum_formula);
1637 		praat_addAction1 (classPowerCepstrum, 0, U"Subtract trend (in-place)...", nullptr, 1,
1638 				MODIFY_EACH__PowerCepstrum_subtractTrend_inplace);
1639 		praat_addAction1 (classPowerCepstrum, 0, U"Subtract tilt (in-line)...", nullptr, praat_DEPTH_1 + praat_DEPRECATED_2017,
1640 				MODIFY_EACH__PowerCepstrum_subtractTrend_inplace);
1641 		praat_addAction1 (classPowerCepstrum, 0, U"Smooth (in-place)...", nullptr, 1,
1642 				MODIFY_EACH__PowerCepstrum_smooth_inplace);
1643 		praat_addAction1 (classPowerCepstrum, 0, U"Smooth (in-line)...", nullptr, praat_DEPTH_1 + praat_DEPRECATED_2017,
1644 				MODIFY_EACH__PowerCepstrum_smooth_inplace);
1645 
1646 	praat_addAction1 (classPowerCepstrum, 0, U"Subtract trend...", nullptr, 0,
1647 			CONVERT_EACH_TO_ONE__PowerCepstrum_subtractTrend);
1648 	praat_addAction1 (classPowerCepstrum, 0, U"Subtract tilt...", nullptr, praat_DEPRECATED_2019,
1649 			CONVERT_EACH_TO_ONE__PowerCepstrum_subtractTrend);
1650 	praat_addAction1 (classPowerCepstrum, 0, U"Smooth...", nullptr, 0,
1651 			CONVERT_EACH_TO_ONE__PowerCepstrum_smooth);
1652 	praat_addAction1 (classCepstrum, 0, U"To Spectrum", nullptr, praat_HIDDEN,
1653 			CONVERT_EACH_TO_ONE__Cepstrum_to_Spectrum);
1654 	praat_addAction1 (classPowerCepstrum, 0, U"To Matrix", nullptr, 0,
1655 			CONVERT_EACH_TO_ONE__PowerCepstrum_to_Matrix);
1656 
1657 	praat_addAction1 (classPowerCepstrogram, 0, U"PowerCepstrogram help", nullptr, 0,
1658 			HELP__PowerCepstrogram_help);
1659 	praat_addAction1 (classPowerCepstrogram, 0, U"Paint...", nullptr, 0,
1660 			GRAPHICS_EACH__PowerCepstrogram_paint);
1661 	praat_addAction1 (classPowerCepstrogram, 0, U"Tabulate -", nullptr, 0, nullptr);
1662 		praat_addAction1 (classPowerCepstrogram, 1, U"List cepstral peak prominences...", nullptr, 1, LIST__PowerCepstrogram_listCPP);
1663 		praat_addAction1 (classPowerCepstrogram, 0, U"To Table (cepstral peak prominences)...", nullptr, 1, NEW__PowerCepstrogram_to_Table_CPP);
1664 	praat_addAction1 (classPowerCepstrogram, 0, U"To Table (hillenbrand)...", nullptr, praat_DEPTH_1 + praat_HIDDEN,
1665 			CONVERT_EACH_TO_ONE__PowerCepstrogram_to_Table_hillenbrand);
1666 	praat_addAction1 (classPowerCepstrogram, 1, U"Query -", nullptr, 0, nullptr);
1667 		praat_TimeFrameSampled_query_init (classPowerCepstrogram);
1668 		praat_addAction1 (classPowerCepstrogram, 1, U"Query quefrency domain", nullptr, 1, nullptr);
1669 			praat_addAction1 (classPowerCepstrogram, 1, U"Get start quefrency", nullptr, 2,
1670 					QUERY_ONE_FOR_REAL__PowerCepstrogram_getStartQuefrency);
1671 			praat_addAction1 (classPowerCepstrogram, 1, U"Get end quefrency", nullptr, 2,
1672 					QUERY_ONE_FOR_REAL__PowerCepstrogram_getEndQuefrency);
1673 		praat_addAction1 (classPowerCepstrogram, 1, U"Query quefrency sampling", nullptr, 1, nullptr);
1674 			praat_addAction1 (classPowerCepstrogram, 1, U"Get number of quefrency bins", nullptr, 2,
1675 					QUERY_ONE_FOR_INTEGER__PowerCepstrogram_getNumberOfQuefrencyBins);
1676 			praat_addAction1 (classPowerCepstrogram, 1, U"Get quefrency step", nullptr, 2,
1677 					QUERY_ONE_FOR_REAL__PowerCepstrogram_getQuefrencyStep);
1678 		praat_addAction1 (classPowerCepstrogram, 0, U"Get CPPS (hillenbrand)...", nullptr, praat_DEPTH_1 + praat_HIDDEN,
1679 				QUERY_ONE_FOR_REAL__PowerCepstrogram_getCPPS_hillenbrand);
1680 		praat_addAction1 (classPowerCepstrogram, 0, U"Get CPPS...", nullptr, 1,
1681 				QUERY_ONE_FOR_REAL__PowerCepstrogram_getCPPS);
1682 	praat_addAction1 (classPowerCepstrogram, 0, U"Modify -", nullptr, 0, nullptr);
1683 		praat_TimeFunction_modify_init (classPowerCepstrogram);
1684 		praat_addAction1 (classPowerCepstrogram, 0, U"Formula...", nullptr, 1,
1685 				MODIFY__EACH_WEAK__PowerCepstrogram_formula);
1686 		praat_addAction1 (classPowerCepstrogram, 0, U"Subtract trend (in-place)...", nullptr, 1,
1687 				MODIFY_EACH__PowerCepstrogram_subtractTrend_inplace);
1688 		praat_addAction1 (classPowerCepstrogram, 0, U"Subtract tilt (in-place)...", nullptr, praat_DEPRECATED_2019,
1689 				MODIFY_EACH__PowerCepstrogram_subtractTrend_inplace);
1690 		praat_addAction1 (classPowerCepstrogram, 0, U"Subtract tilt (in-line)...", nullptr, praat_DEPTH_1 + praat_DEPRECATED_2017,
1691 				MODIFY_EACH__PowerCepstrogram_subtractTrend_inplace);
1692 	praat_addAction1 (classPowerCepstrogram, 0, U"To PowerCepstrum (slice)...", nullptr, 0,
1693 			CONVERT_EACH_TO_ONE__PowerCepstrogram_to_PowerCepstrum_slice);
1694 	praat_addAction1 (classPowerCepstrogram, 0, U"Smooth...", nullptr, 0,
1695 			CONVERT_EACH_TO_ONE__PowerCepstrogram_smooth);
1696 	praat_addAction1 (classPowerCepstrogram, 0, U"Subtract trend...", nullptr, 0,
1697 			CONVERT_EACH_TO_ONE__PowerCepstrogram_subtractTrend);
1698 	praat_addAction1 (classPowerCepstrogram, 0, U"Subtract tilt...", nullptr, praat_DEPRECATED_2019,
1699 			CONVERT_EACH_TO_ONE__PowerCepstrogram_subtractTrend);
1700 	praat_addAction1 (classPowerCepstrogram, 0, U"To Matrix", nullptr, 0,
1701 			CONVERT_EACH_TO_ONE__PowerCepstrogram_to_Matrix);
1702 
1703 	praat_addAction1 (classSound, 0, U"To PowerCepstrogram...", U"To Harmonicity (gne)...", 1,
1704 			CONVERT_EACH_TO_ONE__Sound_to_PowerCepstrogram);
1705 	praat_addAction1 (classSound, 0, U"To PowerCepstrogram (hillenbrand)...", U"To Harmonicity (gne)...", praat_HIDDEN + praat_DEPTH_1,
1706 			CONVERT_EACH_TO_ONE__Sound_to_PowerCepstrogram_hillenbrand);
1707 	praat_addAction1 (classSound, 0, U"To Formant (robust)...", U"To Formant (sl)...", 2,
1708 			CONVERT_EACH_TO_ONE__Sound_to_Formant_robust);
1709 	praat_addAction1 (classSound, 0, U"To FormantPath...", U"To Formant (robust)...", 2,
1710 			CONVERT_EACH_TO_ONE__Sound_to_FormantPath);
1711 	praat_addAction1 (classSound, 0, U"To FormantPath (burg)...", U"To FormantPath...", 1,
1712 			CONVERT_EACH_TO_ONE__Sound_to_FormantPath_burg);
1713 	praat_addAction1 (classSound, 0, U"To LPC", U"To FormantPath...", 1, nullptr);
1714 	praat_addAction1 (classSound, 0, U"To LPC (autocorrelation)...", U"To LPC", 2,
1715 			CONVERT_EACH_TO_ONE__Sound_to_LPC_autocorrelation);
1716 	praat_addAction1 (classSound, 0, U"To LPC (covariance)...", U"To LPC (autocorrelation)...", 2,
1717 			CONVERT_EACH_TO_ONE__Sound_to_LPC_covariance);
1718 	praat_addAction1 (classSound, 0, U"To LPC (burg)...", U"To LPC (covariance)...", 2,
1719 			CONVERT_EACH_TO_ONE__Sound_to_LPC_burg);
1720 	praat_addAction1 (classSound, 0, U"To LPC (marple)...", U"To LPC (burg)...", 2,
1721 			CONVERT_EACH_TO_ONE__Sound_to_LPC_marple);
1722 	praat_addAction1 (classSound, 0, U"To MFCC...", U"To LPC (marple)...", 1,
1723 			CONVERT_EACH_TO_ONE__Sound_to_MFCC);
1724 	praat_addAction2 (classSound, 1, classFormantPath, 1, U"View & Edit", nullptr,0,
1725 			EDITOR_ONE_WITH_ONE_Sound_FormantPath_createFormantPathEditor);
1726 	praat_addAction3 (classSound, 1, classTextGrid, 1, classFormantPath, 1, U"View & Edit", nullptr, 0,
1727 			EDITOR_ONE_WITH_ONE_AND_ONE__Sound_TextGrid_FormantPath_createFormantPathEditor);
1728 
1729 	praat_addAction1 (classVocalTract, 0, U"Draw segments...", U"Draw", 0,
1730 			GRAPHICS_EACH__VocalTract_drawSegments);
1731 	praat_addAction1 (classVocalTract, 1, U"Get length", U"Draw segments...", 0,
1732 			QUERY_ONE_FOR_REAL__VocalTract_getLength);
1733 	praat_addAction1 (classVocalTract, 1, U"Set length", U"Formula...", 0,
1734 			MODIFY_EACH__VocalTract_setLength);
1735 	praat_addAction1 (classVocalTract, 0, U"To VocalTractTier...", U"To Spectrum...", 0,
1736 			CONVERT_EACH_TO_ONE__VocalTract_to_VocalTractTier);
1737 	praat_addAction1 (classVocalTractTier, 0, U"VocalTractTier help", nullptr, 0,
1738 			HELP__VocalTractTier_help);
1739 	praat_addAction1 (classVocalTractTier, 0, U"Query -", nullptr, 0, nullptr);
1740 		praat_TimeTier_query_init (classVocalTractTier);
1741 	praat_addAction1 (classVocalTractTier, 0, U"Modify -", nullptr, 0, nullptr);
1742 		praat_TimeTier_modify_init (classVocalTractTier);
1743 	praat_addAction1 (classVocalTractTier, 0, U"To LPC...", nullptr, 0,
1744 			CONVERT_EACH_TO_ONE__VocalTractTier_to_LPC);
1745 	praat_addAction1 (classVocalTractTier, 0, U"To VocalTract...", nullptr, 0,
1746 			CONVERT_EACH_TO_ONE__VocalTractTier_to_VocalTract);
1747 	praat_addAction2 (classVocalTractTier, 1, classVocalTract, 1, U"Add VocalTract...", nullptr, 0,
1748 			MODIFY_FIRST_OF_ONE_AND_ONE__VocalTractTier_addVocalTract);
1749 
1750 	INCLUDE_MANPAGES (manual_LPC)
1751 	INCLUDE_MANPAGES (manual_DataModeler)
1752 
1753 	INCLUDE_LIBRARY (praat_DataModeler_init)
1754 }
1755 
1756 /* End of file praat_LPC_init.c */
1757