Debian Codegraph @

LPC/praat_LPC_init.cpp

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