Debian Codegraph @

dwtools/praat_David_init.cpp

raw
1 /* praat_David_init.cpp
2 *
3 * Copyright (C) 1993-2026 David Weenink, 2015-2026 Paul Boersma
4 *
5 * This code is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
9 *
10 * This code is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this work. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 /*
20 djmw 20030701 Added Strings_setString.
21 djmw 20031020 Changed Matrix_solveEquation.
22 djmw 20031023 Added Spectra_multiply, Spectrum_conjugate and modified interface for CCA_TableOfReal_scores.
23 djmw 20031030 Added TableOfReal_appendColumns.
24 djmw 20031107 Added TablesOfReal_to_GSVD.
25 djmw 20040303 Latest modification
26 djmw 20040305 Added hints for PCA.
27 djmw 20040323 Added hint for Discriminant.
28 djmw 20040324 Added PCA_TableOfReal_getFractionVariance.
29 djmw 20040331 Modified Eigen_drawEigenvalues interface.
30 djmw 20040406 Extensive checks for creation of Sounds.
31 djmw 20040414 Forms texts.
32 djmw 20040523 Discriminant_TableOfReal_to_ClassificationTable: give new object a name.
33 djmw 20040623 Added ClassificationTable_to_Strings_maximumProbability.
34 djmw 20040704 BarkFilter... in Thing_recognizeClassesByName.
35 djmw 20041020 MelderFile -> structMelderFile.
36 djmw 20041105 TableOfReal_createFromVanNieropData_25females.
37 djmw 20041108 FormantFilter_drawSpectrum bug corrected (wrong field name).
38 djmw 20050308 Find path (slopes), Find path (band)... and others.
39 djmw 20050404 TableOfReal_appendColumns -> TableOfReal_appendColumnsMany
40 djmw 20050406 Procrustus -> Prorustes
41 djmw 20050407 MelFilter_drawFilterFunctions error in field names crashed praat
42 djmw 20050706 Eigen_getSumOfEigenvalues
43 djmw 20051012 Robust LPC analysis test
44 djmw 20051116 TableOfReal_drawScatterPlot horizontal and vertical axes indices should be positive numbers
45 djmw SVD extract lef/right singular vectors
46 djmw 20060111 TextGrid: Extend time moved from depth 1 to depth 2.
47 djmw 20060308 Thing_recognizeClassesByName: StringsIndex, CCA
48 djmw 20070206 Sound_changeGender: pitch range factor should be >= 0
49 djmw 20070304 Latest modification.
50 djmw 20070903 Melder_new<1...>
51 djmw 20071011 REQUIRE requires U"".
52 djmw 20071202 Melder_warning<n>
53 djmw 20080521 Confusion_drawAsnumbers
54 djmw 20090109 KlattGrid formulas for formant
55 djmw 20090708 KlattTable <-> Table
56 djmw 20090822 Thing_recognizeClassesByName: added classCepstrum, classIndex, classKlattTable
57 djmw 20090914 Excitation to Excitations crashed because of nullptr reference
58 djmw 20090927 TableOfReal_drawRow(s)asHistogram
59 djmw 20091023 Sound_draw_selectedIntervals
60 djmw 20091230 Covariance_TableOfReal_mahalanobis
61 djmw 20100212 Standardize on Window length
62 djmw 20100511 Categories_getNumberOfCategories
63 djmw 20120813 Latest modification.
64 */
65
66 #include "NUMcomplex.h"
67 #include "NUMmachar.h"
68
69 #include "ActivationList.h"
70 #include "AmplitudeTier.h"
71 #include "Categories.h"
72 #include "CategoriesEditor.h"
73 #include "ChebyshevSeries.h"
74 #include "ClassificationTable.h"
75 #include "Collection_extensions.h"
76 #include "ComplexSpectrogram.h"
77 #include "Confusion.h"
78 #include "Covariance.h"
79 #include "DataModeler.h"
80 #include "Discriminant.h"
81 #include "EditDistanceTable.h"
82 #include "Editor.h"
83 #include "EditDistanceTable.h"
84 #include "Eigen_and_Matrix.h"
85 #include "Eigen_and_Procrustes.h"
86 #include "Eigen_and_SSCP.h"
87 #include "Eigen_and_TableOfReal.h"
88 #include "Excitations.h"
89 #include "FileInMemory.h"
90 #include "FilterBank.h"
91 #include "Formula.h"
92 #include "FormantGridEditor.h"
93 #include "FormantGrid_extensions.h"
94 #include "Intensity_extensions.h"
95 #include "IntensityTierEditor.h"
96 #include "Matrix_Categories.h"
97 #include "Matrix_extensions.h"
98 #include "LongSound_extensions.h"
99 #include "KlattGridEditors.h"
100 #include "KlattTable.h"
101 #include "LegendreSeries.h"
102 #include "Ltas_extensions.h"
103 #include "Minimizers.h"
104 #include "NavigationContext.h"
105 #include "PatternList.h"
106 #include "PCA.h"
107 #include "PitchTierEditor.h"
108 #include "Polygon_extensions.h"
109 #include "Polynomial_to_Spectrum.h"
110 #include "Roots_to_Spectrum.h"
111 #include "Sound_and_Spectrum_dft.h"
112 #include "Sound_extensions.h"
113 #include "Sound_and_TextGrid_extensions.h"
114 #include "Sounds_to_DTW.h"
115 #include "Spectrum_extensions.h"
116 #include "Spectrogram.h"
117 #include "SpeechSynthesizer.h"
118 #include "SpeechSynthesizer_and_TextGrid.h"
119 #include "Spline.h"
120 #include "Strings_extensions.h"
121 #include "SVD.h"
122 #include "Table_extensions.h"
123 #include "TableOfReal_and_Discriminant.h"
124 #include "TableOfReal_and_Permutation.h"
125 #include "TextGrid_extensions.h"
126 #include "TextGridTierNavigator.h"
127 #include "TextGridNavigator.h"
128 #include "Vector_extensions.h"
129
130 #include "Categories_and_Strings.h"
131 #include "CCA_and_Correlation.h"
132 #include "Cepstrum_and_Spectrum.h"
133 #include "CCs_to_DTW.h"
134 #include "Discriminant_PatternList_Categories.h"
135 #include "DTW_and_TextGrid.h"
136 #include "Matrix_and_NMF.h"
137 #include "Permutation_and_Index.h"
138 #include "Pitch_extensions.h"
139 #include "Sound_and_Spectrogram_extensions.h"
140 #include "Sound_to_Pitch2.h"
141 #include "Sound_to_SPINET.h"
142 #include "TableOfReal_and_SVD.h"
143 #include "TextGrid_and_DurationTier.h"
144 #include "TextGrid_and_PitchTier.h"
145 #include "VowelEditor.h"
146
147 #include "praat_TimeFrameSampled.h"
148 #include "praat_Matrix.h"
149 #include "praat_TableOfReal.h"
150 #include "praat_uvafon_init.h"
151
152 void praat_TableOfReal_init2 (ClassInfo klas);
153 void praat_SSCP_as_TableOfReal_init (ClassInfo klas);
154
155 void praat_CC_init (ClassInfo klas);
156 void praat_BandFilterSpectrogram_query_init (ClassInfo klas);
157 void praat_EditDistanceTable_as_TableOfReal_init (ClassInfo klas);
158
159 #define DTW_constraints_addCommonFields(matchStart,matchEnd,slopeConstraint) \
160 COMMENT (U"Boundary conditions") \
161 BOOLEAN (matchStart, U"Match begin positions", false) \
162 BOOLEAN (matchEnd, U"Match end positions", false) \
163 CHOICE (slopeConstraint, U"Slope constraint", 1) \
164 OPTION (U"no restriction") \
165 OPTION (U"1/3 < slope < 3") \
166 OPTION (U"1/2 < slope < 2") \
167 OPTION (U"2/3 < slope < 3/2")
168
169 #undef INCLUDE_DTW_SLOPES
170
171 /********************** Activation *******************************************/
172
173 FORM (MODIFY_ActivationList_formula, U"ActivationList: Formula", nullptr) {
174 COMMENT (U"for col := 1 to ncol do { self [row, col] := `formula' ; x := x + dx } y := y + dy }}")
175 FORMULA (formula, U"Formula", U"self")
176 OK
177 DO
178 MODIFY_EACH_WEAK (ActivationList)
179 Matrix_formula (me, formula, interpreter, nullptr);
180 MODIFY_EACH_WEAK_END
181 }
182
183 DIRECT (CONVERT_EACH_TO_ONE__ActivationList_to_Matrix) {
184 CONVERT_EACH_TO_ONE (ActivationList)
185 autoMatrix result = ActivationList_to_Matrix (me);
186 CONVERT_EACH_TO_ONE_END (my name.get())
187 }
188
189 DIRECT (CONVERT_EACH_TO_ONE__ActivationList_to_PatternList) {
190 CONVERT_EACH_TO_ONE (ActivationList)
191 autoPatternList result = ActivationList_to_PatternList (me);
192 CONVERT_EACH_TO_ONE_END (my name.get())
193 }
194
195 FORM (QUERY_ONE_FOR_REAL__AmplitudeTier_getValueAtTime, U"AmplitudeTier: Get value at time", nullptr) {
196 REAL (time, U"Time (s)", U"0.5")
197 OK
198 DO
199 QUERY_ONE_FOR_REAL (AmplitudeTier)
200 const double result = RealTier_getValueAtTime (me, time);
201 QUERY_ONE_FOR_REAL_END (U" Hz")
202 }
203
204 FORM (QUERY_ONE_FOR_REAL__AmplitudeTier_getValueAtIndex, U"AmplitudeTier: Get value at index", nullptr) {
205 INTEGER (pointNumber, U"Point number", U"10")
206 OK
207 DO
208 QUERY_ONE_FOR_REAL (AmplitudeTier)
209 const double result = RealTier_getValueAtIndex (me, pointNumber);
210 QUERY_ONE_FOR_REAL_END (U" Hz")
211 }
212
213
214 /********************** BarkFilter *******************************************/
215
216 DIRECT (HELP__BarkFilter_help) {
217 HELP (U"BarkFilter")
218 }
219
220 DIRECT (HELP__BarkSpectrogram_help) {
221 HELP (U"BarkSpectrogram")
222 }
223
224 FORM (GRAPHICS_EACH__BarkFilter_drawSpectrum, U"BarkFilter: Draw spectrum (slice)", U"FilterBank: Draw spectrum (slice)...") {
225 REAL (time, U"Time (s)", U"0.1")
226 REAL (fromFrequency, U"left Frequency range (Bark)", U"0.0")
227 REAL (toFrequency, U"right Frequency range (Bark)", U"0.0")
228 REAL (fromAmplitude, U"left Amplitude range (dB)", U"0.0")
229 REAL (toAmplitude, U"right Amplitude range (dB)", U"0.0")
230 BOOLEAN (garnish, U"Garnish", true)
231 OK
232 DO
233 GRAPHICS_EACH (BarkFilter)
234 FilterBank_drawTimeSlice (me, GRAPHICS, time, fromFrequency, toFrequency, fromAmplitude, toAmplitude, U"Barks", garnish);
235 GRAPHICS_EACH_END
236 }
237
238 FORM (GRAPHICS_EACH__BarkFilter_drawSekeyHansonFilterFunctions, U"BarkFilter: Draw filter functions", U"FilterBank: Draw filter functions...") {
239 INTEGER (fromFilter, U"left Filter range", U"0")
240 INTEGER (toFilter, U"right Filter range", U"0")
241 CHOICE (frequencyScale, U"Frequency scale", 1)
242 OPTION (U"Hertz")
243 OPTION (U"Bark")
244 OPTION (U"mel")
245 REAL (fromFrequency, U"left Frequency range", U"0.0")
246 REAL (toFrequency, U"right Frequency range", U"0.0")
247 BOOLEAN (amplitudeScale_dB, U"Amplitude scale in dB", true)
248 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
249 REAL (toAmplitude, U"right Amplitude range", U"0.0")
250 BOOLEAN (garnish, U"Garnish", true)
251 OK
252 DO
253 GRAPHICS_EACH (BarkFilter)
254 BarkFilter_drawSekeyHansonFilterFunctions (me, GRAPHICS, frequencyScale, fromFilter, toFilter,
255 fromFrequency, toFrequency, amplitudeScale_dB, fromAmplitude, toAmplitude, garnish
256 );
257 GRAPHICS_EACH_END
258 }
259
260 FORM (GRAPHICS_EACH__BarkSpectrogram_drawSekeyHansonAuditoryFilters, U"BarkSpectrogram: Draw Sekey-Hanson auditory filters", U"BarkSpectrogram: Draw Sekey-Hanson auditory filters...") {
261 INTEGER (fromFilter, U"left Filter range", U"0")
262 INTEGER (toFilter, U"right Filter range", U"0")
263 CHOICE (frequencyScale, U"Frequency scale", 2)
264 OPTION (U"Hertz")
265 OPTION (U"Bark")
266 REAL (fromFrequency, U"left Frequency range", U"0.0")
267 REAL (toFrequency, U"right Frequency range", U"0.0")
268 BOOLEAN (amplitudeScale_dB, U"Amplitude scale in dB", true)
269 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
270 REAL (toAmplitude, U"right Amplitude range", U"0.0")
271 BOOLEAN (garnish, U"Garnish", true)
272 OK
273 DO
274 GRAPHICS_EACH (BarkSpectrogram)
275 bool xIsHertz = (frequencyScale == 1);
276 BarkSpectrogram_drawSekeyHansonFilterFunctions (me, GRAPHICS, xIsHertz, fromFilter, toFilter,
277 fromFrequency, toFrequency, amplitudeScale_dB, fromAmplitude, toAmplitude, garnish
278 );
279 GRAPHICS_EACH_END
280 }
281
282 FORM (GRAPHICS_EACH__BarkFilter_paint, U"FilterBank: Paint", nullptr) {
283 praat_TimeFunction_RANGE (fromTime, toTime)
284 REAL (fromFrequency, U"left Frequency range (bark)", U"0.0")
285 REAL (toFrequency, U"right Frequency range (bark)", U"0.0")
286 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
287 REAL (toAmplitude, U"right Amplitude range", U"0.0")
288 BOOLEAN (garnish, U"Garnish", false)
289 OK
290 DO
291 GRAPHICS_EACH (BarkFilter)
292 FilterBank_paint (me, GRAPHICS,
293 fromTime, toTime, fromFrequency, toFrequency, fromAmplitude, toAmplitude, garnish
294 );
295 GRAPHICS_EACH_END
296 }
297
298 DIRECT (CONVERT_EACH_TO_ONE__BarkFilter_to_BarkSpectrogram) {
299 CONVERT_EACH_TO_ONE (BarkFilter)
300 autoBarkSpectrogram result = BarkFilter_to_BarkSpectrogram (me);
301 CONVERT_EACH_TO_ONE_END (my name.get())
302 }
303
304 DIRECT (CONVERT_EACH_TO_ONE__MelFilter_to_MelSpectrogram) {
305 CONVERT_EACH_TO_ONE (MelFilter)
306 autoMelSpectrogram result = MelFilter_to_MelSpectrogram (me);
307 CONVERT_EACH_TO_ONE_END (my name.get())
308 }
309
310 DIRECT (CONVERT_EACH_TO_ONE__FormantFilter_to_Spectrogram) {
311 CONVERT_EACH_TO_ONE (FormantFilter);
312 autoSpectrogram result = FormantFilter_to_Spectrogram (me);
313 CONVERT_EACH_TO_ONE_END (my name.get())
314 }
315
316 /********************** Categories ****************************************/
317
318 FORM (MODIFY_Categories_appendCategory, U"Categories: Append 1 category", U"Categories: Append 1 category...") {
319 SENTENCE (category, U"Category", U"")
320 OK
321 DO
322 MODIFY_EACH (Categories)
323 OrderedOfString_append (me, category);
324 MODIFY_EACH_END
325 }
326
327 DIRECT (EDITOR_ONE_Categories_edit) {
328 EDITOR_ONE (a,Categories)
329 autoCategoriesEditor editor = CategoriesEditor_create (ID_AND_FULL_NAME, me);
330 EDITOR_ONE_END
331 }
332
333 DIRECT (QUERY_ONE_FOR_INTEGER__Categories_getNumberOfCategories) {
334 QUERY_ONE_FOR_INTEGER (Categories)
335 const integer result = my size;
336 QUERY_ONE_FOR_INTEGER_END (U" categories")
337 }
338
339 DIRECT (QUERY_TWO_FOR_REAL__Categories_getNumberOfDifferences) {
340 QUERY_TWO_FOR_REAL (Categories)
341 const integer result = OrderedOfString_getNumberOfDifferences (me, you);
342 QUERY_TWO_FOR_REAL_END (U" differences")
343 }
344
345 DIRECT (QUERY_TWO_FOR_REAL__Categories_getFractionDifferent) {
346 QUERY_TWO_FOR_REAL (Categories)
347 const double result = OrderedOfString_getFractionDifferent (me, you);
348 QUERY_TWO_FOR_REAL_END (U" (fraction different)")
349 }
350
351 DIRECT (CONVERT_EACH_TO_ONE__Categories_selectUniqueItems) {
352 CONVERT_EACH_TO_ONE (Categories)
353 autoCategories result = Categories_selectUniqueItems (me);
354 CONVERT_EACH_TO_ONE_END (my name.get(), U"_uniq")
355 }
356
357 DIRECT (CONVERT_TWO_TO_ONE__Categories_to_Confusion) {
358 CONVERT_TWO_TO_ONE (Categories)
359 autoConfusion result = Categories_to_Confusion (me, you);
360 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
361 }
362
363 DIRECT (CONVERT_EACH_TO_ONE__Categories_to_Strings) {
364 CONVERT_EACH_TO_ONE (Categories)
365 autoStrings result = Categories_to_Strings (me);
366 CONVERT_EACH_TO_ONE_END (my name.get())
367 }
368
369 DIRECT (CONVERT_TWO_TO_ONE__Categories_join) {
370 CONVERT_TWO_TO_ONE (Categories)
371 autoStringList result = OrderedOfString_joinItems (me, you);
372 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
373 }
374
375 DIRECT (CONVERT_EACH_TO_ONE__Categories_permuteItems) {
376 CONVERT_EACH_TO_ONE (Categories)
377 autoCollection result = Collection_permuteItems (reinterpret_cast <Collection> (me));
378 CONVERT_EACH_TO_ONE_END (my name.get(), U"_perm")
379 }
380
381 DIRECT (MODIFY_EACH__Categories_permuteItems_inplace) {
382 MODIFY_EACH (Categories)
383 Collection_permuteItems_inplace (reinterpret_cast <Collection> (me));
384 MODIFY_EACH_END
385 }
386
387 /***************** CC ****************************************/
388
389 FORM (QUERY_ONE_FOR_INTEGER__CC_getNumberOfCoefficients, U"Get number of coefficients", nullptr) {
390 NATURAL (frameNumber, U"Frame number", U"1")
391 OK
392 DO
393 QUERY_ONE_FOR_INTEGER (CC)
394 const integer result = CC_getNumberOfCoefficients (me, frameNumber);
395 QUERY_ONE_FOR_INTEGER_END (U" (number of coefficients)")
396 }
397
398 FORM (QUERY_ONE_FOR_REAL__CC_getValue, U"CC: Get value", U"CC: Get value...") {
399 REAL (time, U"Time (s)", U"0.1")
400 NATURAL (index, U"Index", U"1")
401 OK
402 DO
403 QUERY_ONE_FOR_REAL (CC)
404 const double result = CC_getValue (me, time, index);
405 QUERY_ONE_FOR_REAL_END (U"")
406 }
407
408 FORM (QUERY_ONE_FOR_REAL__CC_getValueInFrame, U"CC: Get value in frame", U"CC: Get value in frame...") {
409 NATURAL (frameNumber, U"Frame number", U"1")
410 NATURAL (index, U"Index", U"1")
411 OK
412 DO
413 QUERY_ONE_FOR_REAL (CC)
414 const double result = CC_getValueInFrame (me, frameNumber, index);
415 QUERY_ONE_FOR_REAL_END (U"")
416 }
417
418 FORM (QUERY_ONE_FOR_REAL__CC_getC0ValueInFrame, U"CC: Get c0 value in frame", U"CC: Get c0 value in frame...") {
419 NATURAL (frameNumber, U"Frame number", U"1")
420 OK
421 DO
422 QUERY_ONE_FOR_REAL (CC)
423 const double result = CC_getC0ValueInFrame (me, frameNumber);
424 QUERY_ONE_FOR_REAL_END (U"")
425 }
426
427 FORM (GRAPHICS_EACH__CC_paint, U"CC: Paint", U"CC: Paint...") {
428 praat_TimeFunction_RANGE (fromTime, toTime)
429 INTEGER (fromCoefficient, U"From coefficient", U"0")
430 INTEGER (toCoefficient, U"To coefficient", U"0")
431 REAL (minimum, U"Minimum", U"0.0")
432 REAL (maximum, U"Maximum", U"0.0")
433 BOOLEAN (garnish, U"Garnish", true)
434 OK
435 DO
436 GRAPHICS_EACH (CC)
437 CC_paint (me, GRAPHICS, fromTime, toTime, fromCoefficient, toCoefficient, minimum, maximum, garnish);
438 GRAPHICS_EACH_END
439 }
440
441 FORM (GRAPHICS_EACH__CC_drawC0, U"CC: Draw c0", U"CC: Draw c0...") {
442 praat_TimeFunction_RANGE (fromTime, toTime)
443 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
444 REAL (toAmplitude, U"right Amplitude range", U"0.0")
445 BOOLEAN (garnish, U"Garnish", true)
446 OK
447 DO
448 GRAPHICS_EACH (CC)
449 CC_drawC0 (me, GRAPHICS, fromTime, toTime,fromAmplitude, toAmplitude, garnish);
450 GRAPHICS_EACH_END
451 }
452
453 FORM (CONVERT_TWO_TO_ONE__CCs_to_DTW, U"CC: To DTW", U"CC: To DTW...") {
454 COMMENT (U"Distance between cepstral coefficients")
455 REAL (cepstralWeight, U"Cepstral weight", U"1.0")
456 REAL (logEnergyWeight, U"Log energy weight", U"0.0")
457 REAL (regressionWeight, U"Regression weight", U"0.0")
458 REAL (regressionLogEnergyWeight, U"Regression log energy weight", U"0.0")
459 REAL (regressionWindowLength, U"Regression window length (s)", U"0.056")
460 DTW_constraints_addCommonFields (matchStart, matchEnd, slopeConstraint)
461 OK
462 DO
463 CONVERT_TWO_TO_ONE (CC)
464 autoDTW result = CCs_to_DTW (me, you, cepstralWeight, logEnergyWeight, regressionWeight,
465 regressionLogEnergyWeight, regressionWindowLength
466 );
467 DTW_findPath (result.get(), matchStart, matchEnd, slopeConstraint);
468 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get());
469 }
470
471 DIRECT (CONVERT_EACH_TO_ONE__CC_to_Matrix) {
472 CONVERT_EACH_TO_ONE (CC)
473 autoMatrix result = CC_to_Matrix (me);
474 CONVERT_EACH_TO_ONE_END (my name.get())
475 }
476
477 /******************* class CCA ********************************/
478
479 DIRECT (HELP__CCA_help) {
480 HELP (U"CCA")
481 }
482
483 FORM (GRAPHICS_EACH__CCA_drawEigenvector, U"CCA: Draw eigenvector", U"Eigen: Draw eigenvector...") {
484 OPTIONMENU (xOrY, U"X or Y", 1)
485 OPTION (U"y")
486 OPTION (U"x")
487 INTEGER (eigenVectorNumber, U"Eigenvector number", U"1")
488 COMMENT (U"Multiply by eigenvalue?")
489 BOOLEAN (useComponentLoadings, U"Component loadings", false)
490 COMMENT (U"Select part of the eigenvector:")
491 INTEGER (fromElement, U"left Element range", U"0")
492 INTEGER (toElement, U"right Element range", U"0")
493 REAL (fromAmplitude, U"left Amplitude range", U"-1.0")
494 REAL (toAmplitude, U"right Amplitude range", U"1.0")
495 POSITIVE (markSize_mm, U"Mark size (mm)", U"1.0")
496 SENTENCE (mark_string, U"Mark string (+xo.)", U"+")
497 BOOLEAN (connectPoints, U"Connect points", true)
498 BOOLEAN (garnish, U"Garnish", true)
499 OK
500 DO
501 GRAPHICS_EACH (CCA)
502 CCA_drawEigenvector (me, GRAPHICS, xOrY, eigenVectorNumber, fromElement, toElement,
503 fromAmplitude, toAmplitude, useComponentLoadings, markSize_mm, mark_string, connectPoints, garnish
504 );
505 GRAPHICS_EACH_END
506 }
507
508 DIRECT (QUERY_ONE_FOR_INTEGER__CCA_getNumberOfCorrelations) {
509 QUERY_ONE_FOR_INTEGER (CCA)
510 const integer result = my numberOfCoefficients;
511 QUERY_ONE_FOR_INTEGER_END (U"")
512 }
513
514 FORM (QUERY_ONE_FOR_REAL__CCA_getCorrelation, U"CCA: Get canonical correlation coefficient", U"CCA: Get canonical correlation coefficient") {
515 NATURAL (coefficientNuber, U"Coefficient number", U"1")
516 OK
517 DO
518 QUERY_ONE_FOR_REAL (CCA)
519 const double result = CCA_getCorrelationCoefficient (me, coefficientNuber);
520 QUERY_ONE_FOR_REAL_END (U"")
521 }
522
523 FORM (QUERY_ONE_FOR_REAL__CCA_getEigenvectorElement, U"CCA: Get eigenvector element", U"Eigen: Get eigenvector element...") {
524 OPTIONMENU (xOrY, U"X or Y", 1)
525 OPTION (U"y")
526 OPTION (U"x")
527 NATURAL (eigenvectorNumber, U"Eigenvector number", U"1")
528 NATURAL (elementNumber, U"Element number", U"1")
529 OK
530 DO
531 QUERY_ONE_FOR_REAL (CCA)
532 const double result = CCA_getEigenvectorElement (me, xOrY, eigenvectorNumber, elementNumber);
533 QUERY_ONE_FOR_REAL_END (U"")
534 }
535
536 FORM (QUERY_ONE_FOR_REAL__CCA_getZeroCorrelationProbability, U"CCA: Get zero correlation probability", U"CCA: Get zero correlation probability...") {
537 NATURAL (coefficientNumber, U"Coefficient number", U"1")
538 OK
539 DO
540 QUERY_ONE_FOR_REAL (CCA)
541 double result, chisq, ndof;
542 CCA_getZeroCorrelationProbability (me, coefficientNumber, & result, & chisq, & ndof);
543 QUERY_ONE_FOR_REAL_END (U" (probability for chisq = ", chisq, U" and ndf = ", ndof, U")");
544 }
545
546 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__CCA_Correlation_to_TableOfReal_loadings) {
547 CONVERT_ONE_AND_ONE_TO_ONE (CCA, Correlation)
548 autoTableOfReal result = CCA_Correlation_factorLoadings (me, you);
549 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_loadings")
550 }
551
552 FORM (QUERY_ONE_AND_ONE_FOR_REAL__CCA_Correlation_getVarianceFraction, U"CCA & Correlation: Get variance fraction", U"CCA & Correlation: Get variance fraction...") {
553 COMMENT (U"Get the fraction of variance from the data in set...")
554 OPTIONMENU (xOrY, U"X or Y", 1)
555 OPTION (U"y")
556 OPTION (U"x")
557 COMMENT (U"extracted by...")
558 NATURAL (fromCanonicalVariate, U"left Canonical variate range", U"1")
559 NATURAL (toCanonicalVariate, U"right Canonical variate range", U"1")
560 OK
561 DO
562 QUERY_ONE_AND_ONE_FOR_REAL (CCA, Correlation)
563 const double result = CCA_Correlation_getVarianceFraction (me, you, xOrY, fromCanonicalVariate, toCanonicalVariate);
564 QUERY_ONE_AND_ONE_FOR_REAL_END (U" (fraction variance from ", (xOrY == 1 ? U"y" : U"x"),
565 U", extracted by canonical variates ", fromCanonicalVariate, U" to ", toCanonicalVariate, U")")
566 }
567
568 FORM (QUERY_ONE_AND_ONE_FOR_REAL__CCA_Correlation_getRedundancy_sl, U"CCA & Correlation: Get Stewart-Love redundancy", U"CCA & Correlation: Get redundancy (sl)...") {
569 COMMENT (U"Get the redundancy of the data in set...")
570 OPTIONMENU (xOrY, U"X or Y", 1)
571 OPTION (U"y")
572 OPTION (U"x")
573 COMMENT (U"extracted by...")
574 NATURAL (fromCanonicalVariate, U"left Canonical variate range", U"1")
575 NATURAL (toCanonicalVariate, U"right Canonical variate range", U"1")
576 COMMENT (U"...given the availability of the data in the other set.")
577 OK
578 DO
579 QUERY_ONE_AND_ONE_FOR_REAL (CCA, Correlation)
580 const double result = CCA_Correlation_getRedundancy_sl (me, you, xOrY, fromCanonicalVariate, toCanonicalVariate);
581 QUERY_ONE_AND_ONE_FOR_REAL_END (U" (redundancy from ", (xOrY == 1 ? U"y" : U"x"),
582 U" extracted by canonical variates ", fromCanonicalVariate, U" to ", toCanonicalVariate, U")")
583 }
584
585 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__CCA_TableOfReal_to_TableOfReal_loadings) {
586 CONVERT_ONE_AND_ONE_TO_ONE (CCA, TableOfReal)
587 autoTableOfReal result = CCA_TableOfReal_factorLoadings (me, you);
588 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_loadings")
589 }
590
591 FORM (CONVERT_ONE_AND_ONE_TO_ONE__CCA_TableOfReal_to_TableOfReal_scores, U"CCA & TableOfReal: To TableOfReal (scores)", U"CCA & TableOfReal: To TableOfReal (scores)...") {
592 INTEGER (numberOfCanonicalVariates, U"Number of canonical correlations", U"0 (= all)")
593 OK
594 DO
595 CONVERT_ONE_AND_ONE_TO_ONE (CCA, TableOfReal)
596 autoTableOfReal result = CCA_TableOfReal_scores (me, you, numberOfCanonicalVariates);
597 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_scores");
598 }
599
600 FORM (CONVERT_ONE_AND_ONE_TO_ONE__CCA_TableOfReal_predict, U"CCA & TableOfReal: Predict", U"CCA & TableOfReal: Predict...") {
601 COMMENT (U"The data set from which to predict starts at...")
602 INTEGER (columnNumber, U"Column number", U"1")
603 OK
604 DO
605 CONVERT_ONE_AND_ONE_TO_ONE (CCA, TableOfReal)
606 autoTableOfReal result = CCA_TableOfReal_predict (me, you, columnNumber);
607 CONVERT_ONE_AND_ONE_TO_ONE_END (your name.get(), U"_", my name.get())
608 }
609
610 FORM (CONVERT_EACH_TO_ONE__CCA_extractEigen, U"CCA: Extract Eigen", nullptr) {
611 OPTIONMENU (choice, U"variablesType", 1)
612 OPTION (U"Dependent")
613 OPTION (U"Independent")
614 OK
615 DO
616 CONVERT_EACH_TO_ONE (CCA)
617 autoEigen result = choice == 1 ? Data_copy (my y.get()) : Data_copy (my x.get());
618 CONVERT_EACH_TO_ONE_END (my name.get(), ( choice == 1 ? U"_y" : U"_x" ))
619 }
620
621 /***************** ChebyshevSeries ****************************************/
622
623 DIRECT (HELP__ChebyshevSeries_help) {
624 HELP (U"ChebyshevSeries")
625 }
626
627 FORM (CREATE_ONE__ChebyshevSeries_create, U"Create ChebyshevSeries", U"Create ChebyshevSeries...") {
628 WORD (name, U"Name", U"cs")
629 COMMENT (U"Domain")
630 REAL (xmin, U"Xmin", U"-1")
631 REAL (xmax, U"Xmax", U"1")
632 COMMENT (U"ChebyshevSeries(x) = c[1] T[0](x) + c[2] T[1](x) + ... c[n+1] T[n](x)")
633 COMMENT (U"T[k] is a Chebyshev polynomial of degree k")
634 REALVECTOR (coefficients, U"Coefficients (c[k])", WHITESPACE_SEPARATED_, U"0 0 1.0")
635 OK
636 DO
637 Melder_require (xmin < xmax, U"Xmin should be smaller than Xmax.");
638 CREATE_ONE
639 autoChebyshevSeries result = ChebyshevSeries_createWithCoefficients (xmin, xmax, coefficients);
640 CREATE_ONE_END (name)
641 }
642
643 DIRECT (CONVERT_EACH_TO_ONE__ChebyshevSeries_to_Polynomial) {
644 CONVERT_EACH_TO_ONE (ChebyshevSeries)
645 autoPolynomial result = ChebyshevSeries_to_Polynomial (me);
646 CONVERT_EACH_TO_ONE_END (my name.get());
647 }
648
649 /***************** ClassificationTable ****************************************/
650
651 DIRECT (HELP__ClassificationTable_help) {
652 HELP (U"ClassificationTable")
653 }
654
655 FORM (QUERY_ONE_FOR_INTEGER__ClassificationTable_getClassIndexAtMaximumInRow, U"ClassificationTable: Get class index at maximum in row", nullptr) {
656 NATURAL (rowNumber, U"Row number", U"1")
657 OK
658 DO
659 QUERY_ONE_FOR_INTEGER (ClassificationTable)
660 const integer result = TableOfReal_getColumnIndexAtMaximumInRow (me, rowNumber);
661 QUERY_ONE_FOR_INTEGER_END (U" (class index at maximum in row)")
662 }
663
664 FORM (QUERY_ONE_FOR_STRING__ClassificationTable_getClassLabelAtMaximumInRow, U"ClassificationTable: Get class label at maximum in row", nullptr) {
665 NATURAL (rowNumber, U"Row number", U"1")
666 OK
667 DO
668 QUERY_ONE_FOR_STRING (ClassificationTable)
669 conststring32 result = TableOfReal_getColumnLabelAtMaximumInRow (me, rowNumber);
670 QUERY_ONE_FOR_STRING_END
671 }
672
673 // deprecated 2014
674 DIRECT (CONVERT_EACH_TO_ONE__ClassificationTable_to_Confusion_old) {
675 CONVERT_EACH_TO_ONE (ClassificationTable)
676 autoConfusion result = ClassificationTable_to_Confusion (me, false);
677 CONVERT_EACH_TO_ONE_END (my name.get())
678 }
679
680 FORM (CONVERT_EACH_TO_ONE__ClassificationTable_to_Confusion, U"ClassificationTable: To Confusion", U"ClassificationTable: To Confusion...") {
681 BOOLEAN (onlyClassLabels, U"Only class labels", true)
682 OK
683 DO
684 CONVERT_EACH_TO_ONE (ClassificationTable)
685 autoConfusion result = ClassificationTable_to_Confusion (me, onlyClassLabels);
686 CONVERT_EACH_TO_ONE_END (my name.get())
687 }
688
689 DIRECT (CONVERT_EACH_TO_ONE__ClassificationTable_to_Correlation_columns) {
690 CONVERT_EACH_TO_ONE (ClassificationTable)
691 autoCorrelation result = ClassificationTable_to_Correlation_columns (me);
692 CONVERT_EACH_TO_ONE_END (my name.get(), U"_col")
693 }
694
695 DIRECT (CONVERT_EACH_TO_ONE__ClassificationTable_to_Strings_maximumProbability) {
696 CONVERT_EACH_TO_ONE (ClassificationTable)
697 autoStrings result = ClassificationTable_to_Strings_maximumProbability (me);
698 CONVERT_EACH_TO_ONE_END (my name.get())
699 }
700
701 /********************** Confusion *******************************************/
702
703 DIRECT (HELP__Confusion_help) {
704 HELP (U"Confusion")
705 }
706
707 FORM (CREATE_ONE__Confusion_createSimple, U"Create simple Confusion", U"Create simple Confusion...") {
708 WORD (name, U"Name", U"simple")
709 SENTENCE (labels, U"Labels", U"u i a")
710 OK
711 DO
712 CREATE_ONE
713 autoConfusion result = Confusion_createSimple (labels);
714 CREATE_ONE_END (name)
715 }
716
717 FORM (MODIFY_Confusion_increase, U"Confusion: Increase", U"Confusion: Increase...") {
718 WORD (stimulus, U"Stimulus", U"u")
719 WORD (response, U"Response", U"i")
720 OK
721 DO
722 MODIFY_EACH (Confusion)
723 Confusion_increase (me, stimulus, response);
724 MODIFY_EACH_END
725 }
726
727 FORM (QUERY_ONE_FOR_REAL__Confusion_getValue_labels, U"Confusion: Get value", nullptr) {
728 WORD (stimulus, U"Stimulus", U"u")
729 WORD (response, U"Response", U"i")
730 OK
731 DO
732 QUERY_ONE_FOR_REAL (Confusion)
733 const double result = Confusion_getValue (me, stimulus, response);
734 QUERY_ONE_FOR_REAL_END (U" ([\"", stimulus, U"\", \"", response, U"\"])")
735 }
736
737 FORM (QUERY_ONE_FOR_REAL__Confusion_getResponseSum, U"Confusion: Get response sum", U"Confusion: Get response sum...") {
738 WORD (response, U"Response", U"u")
739 OK
740 DO
741 QUERY_ONE_FOR_REAL (TableOfReal)
742 const double result = TableOfReal_getColumnSumByLabel (me, response);
743 QUERY_ONE_FOR_REAL_END (U" (response sum)")
744 }
745
746 FORM (QUERY_ONE_FOR_REAL__Confusion_getStimulusSum, U"Confusion: Get stimulus sum", U"Confusion: Get stimulus sum...") {
747 WORD (stimulus, U"Stimulus", U"u")
748 OK
749 DO
750 QUERY_ONE_FOR_REAL (TableOfReal)
751 const double result = TableOfReal_getRowSumByLabel (me, stimulus);
752 QUERY_ONE_FOR_REAL_END (U" (stimulus sum)")
753 }
754
755 DIRECT (CONVERT_EACH_TO_ONE__Confusion_to_TableOfReal_marginals) {
756 CONVERT_EACH_TO_ONE (Confusion)
757 autoTableOfReal result = Confusion_to_TableOfReal_marginals (me);
758 CONVERT_EACH_TO_ONE_END (my name.get())
759 }
760
761 DIRECT (CONVERT_TWO_TO_ONE__Confusion_difference) {
762 CONVERT_TWO_TO_ONE (Confusion)
763 autoMatrix result = Confusion_difference (me, you);
764 CONVERT_TWO_TO_ONE_END (U"diffs")
765 }
766
767 FORM (CONVERT_EACH_TO_ONE__Confusion_condense, U"Confusion: Condense", U"Confusion: Condense...") {
768 SENTENCE (search_string, U"Search", U"^(u|i)$")
769 SENTENCE (replace_string, U"Replace", U"high")
770 INTEGER (replaceLimit, U"Replace limit", U"0 (= unlimited)")
771 CHOICEx (matchType, U"Search and replace are", 2, 0)
772 OPTION (U"literals")
773 OPTION (U"Regular Expressions")
774 OK
775 DO
776 CONVERT_EACH_TO_ONE (Confusion)
777 autoConfusion result = Confusion_condense (me, search_string, replace_string, replaceLimit, matchType == 2);
778 CONVERT_EACH_TO_ONE_END (my name.get(), U"_cnd")
779 }
780
781 FORM (CONVERT_EACH_TO_ONE__Confusion_group, U"Confusion: Group stimuli & responses", U"Confusion: Group...") {
782 SENTENCE (labels, U"Stimuli & Responses", U"u i")
783 SENTENCE (newLabel, U"New label", U"high")
784 INTEGER (newPosition, U"New label position", U"0 (= at start)")
785 OK
786 DO
787 CONVERT_EACH_TO_ONE (Confusion)
788 autoConfusion result = Confusion_group (me, labels, newLabel, newPosition);
789 CONVERT_EACH_TO_ONE_END (my name.get(), U"_sr", newLabel)
790 }
791
792 FORM (CONVERT_EACH_TO_ONE__Confusion_groupStimuli, U"Confusion: Group stimuli", U"Confusion: Group stimuli...") {
793 SENTENCE (stimuli_string, U"Stimuli", U"u i")
794 SENTENCE (newLabel, U"New label", U"high")
795 INTEGER (newPosition, U"New label position", U"0")
796 OK
797 DO
798 CONVERT_EACH_TO_ONE (Confusion)
799 autoConfusion result = Confusion_groupStimuli (me,stimuli_string, newLabel, newPosition);
800 CONVERT_EACH_TO_ONE_END (my name.get(), U"_s", newLabel);
801 }
802
803 FORM (CONVERT_EACH_TO_ONE__Confusion_groupResponses, U"Confusion: Group responses", U"Confusion: Group responses...") {
804 SENTENCE (responses_string, U"Responses", U"a i")
805 SENTENCE (newLabel, U"New label", U"front")
806 INTEGER (newPosition, U"New label position", U"0")
807 OK
808 DO
809 CONVERT_EACH_TO_ONE (Confusion)
810 autoConfusion result = Confusion_groupResponses (me, responses_string, newLabel, newPosition);
811 CONVERT_EACH_TO_ONE_END (my name.get(), U"_s", newLabel);
812 }
813
814 FORM (GRAPHICS_EACH__Confusion_drawAsNumbers, U"Confusion: Draw as numbers", nullptr) {
815 BOOLEAN (drawMarginals, U"Draw marginals", true)
816 CHOICE (format, U"Format", 3)
817 OPTION (U"decimal")
818 OPTION (U"exponential")
819 OPTION (U"free")
820 OPTION (U"rational")
821 NATURAL (precision, U"Precision", U"5")
822 OK
823 DO
824 GRAPHICS_EACH (Confusion)
825 Confusion_drawAsNumbers (me, GRAPHICS, drawMarginals, format, precision);
826 GRAPHICS_EACH_END
827 }
828
829 DIRECT (QUERY_ONE_FOR_REAL__Confusion_getFractionCorrect) {
830 QUERY_ONE_FOR_REAL (Confusion)
831 double result;
832 Confusion_getFractionCorrect (me, & result, nullptr);
833 QUERY_ONE_FOR_REAL_END (U" (fraction correct)")
834 }
835
836 DIRECT (MODIFY_Confusion_ClassificationTable_increaseConfusionCount) {
837 MODIFY_FIRST_OF_ONE_AND_ONE (Confusion, ClassificationTable)
838 Confusion_ClassificationTable_increase (me, you);
839 MODIFY_FIRST_OF_ONE_AND_ONE_END
840 }
841
842 /******************* Confusion & Matrix *************************************/
843
844 FORM (GRAPHICS_ONE_AND_ONE__Confusion_Matrix_draw, U"Confusion & Matrix: Draw confusions with arrows", nullptr) {
845 INTEGER (categoryPosition, U"Category position", U"0 (= all)")
846 REAL (lowerLevel, U"Lower level (%)", U"0")
847 REAL (xmin, U"left Horizontal range", U"0.0")
848 REAL (xmax, U"right Horizontal range", U"0.0")
849 REAL (ymin, U"left Vertical range", U"0.0")
850 REAL (ymax, U"right Vertical range", U"0.0")
851 BOOLEAN (garnish, U"Garnish", true)
852 OK
853 DO
854 Melder_require (categoryPosition >= 0, U"Your category position should be at least 0.");
855 GRAPHICS_ONE_AND_ONE (Confusion, Matrix)
856 Confusion_Matrix_draw (me, you, GRAPHICS, categoryPosition, lowerLevel, xmin, xmax, ymin, ymax, garnish);
857 GRAPHICS_ONE_AND_ONE_END
858 }
859
860 /********************** ComplexSpectrogram *******************************************/
861
862 DIRECT (HELP__ComplexSpectrogram_help) {
863 HELP (U"ComplexSpectrogram_help")
864 }
865
866 FORM (CONVERT_EACH_TO_ONE__ComplexSpectrogram_to_Sound, U"ComplexSpectrogram: To Sound", nullptr) {
867 POSITIVE (durationFactor, U"Duration factor", U"1.0")
868 OK
869 DO
870 CONVERT_EACH_TO_ONE (ComplexSpectrogram)
871 autoSound result = ComplexSpectrogram_to_Sound (me, durationFactor);
872 CONVERT_EACH_TO_ONE_END (my name.get())
873 }
874
875 DIRECT (CONVERT_EACH_TO_ONE__ComplexSpectrogram_downto_Spectrogram) {
876 CONVERT_EACH_TO_ONE (ComplexSpectrogram)
877 autoSpectrogram result = ComplexSpectrogram_to_Spectrogram (me);
878 CONVERT_EACH_TO_ONE_END (my name.get())
879 }
880
881 FORM (CONVERT_EACH_TO_ONE__ComplexSpectrogram_to_Spectrum_slice, U"ComplexSpectrogram: To Spectrum (slice)", nullptr) {
882 REAL (time, U"Time (s)", U"0.0")
883 OK
884 DO
885 CONVERT_EACH_TO_ONE (ComplexSpectrogram)
886 autoSpectrum result = ComplexSpectrogram_to_Spectrum (me, time);
887 CONVERT_EACH_TO_ONE_END (my name.get())
888 }
889
890 DIRECT (MODIFY_ComplexSpectrogram_Spectrogram_replaceAmplitudes) {
891 MODIFY_FIRST_OF_ONE_AND_ONE (ComplexSpectrogram, Spectrogram)
892 ComplexSpectrogram_Spectrogram_replaceAmplitudes (me, you);
893 MODIFY_FIRST_OF_ONE_AND_ONE_END
894 }
895
896 /********************** Correlation *******************************************/
897
898 FORM (CREATE_ONE__Correlation_createSimple, U"Create simple Correlation", U"Create simple Correlation...") {
899 WORD (name, U"Name", U"correlation")
900 REALVECTOR (correlations, U"Correlations", WHITESPACE_SEPARATED_, U"1.0 0.5 1.0")
901 REALVECTOR (centroid, U"Centroid", WHITESPACE_SEPARATED_, U"0.0 0.0")
902 NATURAL (numberOfObservations, U"Number of observations", U"100")
903 OK
904 DO
905 CREATE_ONE
906 autoCorrelation result = Correlation_createSimple (correlations, centroid, numberOfObservations);
907 CREATE_ONE_END (name)
908 }
909
910 DIRECT (HELP__Correlation_help) {
911 HELP (U"Correlation")
912 }
913
914 FORM (CONVERT_EACH_TO_ONE__Correlation_confidenceIntervals, U"Correlation: Confidence intervals...", U"Correlation: Confidence intervals...") {
915 POSITIVE (confidenceLevel, U"Confidence level (0-1)", U"0.95")
916 INTEGER (numberOfTests, U"Number of tests (Bonferroni correction)", U"0")
917 CHOICE (approximation, U"Approximation", 1)
918 OPTION (U"Ruben")
919 OPTION (U"Fisher")
920 OK
921 DO
922 CONVERT_EACH_TO_ONE (Correlation)
923 autoTableOfReal result = Correlation_confidenceIntervals (me, confidenceLevel, numberOfTests, approximation);
924 CONVERT_EACH_TO_ONE_END (my name.get(), U"_conf_intervals")
925 }
926
927 FORM (QUERY_ONE_FOR_REAL__Correlation_getDiagonality_bartlett, U"Correlation: Get diagonality (bartlett)", U"SSCP: Get diagonality (bartlett)...") {
928 NATURAL (numberOfConstraints, U"Number of constraints", U"1")
929 OK
930 DO
931 QUERY_ONE_FOR_REAL (Correlation)
932 double chisq, result, ndof;
933 Correlation_testDiagonality_bartlett (me, numberOfConstraints, & chisq, & result, & ndof);
934 QUERY_ONE_FOR_REAL_END (U" (probability, based on chisq = ", chisq, U" and ndf = ", ndof, U")")
935 }
936
937 DIRECT (CONVERT_EACH_TO_ONE__Correlation_to_PCA) {
938 CONVERT_EACH_TO_ONE (Correlation)
939 autoPCA result = SSCP_to_PCA (me);
940 CONVERT_EACH_TO_ONE_END (my name.get())
941 }
942
943 /********************** Covariance *******************************************/
944
945 DIRECT (HELP__Covariance_help) {
946 HELP (U"Covariance")
947 }
948
949 FORM (CREATE_ONE__Covariance_createSimple, U"Create simple Covariance", U"Create simple Covariance...") {
950 WORD (name, U"Name", U"c")
951 REALVECTOR (covariances, U"Covariances", WHITESPACE_SEPARATED_, U"1.0 0.0 1.0")
952 REALVECTOR (centroid, U"Centroid", WHITESPACE_SEPARATED_, U"0.0 0.0")
953 NATURAL (numberOfObservations, U"Number of observations", U"100")
954 OK
955 DO
956 CREATE_ONE
957 autoCovariance result = Covariance_createSimple (covariances, centroid, numberOfObservations);
958 CREATE_ONE_END (name)
959 }
960
961 FORM (QUERY_ONE_FOR_REAL__Covariance_getProbabilityAtPosition, U"Covariance: Get probability at position", nullptr) {
962 SENTENCE (position_string, U"Position", U"10.0 20.0")
963 OK
964 DO
965 QUERY_ONE_FOR_REAL (Covariance)
966 const double result = Covariance_getProbabilityAtPosition_string (me, position_string);
967 QUERY_ONE_FOR_REAL_END (U" (probability at position ", position_string, U")")
968 }
969
970 FORM (QUERY_ONE_FOR_REAL__Covariance_getSignificanceOfOneMean, U"Covariance: Get significance of one mean", U"Covariance: Get significance of one mean...") {
971 COMMENT (U"Get probability that the estimated mean for")
972 NATURAL (index, U"Index", U"1")
973 COMMENT (U"(or an estimated mean even further away)")
974 COMMENT (U"could arise if the true mean were")
975 REAL (value, U"Value", U"0.0")
976 OK
977 DO
978 QUERY_ONE_FOR_REAL (Covariance)
979 double result, t, ndof;
980 Covariance_getSignificanceOfOneMean (me, index, value, & result, & t, & ndof);
981 QUERY_ONE_FOR_REAL_END (U" (probability, based on t = ", t, U" and ndf = ", ndof)
982 }
983
984 FORM (QUERY_ONE_FOR_REAL__Covariance_getSignificanceOfMeansDifference, U"Covariance: Get significance of means difference", U"Covariance: Get significance of means difference...") {
985 COMMENT (U"Get probability that the estimated difference between the means for")
986 NATURAL (index1, U"Index1", U"1")
987 NATURAL (index2, U"Index2", U"2")
988 COMMENT (U"could arise if the true mean were")
989 REAL (value, U"Value", U"0.0")
990 COMMENT (U"Assume the means are ")
991 BOOLEAN (paired, U"Paired", true)
992 COMMENT (U"and have")
993 BOOLEAN (equalVariances, U"Equal variances", true)
994 OK
995 DO
996 QUERY_ONE_FOR_REAL (Covariance)
997 double result, t, ndof;
998 Covariance_getSignificanceOfMeansDifference (me, index1, index2, value, paired, equalVariances, & result, & t, & ndof);
999 QUERY_ONE_FOR_REAL_END (U" (probability, based on t = ", t, U" and ndf = ", ndof, U")")
1000 }
1001
1002 FORM (QUERY_ONE_FOR_REAL__Covariance_getSignificanceOfOneVariance, U"Covariance: Get significance of one variance", U"Covariance: Get significance of one variance...") {
1003 COMMENT (U"Get the probability that the estimated variance for")
1004 NATURAL (index, U"Index", U"1")
1005 COMMENT (U"(or an even larger estimated variance)")
1006 COMMENT (U"could arise if the true variance were")
1007 REAL (value, U"Value", U"0.0")
1008 OK
1009 DO
1010 QUERY_ONE_FOR_REAL (Covariance)
1011 double result, chisq, ndof;
1012 Covariance_getSignificanceOfOneVariance (me, index, value, & result, & chisq, & ndof);
1013 QUERY_ONE_FOR_REAL_END (U" (probability, based on chisq = ", chisq, U" and ndf = ", ndof, U")")
1014 }
1015
1016 FORM (QUERY_ONE_FOR_REAL__Covariance_getSignificanceOfVariancesRatio, U"Covariance: Get significance of variances ratio", nullptr) {
1017 COMMENT (U"Get the probability that the estimated variance ratio observed for")
1018 NATURAL (index1, U"Index1", U"1")
1019 NATURAL (index2, U"Index2", U"2")
1020 COMMENT (U"(or an estimated ratio even further away)")
1021 COMMENT (U"could arise if the true ratio were")
1022 REAL (value, U"Value", U"1.0")
1023 OK
1024 DO
1025 QUERY_ONE_FOR_REAL (Covariance)
1026 double result, f, ndof;
1027 Covariance_getSignificanceOfVariancesRatio (me, index1, index2, value, & result, & f , & ndof);
1028 QUERY_ONE_FOR_REAL_END (U" (probability, based on F = ", f, U" and ndf1 = ", ndof, U" and ndf2 = ", ndof, U")")
1029 }
1030
1031 FORM (QUERY_ONE_FOR_REAL__Covariance_getFractionVariance, U"Covariance: Get fraction variance", U"Covariance: Get fraction variance...") {
1032 NATURAL (fromDimension, U"From dimension", U"1")
1033 NATURAL (toDimension, U"To dimension", U"1")
1034 OK
1035 DO
1036 QUERY_ONE_FOR_REAL (Covariance)
1037 const double result = SSCP_getFractionVariation (me, fromDimension, toDimension);
1038 QUERY_ONE_FOR_REAL_END (U"")
1039 }
1040
1041 FORM (INFO_TWO__Covariances_reportMultivariateMeanDifference, U"Covariances: Report multivariate mean difference", U"Covariances: Report multivariate mean difference...") {
1042 COMMENT (U"Get probability that the estimated multivariate means difference could arise ")
1043 COMMENT (U"if the actual means were equal.")
1044 COMMENT (U"")
1045 COMMENT (U"Assume for both means we have")
1046 BOOLEAN (covariancesAreEqual, U"Equal covariances", true)
1047 OK
1048 DO
1049 INFO_TWO (Covariance)
1050 double prob, fisher, ndof1, ndof2, difference;
1051 MelderInfo_open ();
1052 difference = Covariances_getMultivariateCentroidDifference (me, you, covariancesAreEqual, & prob, & fisher, & ndof1, & ndof2);
1053 MelderInfo_writeLine (U"Under the assumption that the two covariances are", (covariancesAreEqual ? U" " : U" not "), U"equal:");
1054 MelderInfo_writeLine (U"Difference between multivariate means: ", difference);
1055 MelderInfo_writeLine (U"Fisher's F: ", fisher);
1056 MelderInfo_writeLine (U"Significance from zero: ", prob);
1057 MelderInfo_writeLine (U"Degrees of freedom 1: ", ndof1);
1058 MelderInfo_writeLine (U"Degrees of freedom 2: ", ndof2);
1059 MelderInfo_writeLine (U"Number of observations 1: ", me -> numberOfObservations);
1060 MelderInfo_writeLine (U"Number of observations 2: ", you -> numberOfObservations);
1061 MelderInfo_writeLine (U"Number of variables: ", me -> numberOfRows);
1062 MelderInfo_close ();
1063 INFO_TWO_END
1064 }
1065
1066 FORM (CONVERT_EACH_TO_ONE__Covariance_to_TableOfReal_randomSampling, U"Covariance: To TableOfReal (random sampling)", U"Covariance: To TableOfReal (random sampling)...") {
1067 INTEGER (numberOfDataPoints, U"Number of data points", U"0")
1068 OK
1069 DO
1070 CONVERT_EACH_TO_ONE (Covariance)
1071 autoTableOfReal result = Covariance_to_TableOfReal_randomSampling (me, numberOfDataPoints);
1072 CONVERT_EACH_TO_ONE_END (my name.get())
1073 }
1074
1075 DIRECT (INFO_NONE__Covariances_reportEquality) { //TODO 20210510 is this ok
1076 INFO_NONE
1077 autoCovarianceList covariances = CovarianceList_create ();
1078 LOOP {
1079 iam_LOOP (Covariance);
1080 covariances -> addItem_ref (me);
1081 }
1082 MelderInfo_open ();
1083 double p, chisq, ndof;
1084 Covariances_equality (covariances.get(), 1, & p, & chisq, & ndof);
1085 MelderInfo_writeLine (U"Difference between covariance matrices:");
1086 MelderInfo_writeLine (U"Significance of difference (bartlett) = ", p);
1087 MelderInfo_writeLine (U"Chi-squared (bartlett) = ", chisq);
1088 MelderInfo_writeLine (U"Degrees of freedom (bartlett) = ", ndof);
1089
1090 Covariances_equality (covariances.get(), 2, & p, & chisq, & ndof);
1091 MelderInfo_writeLine (U"Significance of difference (wald) = ", p);
1092 MelderInfo_writeLine (U"Chi-squared (wald) = ", chisq);
1093 MelderInfo_writeLine (U"Degrees of freedom (wald) = ", ndof);
1094 MelderInfo_close ();
1095 INFO_NONE_END
1096 }
1097
1098 DIRECT (CONVERT_EACH_TO_ONE__Covariance_to_Correlation) {
1099 CONVERT_EACH_TO_ONE (Covariance)
1100 autoCorrelation result = SSCP_to_Correlation (me);
1101 CONVERT_EACH_TO_ONE_END (my name.get())
1102 }
1103
1104 DIRECT (CONVERT_EACH_TO_ONE__Covariance_to_PCA) {
1105 CONVERT_EACH_TO_ONE (Covariance)
1106 autoPCA result = SSCP_to_PCA (me);
1107 CONVERT_EACH_TO_ONE_END (my name.get())
1108 }
1109
1110 DIRECT (COMBINE_ALL_LISTED_TO_ONE__Covariances_pool) {
1111 COMBINE_ALL_LISTED_TO_ONE (Covariance, CovarianceList)
1112 autoCovariance result = CovarianceList_to_Covariance_pool (list.get());
1113 COMBINE_ALL_LISTED_TO_ONE_END (U"pool")
1114 }
1115
1116 DIRECT (COMBINE_ALL_LISTED_TO_ONE__Covariances_to_Covariance_between) {
1117 COMBINE_ALL_LISTED_TO_ONE (Covariance, CovarianceList)
1118 autoCovariance result = CovarianceList_to_Covariance_between (list.get());
1119 COMBINE_ALL_LISTED_TO_ONE_END (U"between")
1120 }
1121
1122 DIRECT (COMBINE_ALL_LISTED_TO_ONE__Covariances_to_Covariance_within) {
1123 COMBINE_ALL_LISTED_TO_ONE (Covariance, CovarianceList)
1124 autoCovariance result = CovarianceList_to_Covariance_within (list.get());
1125 COMBINE_ALL_LISTED_TO_ONE_END (U"within")
1126 }
1127
1128 DIRECT (CREATE_ONE__Covariances_to_CovarianceList) {
1129 autoCovarianceList result = CovarianceList_create ();
1130 CREATE_ONE
1131 LOOP {
1132 iam_LOOP (Covariance);
1133 autoCovariance cov = Data_copy (me);
1134 result -> addItem_move (cov.move());
1135 }
1136 CREATE_ONE_END (U"List_of_", Melder_integer (result->size))
1137 }
1138
1139 FORM (CONVERT_ONE_AND_ONE_TO_ONE__Covariance_TableOfReal_mahalanobis, U"Covariance & TableOfReal: To TableOfReal (mahalanobis)", U"Covariance & TableOfReal: To TableOfReal (mahalanobis)...") {
1140 BOOLEAN (centroidFromTable, U"Centroid from table", false)
1141 OK
1142 DO
1143 CONVERT_ONE_AND_ONE_TO_ONE (Covariance, TableOfReal)
1144 autoTableOfReal result = Covariance_TableOfReal_mahalanobis (me, you, centroidFromTable);
1145 CONVERT_ONE_AND_ONE_TO_ONE_END (U"mahalanobis")
1146 }
1147
1148 /********************** Discriminant **********************************/
1149
1150 DIRECT (HELP__Discriminant_help) {
1151 HELP (U"Discriminant")
1152 }
1153
1154 DIRECT (MODIFY_FIRST_OF_ONE_AND_ONE__Discriminant_setGroupLabels) {
1155 MODIFY_FIRST_OF_ONE_AND_ONE (Discriminant, Strings)
1156 Discriminant_setGroupLabels (me, you);
1157 MODIFY_FIRST_OF_ONE_AND_ONE_END
1158 }
1159
1160 FORM (CONVERT_ONE_AND_ONE_TO_ONE__Discriminant_PatternList_to_Categories, U"Discriminant & PatternList: To Categories", U"Discriminant & PatternList: To Categories...") {
1161 BOOLEAN (poolCovariances, U"Pool covariance matrices", true)
1162 BOOLEAN (useAPrioriProbabilities, U"Use apriori probabilities", true)
1163 OK
1164 DO
1165 CONVERT_ONE_AND_ONE_TO_ONE (Discriminant, PatternList)
1166 autoCategories result = Discriminant_PatternList_to_Categories (me, you, poolCovariances, useAPrioriProbabilities);
1167 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
1168 }
1169
1170 FORM (CONVERT_ONE_AND_ONE_TO_ONE__Discriminant_TableOfReal_to_Configuration, U"Discriminant & TableOfReal: To Configuration", U"Discriminant & TableOfReal: To Configuration...") {
1171 INTEGER (numberOfDimensions, U"Number of dimensions", U"0 (=all)")
1172 OK
1173 DO
1174 Melder_require (numberOfDimensions >= 0,
1175 U"\"Number of dimensions\" should not be less than zero.");
1176 CONVERT_ONE_AND_ONE_TO_ONE (Discriminant, TableOfReal)
1177 autoConfiguration result = Discriminant_TableOfReal_to_Configuration (me, you, numberOfDimensions);
1178 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
1179 }
1180
1181 DIRECT (HINT__Discriminant_TableOfReal_to_ClassificationTable) {
1182 INFO_NONE
1183 Melder_information (U"You can use the Discriminant as a classifier by \nselecting a Discriminant and a TableOfReal object together.");
1184 INFO_NONE_END
1185 }
1186
1187 FORM (CONVERT_ONE_AND_ONE_TO_ONE__Discriminant_TableOfReal_to_ClassificationTable, U"Discriminant & TableOfReal: To ClassificationTable", U"Discriminant & TableOfReal: To ClassificationTable...") {
1188 BOOLEAN (poolCovariances, U"Pool covariance matrices", true)
1189 BOOLEAN (useAPrioriProbabilities, U"Use apriori probabilities", true)
1190 OK
1191 DO
1192 CONVERT_ONE_AND_ONE_TO_ONE (Discriminant, TableOfReal)
1193 autoClassificationTable result = Discriminant_TableOfReal_to_ClassificationTable (me, you,
1194 poolCovariances, useAPrioriProbabilities
1195 );
1196 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
1197 }
1198
1199 FORM (CONVERT_ONE_AND_ONE_TO_ONE__Discriminant_TableOfReal_mahalanobis, U"Discriminant & TableOfReal: To TableOfReal (mahalanobis)", U"Discriminant & TableOfReal: To TableOfReal (mahalanobis)...") {
1200 SENTENCE (groupLabel, U"Group label", U"")
1201 BOOLEAN (poolCovariances, U"Pool covariance matrices", false)
1202 OK
1203 DO
1204 CONVERT_ONE_AND_ONE_TO_ONE (Discriminant, TableOfReal)
1205 const integer group = Discriminant_groupLabelToIndex (me, groupLabel);
1206 Melder_require (group > 0,
1207 U"Your group label \"", groupLabel, U"\" does not exist.");
1208 autoTableOfReal result = Discriminant_TableOfReal_mahalanobis (me, you, group, poolCovariances);
1209 CONVERT_ONE_AND_ONE_TO_ONE_END (U"mahalanobis")
1210 }
1211
1212 FORM (CONVERT_ONE_AND_ONE_TO_ONE__Discriminant_TableOfReal_mahalanobis_all, U"Discriminant & TableOfReal: Mahalanobis all", nullptr) {
1213 BOOLEAN (poolCovariances, U"Pool covariance matrices", false)
1214 OK
1215 DO
1216 CONVERT_ONE_AND_ONE_TO_ONE (Discriminant, TableOfReal)
1217 autoTableOfReal result = Discriminant_TableOfReal_mahalanobis_all (me, you, poolCovariances);
1218 CONVERT_ONE_AND_ONE_TO_ONE_END (U"mahalanobis")
1219 }
1220
1221 DIRECT (QUERY_ONE_FOR_INTEGER__Discriminant_getNumberOfEigenvalues) {
1222 QUERY_ONE_FOR_INTEGER (Discriminant)
1223 const integer result = my eigen -> numberOfEigenvalues;
1224 QUERY_ONE_FOR_INTEGER_END (U" (number of eigenvalues)")
1225 }
1226
1227 DIRECT (QUERY_ONE_FOR_INTEGER__Discriminant_getNumberOfEigenvectors) {
1228 QUERY_ONE_FOR_INTEGER (Discriminant)
1229 const integer result = my eigen -> numberOfEigenvalues;
1230 QUERY_ONE_FOR_INTEGER_END (U" (number of eigenvectors)")
1231 }
1232
1233 DIRECT (QUERY_ONE_FOR_INTEGER__Discriminant_getEigenvectorDimension) {
1234 QUERY_ONE_FOR_INTEGER (Discriminant)
1235 const integer result = my eigen -> dimension;
1236 QUERY_ONE_FOR_INTEGER_END (U" (dimension)")
1237 }
1238
1239 FORM (QUERY_ONE_FOR_REAL__Discriminant_getEigenvalue, U"Discriminant: Get eigenvalue", U"Eigen: Get eigenvalue...") {
1240 NATURAL (eigenvalueNumber, U"Eigenvalue number", U"1")
1241 OK
1242 DO
1243 QUERY_ONE_FOR_REAL (Discriminant)
1244 Melder_require (eigenvalueNumber <= my eigen -> numberOfEigenvalues,
1245 U"Eigenvalue number should be smaller than ", my eigen -> numberOfEigenvalues + 1);
1246 const double result = my eigen -> eigenvalues [eigenvalueNumber];
1247 QUERY_ONE_FOR_REAL_END (U" (eigenvalue [", eigenvalueNumber, U"])")
1248 }
1249
1250 FORM (QUERY_ONE_FOR_REAL__Discriminant_getSumOfEigenvalues, U"Discriminant:Get sum of eigenvalues", U"Eigen: Get sum of eigenvalues...") {
1251 INTEGER (fromEigenvalue, U"left Eigenvalue range", U"0")
1252 INTEGER (toEigenvalue, U"right Eigenvalue range", U"0")
1253 OK
1254 DO
1255 QUERY_ONE_FOR_REAL (Discriminant)
1256 const double result = Eigen_getSumOfEigenvalues (my eigen.get(), fromEigenvalue, toEigenvalue);
1257 QUERY_ONE_FOR_REAL_END (U"")
1258 }
1259
1260 FORM (QUERY_ONE_FOR_REAL__Discriminant_getEigenvectorElement, U"Discriminant: Get eigenvector element", U"Eigen: Get eigenvector element...") {
1261 NATURAL (eigenvectorNumber, U"Eigenvector number", U"1")
1262 NATURAL (elementNumber, U"Element number", U"1")
1263 OK
1264 DO
1265 QUERY_ONE_FOR_REAL (Discriminant)
1266 const double result = Eigen_getEigenvectorElement (my eigen.get(), eigenvectorNumber, elementNumber);
1267 QUERY_ONE_FOR_REAL_END (U"")
1268 }
1269
1270 FORM (QUERY_ONE_FOR_REAL__Discriminant_getWilksLambda, U"Discriminant: Get Wilks' lambda", U"Discriminant: Get Wilks' lambda...") {
1271 COMMENT (U"Product (i=from..numberOfEigenvalues, 1 / (1 + eigenvalue[i]))")
1272 NATURAL (from, U"From", U"1") //TODO better name
1273 OK
1274 DO
1275 QUERY_ONE_FOR_REAL (Discriminant)
1276 const double result = Discriminant_getWilksLambda (me, from);
1277 QUERY_ONE_FOR_REAL_END (U" (wilks lambda)")
1278 }
1279
1280 FORM (QUERY_ONE_FOR_REAL__Discriminant_getCumulativeContributionOfComponents, U"Discriminant: Get cumulative contribution of components", U"Eigen: Get cumulative contribution of components...") {
1281 NATURAL (fromComponent, U"From component", U"1")
1282 NATURAL (toComponent, U"To component", U"1")
1283 OK
1284 DO
1285 QUERY_ONE_FOR_REAL (Discriminant)
1286 const double result = Eigen_getCumulativeContributionOfComponents (my eigen.get(), fromComponent, toComponent);
1287 QUERY_ONE_FOR_REAL_END (U" (cumulative contribution)")
1288 }
1289
1290 FORM (QUERY_ONE_FOR_REAL__Discriminant_getPartialDiscriminationProbability, U"Discriminant: Get partial discrimination probability", U"Discriminant: Get partial discrimination probability...") {
1291 INTEGER (numberOfDimensions, U"Number of dimensions", U"1")
1292 OK
1293 DO
1294 Melder_require (numberOfDimensions >= 0,
1295 U"The number of dimensions should be at least zero.");
1296 QUERY_ONE_FOR_REAL (Discriminant)
1297 double result, chisq, ndof;
1298 Discriminant_getPartialDiscriminationProbability (me, numberOfDimensions, & result, & chisq, & ndof);
1299 QUERY_ONE_FOR_REAL_END (U" (= probability, based on chisq = ", chisq, U" and ndf = ", ndof, U")");
1300 }
1301
1302 DIRECT (QUERY_ONE_FOR_REAL__Discriminant_getHomegeneityOfCovariances_box) {
1303 QUERY_ONE_FOR_REAL (Discriminant)
1304 double chisq, result, ndof;
1305 SSCPList_getHomegeneityOfCovariances_box (my groups.get(), & result, & chisq, & ndof);
1306 QUERY_ONE_FOR_REAL_END (U" (= probability, based on chisq = ", chisq, U" and ndf = ", ndof, U")")
1307 }
1308
1309 DIRECT (INFO_ONE__Discriminant_reportEqualityOfCovarianceMatrices) {
1310 INFO_ONE (Discriminant)
1311 MelderInfo_open ();
1312 structCovarianceList list;
1313 for (integer i = 1; i <= my groups->size; i ++) {
1314 SSCP sscp = my groups->at [i];
1315 autoCovariance covariance = SSCP_to_Covariance (sscp, 1); // FIXME numberOfConstraints shouldn't be 1, should it?
1316 list. addItem_move (covariance.move());
1317 }
1318 double chisq, prob, ndof;
1319 Covariances_equality (& list, 2, & prob, & chisq, & ndof);
1320 MelderInfo_writeLine (U"Wald test for equality of covariance matrices:");
1321 MelderInfo_writeLine (U"Chi squared: ", chisq);
1322 MelderInfo_writeLine (U"Significance: ", prob);
1323 MelderInfo_writeLine (U"Degrees of freedom: ", ndof);
1324 MelderInfo_writeLine (U"Number of matrices: ", list.size);
1325 MelderInfo_close ();
1326 INFO_NONE_END
1327 }
1328
1329 FORM (QUERY_ONE_FOR_REAL__Discriminant_getSigmaEllipseArea, U"Discriminant: Get concentration ellipse area", U"Discriminant: Get concentration ellipse area...") {
1330 SENTENCE (groupLabel, U"Group label", U"")
1331 POSITIVE (numberOfSigmas, U"Number of sigmas", U"1.0")
1332 BOOLEAN (discriminatPlane, U"Discriminant plane", true)
1333 INTEGER (xDimension, U"X-dimension", U"1")
1334 INTEGER (yDimension, U"Y-dimension", U"2")
1335 OK
1336 DO
1337 QUERY_ONE_FOR_REAL (Discriminant)
1338 const integer group = Discriminant_groupLabelToIndex (me, groupLabel);
1339 Melder_require (group > 0,
1340 U"The group label \"", groupLabel, U"\" does not exist.");
1341 const double result = Discriminant_getConcentrationEllipseArea (me, group, numberOfSigmas, false,
1342 discriminatPlane, xDimension, yDimension
1343 );
1344 QUERY_ONE_FOR_REAL_END (U" (concentration ellipse area)")
1345 }
1346
1347 FORM (QUERY_ONE_FOR_REAL__Discriminant_getConfidenceEllipseArea, U"Discriminant: Get confidence ellipse area", U"Discriminant: Get confidence ellipse area...") {
1348 SENTENCE (groupLabel, U"Group label", U"")
1349 POSITIVE (confidenceLevel, U"Confidence level (0-1)", U"0.95")
1350 BOOLEAN (discriminatPlane, U"Discriminant plane", true)
1351 INTEGER (xDimension, U"X-dimension", U"1")
1352 INTEGER (yDimension, U"Y-dimension", U"2")
1353 OK
1354 DO
1355 QUERY_ONE_FOR_REAL (Discriminant)
1356 const integer group = Discriminant_groupLabelToIndex (me, groupLabel);
1357 Melder_require (group > 0,
1358 U"The group label \"", groupLabel, U"\" does not exist.");
1359 const double result = Discriminant_getConcentrationEllipseArea (me, group, confidenceLevel, true,
1360 discriminatPlane, xDimension, yDimension
1361 );
1362 QUERY_ONE_FOR_REAL_END (U" (confidence ellipse area)")
1363 }
1364
1365 FORM (QUERY_ONE_FOR_REAL__Discriminant_getLnDeterminant_group, U"Discriminant: Get determinant (group)", U"Discriminant: Get determinant (group)...")
1366 SENTENCE (groupLabel, U"Group label", U"") {
1367 OK
1368 DO
1369 QUERY_ONE_FOR_REAL (Discriminant)
1370 const integer group = Discriminant_groupLabelToIndex (me, groupLabel);
1371 Melder_require (group > 0,
1372 U"The group label \"", groupLabel, U"\" does not exist.");
1373 const double result = Discriminant_getLnDeterminant_group (me, group);
1374 QUERY_ONE_FOR_REAL_END (U" (ln(determinant) group")
1375 }
1376
1377 DIRECT (QUERY_ONE_FOR_REAL__Discriminant_getLnDeterminant_total) {
1378 QUERY_ONE_FOR_REAL (Discriminant)
1379 const double result = Discriminant_getLnDeterminant_total (me);
1380 QUERY_ONE_FOR_REAL_END (U" (ln(determinant) total")
1381 }
1382
1383 FORM (MODIFY_Discriminant_invertEigenvector, U"Discriminant: Invert eigenvector", nullptr) {
1384 NATURAL (eigenvectorNumber, U"Eigenvector number", U"1")
1385 OK
1386 DO
1387 MODIFY_EACH (Discriminant)
1388 Eigen_invertEigenvector (my eigen.get(), eigenvectorNumber);
1389 MODIFY_EACH_END
1390 }
1391
1392 FORM (GRAPHICS_EACH__Discriminant_drawEigenvalues, U"Discriminant: Draw eigenvalues", U"Eigen: Draw eigenvalues...") {
1393 INTEGER (fromEigenvalue, U"left Eigenvalue range", U"0")
1394 INTEGER (toEigenvalue, U"right Eigenvalue range", U"0")
1395 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
1396 REAL (toAmplitude, U"right Amplitude range", U"0.0")
1397 BOOLEAN (showFractions, U"Fraction of eigenvalues summed", false)
1398 BOOLEAN (showCumulativeValues, U"Cumulative", false)
1399 POSITIVE (markSize_mm, U"Mark size (mm)", U"1.0")
1400 SENTENCE (mark_string, U"Mark string (+xo.)", U"+")
1401 BOOLEAN (garnish, U"Garnish", true)
1402 OK
1403 DO
1404 GRAPHICS_EACH (Discriminant)
1405 Eigen_drawEigenvalues (my eigen.get(), GRAPHICS, fromEigenvalue, toEigenvalue, fromAmplitude, toAmplitude,
1406 showFractions, showCumulativeValues, markSize_mm, mark_string, garnish
1407 );
1408 GRAPHICS_EACH_END
1409 }
1410
1411 FORM (GRAPHICS_EACH__Discriminant_drawEigenvector, U"Discriminant: Draw eigenvector", U"Eigen: Draw eigenvector...") {
1412 INTEGER (eigenvectorNumber, U"Eigenvector number", U"1")
1413 BOOLEAN (componentLoadings, U"Component loadings", false)
1414 INTEGER (fromElement, U"left Element range", U"0")
1415 INTEGER (toElement, U"right Element range", U"0")
1416 REAL (fromAmplitude, U"left Amplitude range", U"-1.0")
1417 REAL (toAmplitude, U"right Amplitude range", U"1.0")
1418 POSITIVE (markSize_mm, U"Mark size (mm)", U"1.0")
1419 SENTENCE (mark_string, U"Mark string (+xo.)", U"+")
1420 BOOLEAN (connectPoints, U"Connect points", true)
1421 BOOLEAN (garnish, U"Garnish", true)
1422 OK
1423 DO
1424 GRAPHICS_EACH (Discriminant)
1425 Eigen_drawEigenvector (my eigen.get(), GRAPHICS, eigenvectorNumber, fromElement, toElement,
1426 fromAmplitude, toAmplitude, componentLoadings, markSize_mm, mark_string, connectPoints,
1427 nullptr, garnish
1428 );
1429 GRAPHICS_EACH_END
1430 }
1431
1432 FORM (GRAPHICS_EACH__Discriminant_drawSigmaEllipses, U"Discriminant: Draw sigma ellipses", U"Discriminant: Draw sigma ellipses...") {
1433 POSITIVE (numberOfSigmas, U"Number of sigmas", U"1.0")
1434 BOOLEAN (discriminantPlane, U"Discriminant plane", true)
1435 INTEGER (xDimension, U"X-dimension", U"1")
1436 INTEGER (yDimension, U"Y-dimension", U"2")
1437 REAL (xmin, U"left Horizontal range", U"0.0")
1438 REAL (xmax, U"right Horizontal range", U"0.0")
1439 REAL (ymin, U"left Vertical range", U"0.0")
1440 REAL (ymax, U"right Vertical range", U"0.0")
1441 POSITIVE (labelSize, U"Label size", U"12")
1442 BOOLEAN (garnish, U"Garnish", true)
1443 OK
1444 DO
1445 GRAPHICS_EACH (Discriminant)
1446 Discriminant_drawConcentrationEllipses (me, GRAPHICS, numberOfSigmas, false, nullptr, discriminantPlane,
1447 xDimension, yDimension,xmin, xmax, ymin, ymax, labelSize, garnish
1448 );
1449 GRAPHICS_EACH_END
1450 }
1451
1452 FORM (GRAPHICS_EACH__Discriminant_drawOneSigmaEllipse, U"Discriminant: Draw one sigma ellipse", U"Discriminant: Draw one sigma ellipse...") {
1453 SENTENCE (label, U"Label", U"")
1454 POSITIVE (numberOfSigmas, U"Number of sigmas", U"1.0")
1455 BOOLEAN (discriminantPlane, U"Discriminant plane", true)
1456 INTEGER (xDimension, U"X-dimension", U"1")
1457 INTEGER (yDimension, U"Y-dimension", U"2")
1458 REAL (xmin, U"left Horizontal range", U"0.0")
1459 REAL (xmax, U"right Horizontal range", U"0.0")
1460 REAL (ymin, U"left Vertical range", U"0.0")
1461 REAL (ymax, U"right Vertical range", U"0.0")
1462 POSITIVE (labelSize, U"Label size", U"12")
1463 BOOLEAN (garnish, U"Garnish", true)
1464 OK
1465 DO
1466 GRAPHICS_EACH (Discriminant)
1467 Discriminant_drawConcentrationEllipses (me, GRAPHICS, numberOfSigmas, false, label, discriminantPlane,
1468 xDimension, yDimension, xmin, xmax, ymin, ymax, labelSize, garnish
1469 );
1470 GRAPHICS_EACH_END
1471 }
1472
1473 FORM (GRAPHICS_EACH__Discriminant_drawConfidenceEllipses, U"Discriminant: Draw confidence ellipses", nullptr) {
1474 POSITIVE (confidenceLevel, U"Confidence level (0-1)", U"0.95")
1475 BOOLEAN (discriminantPlane, U"Discriminant plane", true)
1476 INTEGER (xDimension, U"X-dimension", U"1")
1477 INTEGER (yDimension, U"Y-dimension", U"2")
1478 REAL (xmin, U"left Horizontal range", U"0.0")
1479 REAL (xmax, U"right Horizontal range", U"0.0")
1480 REAL (ymin, U"left Vertical range", U"0.0")
1481 REAL (ymax, U"right Vertical range", U"0.0")
1482 POSITIVE (labelSize, U"Label size", U"12")
1483 BOOLEAN (garnish, U"Garnish", true)
1484 OK
1485 DO
1486 GRAPHICS_EACH (Discriminant)
1487 Discriminant_drawConcentrationEllipses (me, GRAPHICS, confidenceLevel, true, nullptr, discriminantPlane,
1488 xDimension, yDimension, xmin, xmax, ymin, ymax, labelSize, garnish
1489 );
1490 GRAPHICS_EACH_END
1491 }
1492
1493 FORM (GRAPHICS_EACH__Discriminant_drawOneConfidenceEllipse, U"Discriminant: Draw one confidence ellipse", nullptr) {
1494 SENTENCE (label, U"Label", U"")
1495 POSITIVE (confidenceLevel, U"Confidence level (0-1)", U"0.95")
1496 BOOLEAN (discriminantPlane, U"Discriminant plane", true)
1497 INTEGER (xDimension, U"X-dimension", U"1")
1498 INTEGER (yDimension, U"Y-dimension", U"2")
1499 REAL (xmin, U"left Horizontal range", U"0.0")
1500 REAL (xmax, U"right Horizontal range", U"0.0")
1501 REAL (ymin, U"left Vertical range", U"0.0")
1502 REAL (ymax, U"right Vertical range", U"0.0")
1503 POSITIVE (labelSize, U"Label size", U"12")
1504 BOOLEAN (garnish, U"Garnish", true)
1505 OK
1506 DO
1507 GRAPHICS_EACH (Discriminant)
1508 Discriminant_drawConcentrationEllipses (me, GRAPHICS, confidenceLevel, true, label, discriminantPlane,
1509 xDimension, yDimension, xmin, xmax, ymin, ymax, labelSize, garnish
1510 );
1511 GRAPHICS_EACH_END
1512 }
1513
1514 DIRECT (CONVERT_EACH_TO_ONE__Discriminant_extractBetweenGroupsSSCP) {
1515 CONVERT_EACH_TO_ONE (Discriminant)
1516 autoSSCP result = Discriminant_extractBetweenGroupsSSCP (me);
1517 CONVERT_EACH_TO_ONE_END (my name.get(), U"_between")
1518 }
1519
1520 DIRECT (CONVERT_EACH_TO_ONE__Discriminant_extractGroupCentroids) {
1521 CONVERT_EACH_TO_ONE (Discriminant)
1522 autoTableOfReal result = Discriminant_extractGroupCentroids (me);
1523 CONVERT_EACH_TO_ONE_END (my name.get(), U"_centroids")
1524 }
1525
1526 DIRECT (CONVERT_EACH_TO_ONE__Discriminant_extractGroupStandardDeviations) {
1527 CONVERT_EACH_TO_ONE (Discriminant)
1528 autoTableOfReal result = Discriminant_extractGroupStandardDeviations (me);
1529 CONVERT_EACH_TO_ONE_END (U"group_stddevs")
1530 }
1531
1532 DIRECT (CONVERT_EACH_TO_ONE__Discriminant_extractGroupLabels) {
1533 CONVERT_EACH_TO_ONE (Discriminant)
1534 autoStrings result = Discriminant_extractGroupLabels (me);
1535 CONVERT_EACH_TO_ONE_END (U"group_labels")
1536 }
1537
1538 DIRECT (CONVERT_EACH_TO_ONE__Discriminant_extractEigen) {
1539 CONVERT_EACH_TO_ONE (Discriminant)
1540 autoEigen result = Data_copy (my eigen.get());
1541 CONVERT_EACH_TO_ONE_END (my name.get())
1542 }
1543
1544 DIRECT (CONVERT_EACH_TO_ONE__Discriminant_extractPooledWithinGroupsSSCP) {
1545 CONVERT_EACH_TO_ONE (Discriminant)
1546 autoSSCP result = Discriminant_extractPooledWithinGroupsSSCP (me);
1547 CONVERT_EACH_TO_ONE_END (U"pooled_within")
1548 }
1549
1550 FORM (CONVERT_EACH_TO_ONE__Discriminant_extractWithinGroupSSCP, U"Discriminant: Extract within-group SSCP", U"Discriminant: Extract within-group SSCP...") {
1551 NATURAL (groupIndex, U"Group index", U"1")
1552 OK
1553 DO
1554 CONVERT_EACH_TO_ONE (Discriminant)
1555 autoSSCP result = Discriminant_extractWithinGroupSSCP (me, groupIndex);
1556 CONVERT_EACH_TO_ONE_END (my name.get(), U"_g", groupIndex)
1557 }
1558
1559 DIRECT (QUERY_ONE_FOR_INTEGER__Discriminant_getNumberOfFunctions) {
1560 QUERY_ONE_FOR_INTEGER (Discriminant)
1561 const integer result = Discriminant_getNumberOfFunctions (me);
1562 QUERY_ONE_FOR_INTEGER_END (U"")
1563 }
1564
1565 DIRECT (QUERY_ONE_FOR_INTEGER__Discriminant_getDimensionOfFunctions) {
1566 QUERY_ONE_FOR_INTEGER (Discriminant)
1567 const integer result = Eigen_getDimensionOfComponents (my eigen.get());
1568 QUERY_ONE_FOR_INTEGER_END (U"")
1569 }
1570
1571 DIRECT (QUERY_ONE_FOR_INTEGER__Discriminant_getNumberOfGroups) {
1572 QUERY_ONE_FOR_INTEGER (Discriminant)
1573 const integer result = Discriminant_getNumberOfGroups (me);
1574 QUERY_ONE_FOR_INTEGER_END (U"")
1575 }
1576
1577 FORM (QUERY_ONE_FOR_INTEGER__Discriminant_getNumberOfObservations, U"Discriminant: Get number of observations", U"Discriminant: Get number of observations...") {
1578 INTEGER (group, U"Group", U"0 (= total)")
1579 OK
1580 DO
1581 QUERY_ONE_FOR_INTEGER (Discriminant)
1582 const integer result = Discriminant_getNumberOfObservations (me, group);
1583 QUERY_ONE_FOR_INTEGER_END (U"")
1584 }
1585
1586
1587 /********************** DTW *******************************************/
1588
1589 FORM (MODIFY_DTW_Polygon_findPathInside, U"DTW & Polygon: Find path inside", nullptr) {
1590 CHOICE (slopeConstraint, U"Slope constraint", 1)
1591 OPTION (U"no restriction")
1592 OPTION (U"1/3 < slope < 3")
1593 OPTION (U"1/2 < slope < 2")
1594 OPTION (U"2/3 < slope < 3/2")
1595 OK
1596 DO
1597 MODIFY_FIRST_OF_ONE_AND_ONE (DTW, Polygon)
1598 DTW_Polygon_findPathInside (me, you, slopeConstraint, nullptr);
1599 MODIFY_FIRST_OF_ONE_AND_ONE_END
1600 }
1601
1602 FORM (CONVERT_ONE_AND_ONE_TO_ONE__DTW_Polygon_to_Matrix_cumulativeDistances, U"DTW & Polygon: To Matrix (cum. distances)", nullptr) {
1603 CHOICE (slopeConstraint, U"Slope constraint", 1)
1604 OPTION (U"no restriction")
1605 OPTION (U"1/3 < slope < 3")
1606 OPTION (U"1/2 < slope < 2")
1607 OPTION (U"2/3 < slope < 3/2")
1608 OK
1609 DO
1610 CONVERT_ONE_AND_ONE_TO_ONE (DTW, Polygon)
1611 autoMatrix result = DTW_Polygon_to_Matrix_cumulativeDistances (me, you, slopeConstraint);
1612 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", slopeConstraint);
1613 }
1614
1615 FORM (GRAPHICS_TWO_AND_ONE__DTW_Sounds_draw, U"DTW & Sounds: Draw", U"DTW & Sounds: Draw...") {
1616 REAL (xmin, U"left Horizontal range", U"0.0")
1617 REAL (xmax, U"right Horizontal range", U"0.0")
1618 REAL (ymin, U"left Vertical range", U"0.0")
1619 REAL (ymax, U"right Vertical range", U"0.0")
1620 BOOLEAN (garnish, U"Garnish", true)
1621 OK
1622 DO
1623 GRAPHICS_TWO_AND_ONE (Sound, DTW)
1624 DTW_Sounds_draw (him, you, me, GRAPHICS, xmin, xmax, ymin, ymax, garnish);
1625 GRAPHICS_TWO_AND_ONE_END
1626 }
1627
1628 FORM (GRAPHICS_TWO_AND_ONE__DTW_Sounds_drawWarp_x, U"DTW & Sounds: Draw warp (x)", U"DTW & Sounds: Draw warp (x)...") {
1629 REAL (xmin, U"left Horizontal range", U"0.0")
1630 REAL (xmax, U"right Horizontal range", U"0.0")
1631 REAL (ymin, U"left Vertical range", U"0.0")
1632 REAL (ymax, U"right Vertical range", U"0.0")
1633 REAL (time, U"Time (s)", U"0.1")
1634 BOOLEAN (garnish, U"Garnish", true)
1635 OK
1636 DO
1637 GRAPHICS_TWO_AND_ONE (Sound, DTW)
1638 DTW_Sounds_drawWarpX (him, you, me, GRAPHICS, xmin, xmax, ymin, ymax, time, garnish);
1639 GRAPHICS_TWO_AND_ONE_END
1640 }
1641
1642 DIRECT (HELP__DTW_help) {
1643 HELP (U"DTW")
1644 }
1645
1646 FORM (GRAPHICS_EACH__DTW_drawPath, U"DTW: Draw path", nullptr) {
1647 REAL (xmin, U"left Horizontal range", U"0.0")
1648 REAL (xmax, U"right Horizontal range", U"0.0")
1649 REAL (ymin, U"left Vertical range", U"0.0")
1650 REAL (ymax, U"right Vertical range", U"0.0")
1651 BOOLEAN (garnish, U"Garnish", false);
1652 OK
1653 DO
1654 GRAPHICS_EACH (DTW)
1655 DTW_drawPath (me, GRAPHICS, xmin, xmax, ymin, ymax, garnish);
1656 GRAPHICS_EACH_END
1657 }
1658
1659 FORM (GRAPHICS_EACH__DTW_drawDistancesAlongPath, U"DTW: Draw distances along path", nullptr) {
1660 REAL (xmin, U"left Horizontal range", U"0.0")
1661 REAL (xmax, U"right Horizontal range", U"0.0")
1662 REAL (ymin, U"left Vertical range", U"0.0")
1663 REAL (ymax, U"right Vertical range", U"0.0")
1664 BOOLEAN (garnish, U"Garnish", false);
1665 OK
1666 DO
1667 GRAPHICS_EACH (DTW)
1668 DTW_drawDistancesAlongPath (me, GRAPHICS, xmin, xmax, ymin, ymax, garnish);
1669 GRAPHICS_EACH_END
1670 }
1671
1672 FORM (GRAPHICS_EACH__DTW_paintDistances, U"DTW: Paint distances", nullptr) {
1673 REAL (xmin, U"left Horizontal range", U"0.0")
1674 REAL (xmax, U"right Horizontal range", U"0.0")
1675 REAL (ymin, U"left Vertical range", U"0.0")
1676 REAL (ymax, U"right Vertical range", U"0.0")
1677 REAL (minimum, U"Minimum", U"0.0")
1678 REAL (maximum, U"Maximum", U"0.0")
1679 BOOLEAN (garnish, U"Garnish", false);
1680 OK
1681 DO
1682 GRAPHICS_EACH (DTW)
1683 DTW_paintDistances (me, GRAPHICS, xmin, xmax, ymin, ymax, minimum, maximum, garnish);
1684 GRAPHICS_EACH_END
1685 }
1686
1687 FORM (GRAPHICS_EACH__DTW_drawWarp_x, U"DTW: Draw warp (x)", U"DTW: Draw warp (x)...") {
1688 REAL (xmin, U"left Horizontal range", U"0.0")
1689 REAL (xmax, U"right Horizontal range", U"0.0")
1690 REAL (ymin, U"left Vertical range", U"0.0")
1691 REAL (ymax, U"right Vertical range", U"0.0")
1692 REAL (time, U"Time (s)", U"0.1")
1693 BOOLEAN (garnish, U"Garnish", false);
1694 OK
1695 DO
1696 GRAPHICS_EACH (DTW)
1697 DTW_drawWarpX (me, GRAPHICS, xmin, xmax, ymin, ymax, time, garnish);
1698 GRAPHICS_EACH_END
1699 }
1700
1701
1702 FORM (GRAPHICS_EACH__DTW_drawWarp_y, U"DTW: Draw warp (y)", U"DTW: Draw warp (y)...") {
1703 REAL (xmin, U"left Horizontal range", U"0.0")
1704 REAL (xmax, U"right Horizontal range", U"0.0")
1705 REAL (ymin, U"left Vertical range", U"0.0")
1706 REAL (ymax, U"right Vertical range", U"0.0")
1707 REAL (time, U"Time (s)", U"0.1")
1708 BOOLEAN (garnish, U"Garnish", false);
1709 OK
1710 DO
1711 GRAPHICS_EACH (DTW)
1712 DTW_drawWarpY (me, GRAPHICS, xmin, xmax, ymin, ymax, time, garnish);
1713 GRAPHICS_EACH_END
1714 }
1715
1716 DIRECT (QUERY_ONE_FOR_REAL__DTW_getStartTime_x) {
1717 QUERY_ONE_FOR_REAL (DTW)
1718 const double result = my xmin;
1719 QUERY_ONE_FOR_REAL_END (U" seconds (start time along x)")
1720 }
1721
1722 DIRECT (QUERY_ONE_FOR_REAL__DTW_getEndTime_x) {
1723 QUERY_ONE_FOR_REAL (DTW)
1724 const double result = my xmax;
1725 QUERY_ONE_FOR_REAL_END (U" seconds (end time along x)");
1726 }
1727
1728 DIRECT (QUERY_ONE_FOR_REAL__DTW_getTotalDuration_x) {
1729 QUERY_ONE_FOR_REAL (DTW)
1730 const double result = my xmax - my xmin;
1731 QUERY_ONE_FOR_REAL_END (U" seconds (total duration along x)");
1732 }
1733
1734 DIRECT (QUERY_ONE_FOR_REAL__DTW_getStartTime_y) {
1735 QUERY_ONE_FOR_REAL (DTW)
1736 const double result = my ymin;
1737 QUERY_ONE_FOR_REAL_END (U" seconds (start time along y)");
1738 }
1739
1740 DIRECT (QUERY_ONE_FOR_REAL__DTW_getEndTime_y) {
1741 QUERY_ONE_FOR_REAL (DTW)
1742 const double result = my ymax;
1743 QUERY_ONE_FOR_REAL_END (U" seconds (end time along y)");
1744 }
1745
1746 DIRECT (QUERY_ONE_FOR_REAL__DTW_getTotalDuration_y) {
1747 QUERY_ONE_FOR_REAL (DTW)
1748 const double result = my ymax - my ymin;
1749 QUERY_ONE_FOR_REAL_END (U" seconds (total duration along y)")
1750 }
1751
1752 DIRECT (QUERY_ONE_FOR_INTEGER__DTW_getNumberOfFrames_x) {
1753 QUERY_ONE_FOR_INTEGER (DTW)
1754 const integer result = my nx;
1755 QUERY_ONE_FOR_INTEGER_END (U" frames along x")
1756 }
1757
1758 DIRECT (QUERY_ONE_FOR_REAL__DTW_getTimeStep_x) {
1759 QUERY_ONE_FOR_REAL (DTW)
1760 const double result = my dx;
1761 QUERY_ONE_FOR_REAL_END (U" seconds (time step along x)")
1762 }
1763
1764 FORM (QUERY_ONE_FOR_REAL__DTW_getTimeFromFrameNumber_x, U"DTW: Get time from frame number (x)", nullptr) {
1765 NATURAL (frameNumber, U"Frame number (x)", U"1")
1766 OK
1767 DO
1768 QUERY_ONE_FOR_REAL (DTW)
1769 const double result = Matrix_columnToX (me, frameNumber);
1770 QUERY_ONE_FOR_REAL_END (U" seconds (y time at x frame ", frameNumber, U")")
1771 }
1772
1773 FORM (QUERY_ONE_FOR_INTEGER__DTW_getFrameNumberFromTime_x, U"DTW: Get frame number from time (x)", nullptr) {
1774 REAL (xTime, U"Time along x (s)", U"0.1")
1775 OK
1776 DO
1777 QUERY_ONE_FOR_INTEGER (DTW)
1778 Melder_require (xTime >= my xmin && xTime <= my xmax,
1779 U"Time outside x domain.");
1780 const integer result = Melder_iround (Matrix_xToColumn (me, xTime));
1781 QUERY_ONE_FOR_INTEGER_END (U" (x frame at y time ", xTime, U")")
1782 }
1783
1784 DIRECT (QUERY_ONE_FOR_INTEGER__DTW_getNumberOfFrames_y) {
1785 QUERY_ONE_FOR_INTEGER (DTW)
1786 const integer result = my ny;
1787 QUERY_ONE_FOR_INTEGER_END (U" (number of frames along y)")
1788 }
1789
1790 DIRECT (QUERY_ONE_FOR_REAL__DTW_getTimeStep_y) {
1791 QUERY_ONE_FOR_REAL (DTW)
1792 const double result = my dy;
1793 QUERY_ONE_FOR_REAL_END (U" seconds (time step along y)")
1794 }
1795
1796
1797 FORM (QUERY_ONE_FOR_REAL__DTW_getTimeFromFrameNumber_y, U"DTW: Get time from frame number (y)", nullptr) {
1798 NATURAL (frameNumber, U"Frame number (y)", U"1")
1799 OK
1800 DO
1801 QUERY_ONE_FOR_REAL (DTW)
1802 const double result = Matrix_rowToY (me, frameNumber);
1803 QUERY_ONE_FOR_REAL_END (U" seconds (x time at y frame ", frameNumber, U")")
1804 }
1805
1806 FORM (QUERY_ONE_FOR_INTEGER__DTW_getFrameNumberFromTime_y, U"DTW: Get frame number from time (y)", nullptr) {
1807 REAL (yTime, U"Time along y (s)", U"0.1")
1808 OK
1809 DO
1810 QUERY_ONE_FOR_INTEGER (DTW)
1811 Melder_require (yTime >= my ymin && yTime <= my ymax,
1812 U"Time outside y domain.");
1813 const integer result = Melder_iround (Matrix_yToRow (me, yTime));
1814 QUERY_ONE_FOR_INTEGER_END (U" (y frame at x time ", yTime, U")")
1815 }
1816
1817 FORM (QUERY_ONE_FOR_REAL__DTW_getPathY, U"DTW: Get time along path", U"DTW: Get time along path...") {
1818 REAL (xTime, U"Time (s)", U"0.0")
1819 OK
1820 DO
1821 QUERY_ONE_FOR_REAL (DTW)
1822 const double result = DTW_getYTimeFromXTime (me, xTime);
1823 QUERY_ONE_FOR_REAL_END (U"")
1824 }
1825
1826 FORM (QUERY_ONE_FOR_REAL__DTW_getYTimeFromXTime, U"DTW: Get y time from x time", U"DTW: Get y time from x time...") {
1827 REAL (xTime, U"Time at x (s)", U"0.0")
1828 OK
1829 DO
1830 QUERY_ONE_FOR_REAL (DTW)
1831 const double result = DTW_getYTimeFromXTime (me, xTime);
1832 QUERY_ONE_FOR_REAL_END (U" seconds (= y time at x time ", xTime, U")")
1833 }
1834
1835 FORM (QUERY_ONE_FOR_REAL__DTW_getXTimeFromYTime, U"DTW: Get x time from y time", U"DTW: Get x time from y time...") {
1836 REAL (yTime, U"Time at y (s)", U"0.0")
1837 OK
1838 DO
1839 QUERY_ONE_FOR_REAL (DTW)
1840 const double result = DTW_getXTimeFromYTime (me, yTime);
1841 QUERY_ONE_FOR_REAL_END (U" seconds (= x time at y time ", yTime, U")")
1842 }
1843
1844 FORM (QUERY_ONE_FOR_INTEGER__DTW_getMaximumConsecutiveSteps, U"DTW: Get maximum consecutive steps", U"DTW: Get maximum consecutive steps...") {
1845 OPTIONMENU (direction, U"Direction", 1)
1846 OPTION (U"X")
1847 OPTION (U"Y")
1848 OPTION (U"Diagonal")
1849 OK
1850 DO
1851 int direction_code [] = { DTW_START, DTW_X, DTW_Y, DTW_XANDY };
1852 conststring32 direction_string [] = { U"", U"x", U"y", U"diagonal" };
1853 QUERY_ONE_FOR_INTEGER (DTW)
1854 integer result = DTW_getMaximumConsecutiveSteps (me, direction_code [direction]);
1855 QUERY_ONE_FOR_INTEGER_END (U" (maximum number of consecutive steps in ", direction_string [direction], U" direction)")
1856 }
1857
1858 DIRECT (QUERY_ONE_FOR_REAL__DTW_getDistance_weighted) {
1859 QUERY_ONE_FOR_REAL (DTW)
1860 const double result = my weightedDistance;
1861 QUERY_ONE_FOR_REAL_END (U" (weighted distance)")
1862 }
1863
1864 FORM (QUERY_ONE_FOR_REAL__DTW_getDistanceValue, U"DTW: Get distance value", nullptr) {
1865 REAL (xTime, U"Time at x (s)", U"0.1")
1866 REAL (yTime, U"Time at y (s)", U"0.1")
1867 OK
1868 DO
1869 QUERY_ONE_FOR_REAL (DTW)
1870 double result = undefined;
1871 if ((xTime >= my xmin && xTime <= my xmax) && (yTime >= my ymin && yTime <= my ymax)) {
1872 integer irow = Matrix_yToNearestRow (me, yTime);
1873 integer icol = Matrix_xToNearestColumn (me, xTime);
1874 result = my z [irow] [icol];
1875 }
1876 QUERY_ONE_FOR_REAL_END (U" (distance at (", xTime, U", ", yTime, U"))")
1877 }
1878
1879 DIRECT (QUERY_ONE_FOR_REAL__DTW_getMinimumDistance) {
1880 QUERY_ONE_FOR_REAL (DTW)
1881 double result, maximum;
1882 Matrix_getWindowExtrema (me, 0, 0, 0, 0, & result, & maximum);
1883 QUERY_ONE_FOR_REAL_END (U" (minimum)")
1884 }
1885
1886 DIRECT (QUERY_ONE_FOR_REAL__DTW_getMaximumDistance) {
1887 QUERY_ONE_FOR_REAL (DTW)
1888 double minimum, result;
1889 Matrix_getWindowExtrema (me, 0, 0, 0, 0, & minimum, & result);
1890 QUERY_ONE_FOR_REAL_END (U" (maximum)")
1891 }
1892
1893 FORM (MODIFY_DTW_formula_distances, U"DTW: Formula (distances)", nullptr) {
1894 COMMENT (U"y := y1; for row := 1 to nrow do { x := x1; "
1895 "for col := 1 to ncol do { self [row, col] := `formula' ; x := x + dx } y := y + dy }")
1896 FORMULA (formula, U"Formula", U"self")
1897 OK
1898 DO
1899 MODIFY_EACH_WEAK (DTW)
1900 Matrix_formula (me, formula, interpreter, 0);
1901 double minimum, maximum;
1902 Matrix_getWindowExtrema (me, 0, 0, 0, 0, & minimum, & maximum);
1903 if (minimum < 0.0)
1904 Melder_throw (U"Execution of the formula has made some distance(s) negative.");
1905 MODIFY_EACH_WEAK_END
1906 }
1907
1908 FORM (MODIFY_DTW_setDistanceValue, U"DTW: Set distance value", nullptr) {
1909 REAL (xTime, U"Time at x (s)", U"0.1")
1910 REAL (yTime, U"Time at y (s)", U"0.1")
1911 REAL (newDistance, U"New value", U"0.0")
1912 OK
1913 DO
1914 if (newDistance < 0)
1915 Melder_throw (U"Distances cannot be negative.");
1916 MODIFY_EACH (DTW)
1917 if (xTime < my xmin || xTime > my xmax)
1918 Melder_throw (U"Time at x outside domain.");
1919 if (yTime < my ymin || yTime > my ymax)
1920 Melder_throw (U"Time at y outside domain.");
1921 const integer irow = Matrix_yToNearestRow (me, yTime);
1922 const integer icol = Matrix_xToNearestColumn (me, xTime);
1923 my z [irow] [icol] = newDistance;
1924 MODIFY_EACH_END
1925 }
1926
1927 FORM (MODIFY_DTW_findPath, U"DTW: Find path", nullptr) {
1928 DTW_constraints_addCommonFields(matchStart,matchEnd,slopeConstraint)
1929 OK
1930 DO
1931 MODIFY_EACH (DTW)
1932 DTW_findPath (me, matchStart, matchEnd, slopeConstraint);
1933 MODIFY_EACH_END
1934 }
1935
1936 FORM (MODIFY_DTW_findPath_bandAndSlope, U"DTW: find path (band & slope)", nullptr) {
1937 REAL (sakoeChibaBand, U"Sakoe-Chiba band (s)", U"0.05")
1938 CHOICE (slopeConstraint, U"Slope constraint", 1)
1939 OPTION (U"no restriction")
1940 OPTION (U"1/3 < slope < 3")
1941 OPTION (U"1/2 < slope < 2")
1942 OPTION (U"2/3 < slope < 3/2")
1943 OK
1944 DO
1945 MODIFY_EACH (DTW)
1946 DTW_findPath_bandAndSlope (me, sakoeChibaBand, slopeConstraint, nullptr);
1947 MODIFY_EACH_END
1948 }
1949
1950 FORM (CONVERT_EACH_TO_ONE__DTW_to_Matrix_cumulativeDistances, U"DTW: To Matrix", nullptr) {
1951 REAL (sakoeChibaBand, U"Sakoe-Chiba band (s)", U"0.05")
1952 CHOICE (slopeConstraint, U"Slope constraint", 1)
1953 OPTION (U"no restriction")
1954 OPTION (U"1/3 < slope < 3")
1955 OPTION (U"1/2 < slope < 2")
1956 OPTION (U"2/3 < slope < 3/2")
1957 OK
1958 DO
1959 CONVERT_EACH_TO_ONE (DTW)
1960 autoMatrix result = DTW_to_Matrix_cumulativeDistances (me, sakoeChibaBand, slopeConstraint);
1961 CONVERT_EACH_TO_ONE_END (my name.get(), U"_cd")
1962 }
1963
1964 FORM (CONVERT_EACH_TO_ONE__DTW_to_Polygon, U"DTW: To Polygon...", nullptr) {
1965 REAL (sakoeChibaBand, U"Sakoe-Chiba band (s)", U"0.1")
1966 CHOICE (slopeConstraint, U"Slope constraint", 1)
1967 OPTION (U"no restriction")
1968 OPTION (U"1/3 < slope < 3")
1969 OPTION (U"1/2 < slope < 2")
1970 OPTION (U"2/3 < slope < 3/2")
1971 OK
1972 DO
1973 CONVERT_EACH_TO_ONE (DTW)
1974 autoPolygon result = DTW_to_Polygon (me, sakoeChibaBand, slopeConstraint);
1975 CONVERT_EACH_TO_ONE_END (my name.get())
1976 }
1977
1978 DIRECT (CONVERT_EACH_TO_ONE__DTW_to_Matrix_distances) {
1979 CONVERT_EACH_TO_ONE (DTW)
1980 autoMatrix result = DTW_to_Matrix_distances (me);
1981 CONVERT_EACH_TO_ONE_END (my name.get())
1982 }
1983
1984 DIRECT (CONVERT_EACH_TO_ONE__DTW_swapAxes) {
1985 CONVERT_EACH_TO_ONE (DTW)
1986 autoDTW result = DTW_swapAxes (me);
1987 CONVERT_EACH_TO_ONE_END (my name.get(), U"_axesSwapped")
1988 }
1989
1990 DIRECT (MODIFY_DTW_Matrix_replace) {
1991 MODIFY_FIRST_OF_ONE_AND_ONE (DTW, Matrix)
1992 DTW_Matrix_replace (me, you);
1993 MODIFY_FIRST_OF_ONE_AND_ONE_END
1994 }
1995
1996 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__DTW_TextGrid_to_TextGrid) {
1997 CONVERT_ONE_AND_ONE_TO_ONE (DTW, TextGrid)
1998 autoTextGrid result = DTW_TextGrid_to_TextGrid (me, you, 0);
1999 // in result use the name of the textgrid and append the name of the DTW object
2000 CONVERT_ONE_AND_ONE_TO_ONE_END (your name.get(), U"_", my name.get())
2001 }
2002
2003 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__DTW_IntervalTier_to_Table) {
2004 CONVERT_ONE_AND_ONE_TO_ONE (DTW, IntervalTier)
2005 autoTable result = DTW_IntervalTier_to_Table (me, you, 1.0/44100);
2006 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get())
2007 }
2008
2009 /******************** EditDistanceTable & EditCostsTable ********************************************/
2010
2011 DIRECT (HELP__EditDistanceTable_help) {
2012 HELP (U"EditDistanceTable")
2013 }
2014
2015 DIRECT (CONVERT_EACH_TO_ONE__EditDistanceTable_to_TableOfReal_directions) {
2016 CONVERT_EACH_TO_ONE (EditDistanceTable)
2017 autoTableOfReal result = EditDistanceTable_to_TableOfReal_directions (me);
2018 CONVERT_EACH_TO_ONE_END (my name.get());
2019 }
2020
2021 DIRECT (MODIFY_EditDistanceTable_setEditCosts) {
2022 MODIFY_FIRST_OF_ONE_AND_ONE (EditDistanceTable, EditCostsTable)
2023 EditDistanceTable_setEditCosts (me, you);
2024 MODIFY_FIRST_OF_ONE_AND_ONE_END
2025 }
2026
2027 FORM (MODIFY_EditDistanceTable_setDefaultCosts, U"", nullptr) {
2028 POSITIVE (insertionCosts, U"Insertion costs", U"1.0")
2029 POSITIVE (deletionCosts, U"Deletion costs", U"1.0")
2030 POSITIVE (substitutionCosts, U"Substitution costs", U"2.0")
2031 OK
2032 DO
2033 MODIFY_EACH (EditDistanceTable)
2034 EditDistanceTable_setDefaultCosts (me, insertionCosts, deletionCosts, substitutionCosts);
2035 MODIFY_EACH_END
2036 }
2037
2038 FORM (GRAPHICS_EACH__EditDistanceTable_draw, U"EditDistanceTable_draw", nullptr) {
2039 CHOICE (format, U"Format", 3)
2040 OPTION (U"decimal")
2041 OPTION (U"exponential")
2042 OPTION (U"free")
2043 OPTION (U"rational")
2044 NATURAL (precision, U"Precision", U"1")
2045 REAL (angle, U"Rotate source labels by (degrees)", U"0.0")
2046 OK
2047 DO
2048 GRAPHICS_EACH (EditDistanceTable)
2049 EditDistanceTable_draw (me, GRAPHICS, format, precision, angle);
2050 GRAPHICS_EACH_END
2051 }
2052
2053 DIRECT (GRAPHICS_EACH__EditDistanceTable_drawEditOperations) {
2054 GRAPHICS_EACH (EditDistanceTable)
2055 EditDistanceTable_drawEditOperations (me, GRAPHICS);
2056 GRAPHICS_EACH_END
2057 }
2058
2059 DIRECT (HELP__EditCostsTable_help) {
2060 HELP (U"EditCostsTable")
2061 }
2062
2063 FORM (QUERY_ONE_FOR_INTEGER__EditCostsTable_getTargetIndex, U"EditCostsTable: Get target index", nullptr) {
2064 SENTENCE (target, U"Target", U"")
2065 OK
2066 DO
2067 QUERY_ONE_FOR_INTEGER (EditCostsTable)
2068 const integer result = EditCostsTable_getTargetIndex (me, target);
2069 QUERY_ONE_FOR_INTEGER_END (U" (target index)")
2070 }
2071
2072 FORM (QUERY_ONE_FOR_INTEGER__EditCostsTable_getSourceIndex, U"EditCostsTable: Get source index", nullptr) {
2073 SENTENCE (source, U"Source", U"")
2074 OK
2075 DO
2076 QUERY_ONE_FOR_INTEGER (EditCostsTable)
2077 const integer result = EditCostsTable_getSourceIndex (me, source);
2078 QUERY_ONE_FOR_INTEGER_END (U" (source index)")
2079 }
2080
2081 FORM (QUERY_ONE_FOR_REAL__EditCostsTable_getInsertionCosts, U"EditCostsTable: Get insertion cost", nullptr) {
2082 SENTENCE (target, U"Target", U"")
2083 OK
2084 DO
2085 QUERY_ONE_FOR_REAL (EditCostsTable)
2086 const double result = EditCostsTable_getInsertionCost (me, target);
2087 QUERY_ONE_FOR_REAL_END (U" (insertion cost)")
2088 }
2089
2090 FORM (QUERY_ONE_FOR_REAL__EditCostsTable_getDeletionCost, U"EditCostsTable: Get deletion cost", nullptr) {
2091 SENTENCE (source, U"Source", U"")
2092 OK
2093 DO
2094 QUERY_ONE_FOR_REAL (EditCostsTable)
2095 const double result = EditCostsTable_getDeletionCost (me, source);
2096 QUERY_ONE_FOR_REAL_END (U" (deletion cost)")
2097 }
2098
2099 FORM (QUERY_ONE_FOR_REAL__EditCostsTable_getSubstitutionCost, U"EditCostsTable: Get substitution cost", nullptr) {
2100 SENTENCE (target, U"Target", U"")
2101 SENTENCE (source, U"Source", U"")
2102 OK
2103 DO
2104 QUERY_ONE_FOR_REAL (EditCostsTable)
2105 const double result = EditCostsTable_getSubstitutionCost (me, target, source);
2106 QUERY_ONE_FOR_REAL_END (U" (substitution cost)")
2107 }
2108
2109 FORM (QUERY_ONE_FOR_REAL__EditCostsTable_getCosts_others, U"EditCostsTable: Get cost (others)", nullptr) {
2110 CHOICE (costTypes, U"Others cost type", 1)
2111 OPTION (U"insertion")
2112 OPTION (U"deletion")
2113 OPTION (U"equality")
2114 OPTION (U"inequality")
2115 OK
2116 DO
2117 QUERY_ONE_FOR_REAL (EditCostsTable)
2118 const double result = EditCostsTable_getOthersCost (me,costTypes);
2119 QUERY_ONE_FOR_REAL_END (U" (cost)")
2120 }
2121
2122 FORM (MODIFY_EditCostsTable_setTargetSymbol_index, U"EditCostsTable: Set target symbol (index)", nullptr) {
2123 NATURAL (index, U"Index", U"1")
2124 SENTENCE (target, U"Target", U"a")
2125 OK
2126 DO
2127 MODIFY_EACH (EditCostsTable)
2128 TableOfReal_setRowLabel (me, index, target);
2129 MODIFY_EACH_END
2130 }
2131
2132 FORM (MODIFY_EditCostsTable_setSourceSymbol_index, U"EditCostsTable: Set source symbol (index)", nullptr) {
2133 NATURAL (index, U"Index", U"1")
2134 SENTENCE (source, U"Source", U"a")
2135 OK
2136 DO
2137 MODIFY_EACH (EditCostsTable)
2138 TableOfReal_setColumnLabel (me, index, source);
2139 MODIFY_EACH_END
2140 }
2141
2142 FORM (MODIFY_EditCostsTable_setInsertionCosts, U"EditCostsTable: Set insertion costs", nullptr) {
2143 SENTENCE (targets, U"Targets", U"")
2144 REAL (cost, U"Cost", U"2.0")
2145 OK
2146 DO
2147 MODIFY_EACH (EditCostsTable)
2148 EditCostsTable_setInsertionCosts (me, targets, cost);
2149 MODIFY_EACH_END
2150 }
2151
2152 FORM (MODIFY_EditCostsTable_setDeletionCosts, U"EditCostsTable: Set deletion costs", nullptr) {
2153 SENTENCE (sources, U"Sources", U"")
2154 REAL (cost, U"Cost", U"2.0")
2155 OK
2156 DO
2157 MODIFY_EACH (EditCostsTable)
2158 EditCostsTable_setDeletionCosts (me, sources, cost);
2159 MODIFY_EACH_END
2160 }
2161
2162 FORM (MODIFY_EditCostsTable_setSubstitutionCosts, U"EditCostsTable: Set substitution costs", nullptr) {
2163 SENTENCE (targets, U"Targets", U"a i u")
2164 SENTENCE (sources, U"Sources", U"a i u")
2165 REAL (cost, U"Cost", U"2.0")
2166 OK
2167 DO
2168 MODIFY_EACH (EditCostsTable)
2169 EditCostsTable_setSubstitutionCosts (me, targets, sources, cost);
2170 MODIFY_EACH_END
2171 }
2172
2173 FORM (MODIFY_EditCostsTable_setCosts_others, U"EditCostsTable: Set costs (others)", nullptr) {
2174 COMMENT (U"Others costs")
2175 REAL (insertionCosts, U"Insertion", U"1.0")
2176 REAL (deletionCosts, U"Deletion", U"1.0")
2177 COMMENT (U"Substitution costs")
2178 REAL (equalityCosts, U"Equality", U"0.0")
2179 REAL (inequalityCosts, U"Inequality", U"2.0")
2180 OK
2181 DO
2182 MODIFY_EACH (EditCostsTable)
2183 EditCostsTable_setOthersCosts (me, insertionCosts, deletionCosts, equalityCosts, inequalityCosts);
2184 MODIFY_EACH_END
2185 }
2186
2187 DIRECT (CONVERT_EACH_TO_ONE__EditCostsTable_to_TableOfReal) {
2188 CONVERT_EACH_TO_ONE (EditCostsTable)
2189 autoTableOfReal result = EditCostsTable_to_TableOfReal (me);
2190 CONVERT_EACH_TO_ONE_END (my name.get());
2191 }
2192
2193 FORM (CREATE_ONE__EditCostsTable_createEmpty, U"Create empty EditCostsTable", U"Create empty EditCostsTable...") {
2194 SENTENCE (name, U"Name", U"editCosts")
2195 INTEGER (numberOfTargetSymbols, U"Number of target symbols", U"0")
2196 INTEGER (numberOfSourceSymbols, U"Number of source symbols", U"0")
2197 OK
2198 DO
2199 CREATE_ONE
2200 numberOfTargetSymbols = std::max (0_integer, numberOfTargetSymbols);
2201 numberOfSourceSymbols = std::max (0_integer, numberOfSourceSymbols );
2202 autoEditCostsTable result = EditCostsTable_create (numberOfTargetSymbols, numberOfSourceSymbols);
2203 CREATE_ONE_END (name)
2204 }
2205
2206 /******************** Eigen ********************************************/
2207
2208 DIRECT (HELP__Eigen_help) {
2209 HELP (U"Eigen")
2210 }
2211
2212 DIRECT (WARNING__Eigen_drawEigenvalues_scree) {
2213 WARNING
2214 Melder_warning (U"The command \"Draw eigenvalues (scree)...\" has been "
2215 "removed.\n To get a scree plot, use \"Draw eigenvalues...\" with the "
2216 "arguments\n 'Fraction of eigenvalues summed' and 'Cumulative' unchecked."
2217 );
2218 WARNING_END
2219 }
2220
2221 FORM (GRAPHICS_EACH__Eigen_drawEigenvalues, U"Eigen: Draw eigenvalues", U"Eigen: Draw eigenvalues...") {
2222 INTEGER (fromEigenvalue, U"left Eigenvalue range", U"0")
2223 INTEGER (toEigenvalue, U"right Eigenvalue range", U"0")
2224 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
2225 REAL (toAmplitude, U"right Amplitude range", U"0.0")
2226 BOOLEAN (fractionSummed, U"Fraction of eigenvalues summed", false)
2227 BOOLEAN (cumulative, U"Cumulative", false)
2228 POSITIVE (markSize_mm, U"Mark size (mm)", U"1.0")
2229 SENTENCE (mark_string, U"Mark string (+xo.)", U"+")
2230 BOOLEAN (garnish, U"Garnish", true)
2231 OK
2232 DO
2233 GRAPHICS_EACH (Eigen)
2234 Eigen_drawEigenvalues (me, GRAPHICS, fromEigenvalue, toEigenvalue, fromAmplitude, toAmplitude,
2235 fractionSummed, cumulative, markSize_mm, mark_string, garnish
2236 );
2237 GRAPHICS_EACH_END
2238 }
2239
2240 FORM (GRAPHICS_EACH__Eigen_drawEigenvector, U"Eigen: Draw eigenvector", U"Eigen: Draw eigenvector...") {
2241 INTEGER (eigenvectorNumber, U"Eigenvector number", U"1")
2242 BOOLEAN (loadings, U"Component loadings", false)
2243 INTEGER (fromElement, U"left Element range", U"0")
2244 INTEGER (toElement, U"right Element range", U"0")
2245 REAL (fromAmplitude, U"left Amplitude range", U"-1.0")
2246 REAL (toAmplitude, U"right Amplitude range", U"1.0")
2247 POSITIVE (markSize_mm, U"Mark size (mm)", U"1.0")
2248 SENTENCE (mark_string, U"Mark string (+xo.)", U"+")
2249 BOOLEAN (connectPoints, U"Connect points", true)
2250 BOOLEAN (garnish, U"Garnish", true)
2251 OK
2252 DO
2253 GRAPHICS_EACH (Eigen)
2254 Eigen_drawEigenvector (me, GRAPHICS, eigenvectorNumber, fromElement, toElement, fromAmplitude,
2255 toAmplitude, loadings, markSize_mm, mark_string, connectPoints, nullptr, garnish
2256 );
2257 GRAPHICS_EACH_END
2258 }
2259
2260 DIRECT (QUERY_ONE_FOR_INTEGER__Eigen_getNumberOfEigenvalues) {
2261 QUERY_ONE_FOR_INTEGER (Eigen)
2262 const integer result = my numberOfEigenvalues;
2263 QUERY_ONE_FOR_INTEGER_END (U" (number of eigenvalues)")
2264 }
2265
2266 DIRECT (QUERY_ONE_FOR_INTEGER__Eigen_getNumberOfEigenvectors) {
2267 QUERY_ONE_FOR_INTEGER (Eigen)
2268 const integer result = my numberOfEigenvalues;
2269 QUERY_ONE_FOR_INTEGER_END (U" (number of eigenvectors)")
2270 }
2271
2272 DIRECT (QUERY_ONE_FOR_INTEGER__Eigen_getEigenvectorDimension) {
2273 QUERY_ONE_FOR_INTEGER (Eigen)
2274 const integer result = my dimension;
2275 QUERY_ONE_FOR_INTEGER_END (U" (dimension)")
2276 }
2277
2278 FORM (QUERY_ONE_FOR_REAL__Eigen_getEigenvalue, U"Eigen: Get eigenvalue", U"Eigen: Get eigenvalue...") {
2279 NATURAL (eigenvalueNumber, U"Eigenvalue number", U"1")
2280 OK
2281 DO
2282 QUERY_ONE_FOR_REAL (Eigen)
2283 double result = undefined;
2284 if (eigenvalueNumber > 0 && eigenvalueNumber <= my numberOfEigenvalues) {
2285 result = my eigenvalues [eigenvalueNumber];
2286 }
2287 QUERY_ONE_FOR_REAL_END (U" (eigenvalue [", eigenvalueNumber, U"])")
2288 }
2289
2290 DIRECT (QUERY_ONE_FOR_REAL_VECTOR__Eigen_listEigenvalues) {
2291 QUERY_ONE_FOR_REAL_VECTOR (Eigen)
2292 autoVEC result = Eigen_listEigenvalues (me);
2293 QUERY_ONE_FOR_REAL_VECTOR_END
2294 }
2295
2296 DIRECT (QUERY_ONE_FOR_REAL_VECTOR__Eigen_listEigenvalues_imag) {
2297 QUERY_ONE_FOR_REAL_VECTOR (Eigen)
2298 autoVEC result = Eigen_listEigenvalues_imag (me);
2299 QUERY_ONE_FOR_REAL_VECTOR_END
2300 }
2301
2302 FORM (QUERY_ONE_FOR_REAL__Eigen_getSumOfEigenvalues, U"Eigen: Get sum of eigenvalues", U"Eigen: Get sum of eigenvalues...") {
2303 INTEGER (fromEigenvalue, U"left Eigenvalue range", U"1")
2304 INTEGER (toEigenvalue, U"right Eigenvalue range", U"0 (=all)")
2305 OK
2306 DO
2307 QUERY_ONE_FOR_REAL (Eigen)
2308 if (toEigenvalue == 0)
2309 toEigenvalue = my numberOfEigenvalues;
2310 const double result = Eigen_getSumOfEigenvalues (me, fromEigenvalue, toEigenvalue);
2311 QUERY_ONE_FOR_REAL_END (U" (sum of eigenvalues [", fromEigenvalue, U"..", toEigenvalue, U"])")
2312 }
2313
2314 FORM (QUERY_ONE_FOR_REAL__Eigen_getEigenvectorElement, U"Eigen: Get eigenvector element", U"Eigen: Get eigenvector element...") {
2315 NATURAL (eigenvectorNumber, U"Eigenvector number", U"1")
2316 NATURAL (elementNumber, U"Element number", U"1")
2317 OK
2318 DO
2319 QUERY_ONE_FOR_REAL (Eigen)
2320 const double result = Eigen_getEigenvectorElement (me, eigenvectorNumber, elementNumber);
2321 QUERY_ONE_FOR_REAL_END (U" (eigenvector [", eigenvectorNumber, U"] element [", elementNumber, U"])")
2322 }
2323
2324 FORM (QUERY_ONE_FOR_REAL_VECTOR__Eigen_getEigenvector, U"Eigen: Get eigenvector", U"Eigen: Get eigenvector...") {
2325 NATURAL (eigenvectorNumber, U"Eigenvector number", U"1")
2326 OK
2327 DO
2328 QUERY_ONE_FOR_REAL_VECTOR (Eigen)
2329 autoVEC result = Eigen_getEigenvector (me, eigenvectorNumber);
2330 QUERY_ONE_FOR_REAL_VECTOR_END
2331 }
2332
2333 FORM (QUERY_ONE_FOR_REAL_VECTOR__Eigen_getEigenvector_imag, U"Eigen: Get eigenvector (imag)", U"Eigen: Get eigenvector...") {
2334 NATURAL (eigenvectorNumber, U"Eigenvector number", U"1")
2335 OK
2336 DO
2337 QUERY_ONE_FOR_REAL_VECTOR (Eigen)
2338 autoVEC result = Eigen_getEigenvector_imag (me, eigenvectorNumber);
2339 QUERY_ONE_FOR_REAL_VECTOR_END
2340 }
2341
2342 DIRECT (QUERY_ONE_FOR_BOOLEAN__Eigen_areAllEigenvaluesReal) {
2343 QUERY_ONE_FOR_BOOLEAN (Eigen)
2344 const integer result = Eigen_areAllEigenvaluesReal (me);
2345 QUERY_ONE_FOR_BOOLEAN_END (result ? U" (all eigenvalues are real)" : U" (not all eigenvalues are real)")
2346 }
2347
2348 FORM (MODIFY__Eigen_sort, U"Eigen: Sort...", U"Eigen: Sort...") {
2349 COMMENT (U"Sort eigenvalues and corresponding eigenvectors")
2350 BOOLEAN (sortAscending, U"Sort ascending", true)
2351 OK
2352 DO
2353 MODIFY_EACH (Eigen)
2354 Eigen_sort_special (me, sortAscending);
2355 MODIFY_EACH_END
2356 }
2357
2358 FORM (MODIFY__Eigen_invertEigenvector, U"Eigen: Invert eigenvector", nullptr) {
2359 NATURAL (eigenvectorNumber, U"Eigenvector number", U"1")
2360 OK
2361 DO
2362 MODIFY_EACH (Eigen)
2363 Eigen_invertEigenvector (me, eigenvectorNumber);
2364 MODIFY_EACH_END
2365 }
2366
2367 DIRECT (MODIFY_ALL__Eigens_alignEigenvectors) {
2368 MODIFY_ALL (Eigen)
2369 Eigens_alignEigenvectors (& list);
2370 MODIFY_ALL_END
2371 }
2372
2373 FORM (CONVERT_ONE_AND_ONE_TO_ONE__Eigen_Matrix_projectColumns, U"Eigen & Matrix: Project columns", U"Eigen & Matrix: Project...") {
2374 INTEGER (numberOfDimensions, U"Number of dimensions", U"0")
2375 OK
2376 DO
2377 CONVERT_ONE_AND_ONE_TO_ONE (Eigen, Matrix)
2378 autoMatrix result = Eigen_Matrix_to_Matrix_projectColumns (me, you, numberOfDimensions);
2379 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
2380 }
2381
2382 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__Eigen_SSCP_project) {
2383 CONVERT_ONE_AND_ONE_TO_ONE (Eigen, SSCP)
2384 autoSSCP result = Eigen_SSCP_project (me, you);
2385 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
2386 }
2387
2388 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__Eigen_Covariance_project) {
2389 CONVERT_ONE_AND_ONE_TO_ONE (Eigen, Covariance)
2390 autoCovariance result = Eigen_Covariance_project (me, you);
2391 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
2392 }
2393
2394 /******************** Index ********************************************/
2395
2396 DIRECT (HELP__Index_help) {
2397 HELP (U"Index")
2398 }
2399
2400 DIRECT (QUERY_ONE_FOR_INTEGER__Index_getNumberOfClasses) {
2401 QUERY_ONE_FOR_INTEGER (Index)
2402 const integer result = my classes->size;
2403 QUERY_ONE_FOR_INTEGER_END (U" (number of classes)")
2404 }
2405
2406 FORM (QUERY_ONE_FOR_STRING__StringsIndex_getClassLabelFromClassIndex, U"StringsIndex: Get class label", U"StringsIndex: Get class label...") {
2407 NATURAL (index, U"Class index", U"1")
2408 OK
2409 DO
2410 QUERY_ONE_FOR_STRING (StringsIndex)
2411 conststring32 result = StringsIndex_getClassLabelFromClassIndex (me, index);
2412 QUERY_ONE_FOR_STRING_END
2413 }
2414
2415 FORM (QUERY_ONE_FOR_STRING__StringsIndex_getItemLabelFromItemIndex, U"StringsIndex: Get item label", nullptr) {
2416 NATURAL (itemIndex, U"Item index", U"1")
2417 OK
2418 DO
2419 QUERY_ONE_FOR_STRING (StringsIndex)
2420 conststring32 result = StringsIndex_getItemLabelFromItemIndex (me, itemIndex);
2421 QUERY_ONE_FOR_STRING_END
2422 }
2423
2424 FORM (QUERY_ONE_FOR_INTEGER__StringsIndex_getClassIndexFromItemIndex, U"StringsIndex: Get class index from item index", nullptr) {
2425 NATURAL (itemIndex, U"Item index", U"1")
2426 OK
2427 DO
2428 QUERY_ONE_FOR_INTEGER (StringsIndex)
2429 const integer result = Index_getClassIndexFromItemIndex (me, itemIndex);
2430 QUERY_ONE_FOR_INTEGER_END (U" (class index)")
2431 }
2432
2433 FORM (QUERY_ONE_FOR_INTEGER__Index_getIndex, U"StringsIndex: Get item index", nullptr) {
2434 NATURAL (itemIndex, U"Item index", U"1")
2435 OK
2436 DO
2437 QUERY_ONE_FOR_INTEGER (StringsIndex)
2438 const integer result = Index_getClassIndexFromItemIndex (me, itemIndex);
2439 QUERY_ONE_FOR_INTEGER_END (U" (class index)")
2440 }
2441
2442 FORM (QUERY_ONE_FOR_INTEGER__StringsIndex_getClassIndex, U"StringsIndex: Get class index from class label", nullptr) {
2443 WORD (klasLabel, U"Class label", U"label")
2444 OK
2445 DO
2446 QUERY_ONE_FOR_INTEGER (StringsIndex)
2447 const integer result = StringsIndex_getClassIndexFromClassLabel (me, klasLabel);
2448 QUERY_ONE_FOR_INTEGER_END (U" (class index)")
2449 }
2450
2451 DIRECT (QUERY_ONE_FOR_STRING_ARRAY__StringsIndex_listAllClasses) {
2452 QUERY_ONE_FOR_STRING_ARRAY (StringsIndex)
2453 autoSTRVEC result = StringsIndex_listAllClasses (me);
2454 QUERY_ONE_FOR_STRING_ARRAY_END
2455 }
2456
2457 FORM (CONVERT_EACH_TO_ONE__Index_extractPart, U"Index: Extract part", U"Index: Extract part...") {
2458 INTEGER (fromItem, U"left Item range", U"0")
2459 INTEGER (toItem, U"right Item range", U"0")
2460 OK
2461 DO
2462 CONVERT_EACH_TO_ONE (Index)
2463 autoIndex result = Index_extractPart (me, fromItem, toItem);
2464 CONVERT_EACH_TO_ONE_END (my name.get(), U"_part")
2465 }
2466
2467 FORM (CONVERT_EACH_TO_ONE__Index_to_Permutation, U"Index: To Permutation", U"Index: To Permutation...") {
2468 BOOLEAN (permuteWithinClasses, U"Permute within classes", true)
2469 OK
2470 DO
2471 CONVERT_EACH_TO_ONE (Index)
2472 autoPermutation result = Index_to_Permutation_permuteRandomly (me, permuteWithinClasses);
2473 CONVERT_EACH_TO_ONE_END (my name.get())
2474 }
2475
2476 DIRECT (CONVERT_EACH_TO_ONE__StringsIndex_to_Strings) {
2477 CONVERT_EACH_TO_ONE (StringsIndex)
2478 autoStrings result = StringsIndex_to_Strings (me);
2479 CONVERT_EACH_TO_ONE_END (my name.get())
2480 }
2481
2482 /******************** Excitation ********************************************/
2483
2484 DIRECT (COMBINE_ALL_TO_ONE__Excitations_to_ExcitationList) {
2485 COMBINE_ALL_TO_ONE (Excitation)
2486 autoExcitationList result = Excitations_to_ExcitationList (& list);
2487 COMBINE_ALL_TO_ONE_END (U"appended")
2488 }
2489
2490 /******************** ExcitationList ********************************************/
2491
2492 FORM (MODIFY_ExcitationList_formula, U"ExcitationList: Formula", nullptr) {
2493 COMMENT (U"for all objects in ExcitationList do { for col := 1 to ncol do { self [col] := `formula' ; x := x + dx } }")
2494 FORMULA (formula, U"Formula", U"self")
2495 OK
2496 DO
2497 MODIFY_EACH_WEAK (ExcitationList)
2498 for (integer j = 1; j <= my size; j ++)
2499 Matrix_formula (my at [j], formula, interpreter, nullptr);
2500 MODIFY_EACH_WEAK_END
2501 }
2502
2503 DIRECT (MODIFY_ExcitationList_addItem) {
2504 MODIFY_FIRST_OF_ONE_AND_ALL (ExcitationList, Excitation)
2505 ExcitationList_addItems (me, & list);
2506 MODIFY_FIRST_OF_ONE_AND_ALL_END
2507 }
2508
2509 FORM (CONVERT_EACH_TO_ONE__ExcitationList_extractItem, U"ExcitationList: Extract item", nullptr) {
2510 NATURAL (itemIndex, U"Item index", U"1")
2511 OK
2512 DO
2513 CONVERT_EACH_TO_ONE (ExcitationList)
2514 autoExcitation result = ExcitationList_extractItem (me, itemIndex);
2515 CONVERT_EACH_TO_ONE_END (my name.get(), U"_", itemIndex)
2516 }
2517
2518 DIRECT (CONVERT_TWO_TO_ONE__ExcitationList_append) {
2519 CONVERT_TWO_TO_ONE (ExcitationList)
2520 autoExcitationList result = Data_copy (me);
2521 result -> merge (you);
2522 CONVERT_TWO_TO_ONE_END (U"appended")
2523 }
2524
2525 FORM (CONVERT_EACH_TO_ONE__ExcitationList_to_PatternList, U"Excitations: To PatternList", nullptr) {
2526 NATURAL (join, U"Join", U"1")
2527 OK
2528 DO
2529 CONVERT_EACH_TO_ONE (ExcitationList)
2530 autoPatternList result = ExcitationList_to_PatternList (me, join);
2531 CONVERT_EACH_TO_ONE_END (my name.get())
2532 }
2533
2534 DIRECT (CONVERT_EACH_TO_ONE__ExcitationList_to_TableOfReal) {
2535 CONVERT_EACH_TO_ONE (ExcitationList)
2536 autoTableOfReal result = ExcitationList_to_TableOfReal (me);
2537 CONVERT_EACH_TO_ONE_END (my name.get())
2538 }
2539
2540
2541 /************************* FileInMemory ***********************************/
2542
2543
2544 FORM_READ (READ_ONE__FileInMemory_create, U"Create file in memory", nullptr, true) {
2545 READ_ONE
2546 autoFileInMemory result = FileInMemory_create (file);
2547 READ_ONE_END
2548 }
2549
2550 FORM (INFO_ONE__FileInMemory_showAsCode, U"FileInMemory: Show as code", nullptr) {
2551 WORD (name, U"Name", U"example")
2552 INTEGER (numberOfByterPerLine, U"Number of bytes per line", U"20")
2553 OK
2554 DO
2555 INFO_ONE (FileInMemory)
2556 MelderInfo_open ();
2557 FileInMemory_showAsCode (me, name, numberOfByterPerLine);
2558 MelderInfo_close ();
2559 INFO_ONE_END
2560 }
2561
2562 /************************* FileInMemorySet ***********************************/
2563
2564 DIRECT (QUERY_ONE_FOR_INTEGER__FileInMemorySet_getNumberOfFiles) {
2565 QUERY_ONE_FOR_INTEGER (FileInMemorySet)
2566 const integer result = my size;
2567 QUERY_ONE_FOR_INTEGER_END (U" (number of files)")
2568 }
2569
2570 FORM (QUERY_ONE_FOR_BOOLEAN__FileInMemorySet_hasDirectory, U"FileInMemorySet: Has directory?", nullptr) {
2571 WORD (name, U"Name", U"aav")
2572 OK
2573 DO
2574 QUERY_ONE_FOR_BOOLEAN (FileInMemorySet)
2575 const bool result = FileInMemorySet_hasDirectory (me, name);
2576 QUERY_ONE_FOR_BOOLEAN_END (U" (has directory?)")
2577 }
2578
2579 FORM (CONVERT_EACH_TO_ONE__FileInMemorySet_downto_Table, U"FileInMemorySet: Down to Table", nullptr) {
2580 BOOLEAN (openFilesOnly, U"Open files only?", false)
2581 OK
2582 DO
2583 CONVERT_EACH_TO_ONE (FileInMemorySet)
2584 autoTable result = FileInMemorySet_downto_Table (me, openFilesOnly);
2585 CONVERT_EACH_TO_ONE_END (my name.get())
2586 }
2587
2588 FORM (CREATE_ONE__FileInMemorySet_createFromDirectoryContents, U"Create files in memory from directory contents", nullptr) {
2589 SENTENCE (name, U"Name", U"list")
2590 FOLDER (directory, U"Directory", U"/home/david/projects/espeak-ng/espeak-ng-data/voices/!v")
2591 WORD (fileGlobber, U"Only files that match pattern", U"*")
2592 OK
2593 DO
2594 CREATE_ONE
2595 autoFileInMemorySet result = FileInMemorySet_createFromDirectoryContents (directory, fileGlobber);
2596 CREATE_ONE_END (name)
2597 }
2598
2599 FORM (CONVERT_EACH_TO_ONE__FileInMemorySet_extractFiles, U"FileInMemorySet: Extract files", nullptr) {
2600 COMMENT (U"Extract all files where the file name ")
2601 OPTIONMENU_ENUM (kMelder_string, which, U"...", kMelder_string::CONTAINS)
2602 SENTENCE (criterion, U"...the text", U"/voices/")
2603 OK
2604 DO
2605 CONVERT_EACH_TO_ONE (FileInMemorySet)
2606 autoFileInMemorySet result = FileInMemorySet_extractFiles (me, which, criterion);
2607 CONVERT_EACH_TO_ONE_END (my name.get())
2608 }
2609
2610 FORM (CONVERT_EACH_TO_ONE__FileInMemorySet_removeFiles, U"FileInMemorySet: Remove files", nullptr) {
2611 COMMENT (U"Remove all files where the file name ")
2612 OPTIONMENU_ENUM (kMelder_string, which, U"...", kMelder_string::CONTAINS)
2613 SENTENCE (criterion, U"...the text", U"/voices/")
2614 OK
2615 DO
2616 CONVERT_EACH_TO_ONE (FileInMemorySet)
2617 autoFileInMemorySet result = FileInMemorySet_removeFiles (me, which, criterion);
2618 CONVERT_EACH_TO_ONE_END (my name.get())
2619 }
2620
2621 FORM (INFO_ONE__FileInMemorySet_showAsCode, U"FileInMemorySet: Show as code", nullptr) {
2622 WORD (functionName, U"Function name", U"example_FileInMemorySet_add_examples")
2623 INTEGER (numberOfBytesPerLine, U"Number of bytes per line", U"20")
2624 OK
2625 DO
2626 INFO_ONE (FileInMemorySet)
2627 MelderInfo_open ();
2628 FileInMemorySet_showAsCode (me, functionName, numberOfBytesPerLine);
2629 MelderInfo_close ();
2630 INFO_ONE_END
2631 }
2632
2633 FORM (INFO_ONE__FileInMemorySet_showOneFileAsCode, U"FileInMemorySet: Show one file as code", nullptr) {
2634 NATURAL (index, U"Index", U"1")
2635 WORD (name, U"Name", U"example")
2636 INTEGER (numberOfBytesPerLine, U"Number of bytes per line", U"20")
2637 OK
2638 DO
2639 INFO_ONE (FileInMemorySet)
2640 MelderInfo_open ();
2641 FileInMemorySet_showOneFileAsCode (me, index, name, numberOfBytesPerLine);
2642 MelderInfo_close ();
2643 INFO_ONE_END
2644 }
2645
2646 DIRECT (COMBINE_ALL_TO_ONE__FilesInMemory_to_FileInMemorySet) {
2647 COMBINE_ALL_TO_ONE (FileInMemory)
2648 autoFileInMemorySet result = FilesInMemory_to_FileInMemorySet (list);
2649 COMBINE_ALL_TO_ONE_END (U"merged");
2650 }
2651
2652 DIRECT (MODIFY_FIRST_OF_ONE_AND_ONE__FileInMemorySet_addItemsToSet) {
2653 MODIFY_FIRST_OF_ONE_AND_ONE (FileInMemorySet, FileInMemory)
2654 autoFileInMemory him = Data_copy (you);
2655 my addItem_move (him.move());
2656 MODIFY_FIRST_OF_ONE_AND_ONE_END
2657 }
2658
2659 DIRECT (COMBINE_ALL_TO_ONE__FileInMemorySets_merge) {
2660 COMBINE_ALL_TO_ONE (FileInMemorySet)
2661 autoFileInMemorySet result = FileInMemorySets_merge (list);
2662 COMBINE_ALL_TO_ONE_END (U"merge");
2663 }
2664
2665 DIRECT (CONVERT_EACH_TO_ONE__FileInMemorySet_to_Strings_path) {
2666 CONVERT_EACH_TO_ONE (FileInMemorySet)
2667 autoStrings result = FileInMemorySet_to_Strings_path (me);
2668 CONVERT_EACH_TO_ONE_END (my name.get());
2669 }
2670
2671 /************************* FilterBank ***********************************/
2672
2673 FORM (GRAPHICS_EACH__FilterBank_drawFilters, U"FilterBank: Draw filters", nullptr) {
2674 praat_TimeFunction_RANGE (fromTime, toTime)
2675 REAL (fromFrequency, U"left Frequency range", U"0.0")
2676 REAL (toFrequency, U"right Frequency range", U"0.0")
2677 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
2678 REAL (toAmplitude, U"right Amplitude range", U"0.0")
2679 OK
2680 DO
2681 GRAPHICS_EACH (Matrix)
2682 Matrix_drawRows (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, fromAmplitude, toAmplitude);
2683 GRAPHICS_EACH_END
2684 }
2685
2686 FORM (GRAPHICS_EACH__FilterBank_drawOneContour, U"FilterBank: Draw one contour", nullptr) {
2687 praat_TimeFunction_RANGE (fromTime, toTime)
2688 REAL (fromFrequency, U"left Frequency range", U"0.0")
2689 REAL (toFrequency, U"right Frequency range", U"0.0")
2690 REAL (height, U"Height (dB)", U"40.0")
2691 OK
2692 DO
2693 GRAPHICS_EACH (Matrix)
2694 Matrix_drawOneContour (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, height);
2695 GRAPHICS_EACH_END
2696 }
2697
2698 FORM (GRAPHICS_EACH__FilterBank_drawContours, U"FilterBank: Draw contours", nullptr) {
2699 praat_TimeFunction_RANGE (fromTime, toTime)
2700 REAL (fromFrequency, U"left Frequency range", U"0.0")
2701 REAL (toFrequency, U"right Frequency range", U"0.0")
2702 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
2703 REAL (toAmplitude, U"right Amplitude range", U"0.0")
2704 OK
2705 DO
2706 GRAPHICS_EACH (Matrix)
2707 Matrix_drawContours (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, fromAmplitude, toAmplitude);
2708 GRAPHICS_EACH_END
2709 }
2710
2711 FORM (GRAPHICS_EACH__FilterBank_drawFrequencyScales, U"FilterBank: Draw frequency scales", U"FilterBank: Draw frequency scales...") {
2712 CHOICE (xFrequencyScale, U"Horizontal frequency scale", 1)
2713 OPTION (U"Hertz")
2714 OPTION (U"Bark")
2715 OPTION (U"mel")
2716 REAL (xFromFrequency, U"left Horizontal frequency range", U"0.0")
2717 REAL (xToFrequency, U"right Horizontal frequency range", U"0.0")
2718 CHOICE (yFrequencyScale, U"Vertical frequency scale", 1)
2719 OPTION (U"Hertz")
2720 OPTION (U"Bark")
2721 OPTION (U"mel")
2722 REAL (yFromFrequency, U"left Vertical frequency range", U"0.0")
2723 REAL (yToFrequency, U"right Vertical frequency range", U"0.0")
2724 BOOLEAN (garnish, U"Garnish", true)
2725 OK
2726 DO
2727 GRAPHICS_EACH (FilterBank)
2728 FilterBank_drawFrequencyScales (me, GRAPHICS, xFrequencyScale, xFromFrequency, xToFrequency, yFrequencyScale,
2729 yFromFrequency, yToFrequency, garnish
2730 );
2731 GRAPHICS_EACH_END
2732 }
2733
2734 FORM (GRAPHICS_EACH__MelSpectrogram_drawFrequencyScale, U"", U"") {
2735 REAL (fromFrequency, U"left Horizontal frequency range (Hz)", U"0.0")
2736 REAL (toFrequency, U"right Horizontal frequency range (Hz)", U"0.0")
2737 REAL (yFromFrequency, U"left Vertical frequency range (mel)", U"0.0")
2738 REAL (yToFrequency, U"right Vertical frequency range (mel)", U"0.0")
2739 BOOLEAN (garnish, U"Garnish", true)
2740 OK
2741 DO
2742 GRAPHICS_EACH (MelSpectrogram)
2743 BandFilterSpectrogram_drawFrequencyScale (me, GRAPHICS, fromFrequency, toFrequency, yFromFrequency, yToFrequency, garnish);
2744 GRAPHICS_EACH_END
2745 }
2746
2747 FORM (GRAPHICS_EACH__BarkSpectrogram_drawFrequencyScale, U"", U"") {
2748 REAL (fromFrequency, U"left Horizontal frequency range (Hz)", U"0.0")
2749 REAL (toFrequency, U"right Horizontal frequency range (Hz)", U"0.0")
2750 REAL (yFromFrequency, U"left Vertical frequency range (bark)", U"0.0")
2751 REAL (yToFrequency, U"right Vertical frequency range (bark)", U"0.0")
2752 BOOLEAN (garnish, U"Garnish", true)
2753 OK
2754 DO
2755 GRAPHICS_EACH (MelSpectrogram)
2756 BandFilterSpectrogram_drawFrequencyScale (me, GRAPHICS, fromFrequency, toFrequency, yFromFrequency, yToFrequency, garnish);
2757 GRAPHICS_EACH_END
2758 }
2759
2760 FORM (GRAPHICS_EACH__MelSpectrogram_paintImage, U"MelSpectrogram: Paint image", U"MelSpectrogram: Paint image...") {
2761 praat_TimeFunction_RANGE (fromTime, toTime)
2762 REAL (fromFrequency, U"left Frequency range (mel)", U"0.0")
2763 REAL (toFrequency, U"right Frequency range (mel)", U"0.0")
2764 REAL (fromAmplitude, U"left Amplitude range (dB)", U"0.0")
2765 REAL (toAmplitude, U"right Amplitude range (dB)", U"0.0")
2766 BOOLEAN (garnish, U"Garnish", true)
2767 OK
2768 DO
2769 GRAPHICS_EACH (BandFilterSpectrogram)
2770 BandFilterSpectrogram_paintImage (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
2771 fromAmplitude, toAmplitude, garnish
2772 );
2773 GRAPHICS_EACH_END
2774 }
2775
2776 FORM (GRAPHICS_EACH__BarkSpectrogram_paintImage, U"BarkSpectrogram: Paint image", U"BarkSpectrogram: Paint image...") {
2777 praat_TimeFunction_RANGE (fromTime, toTime)
2778 REAL (fromFrequency, U"left Frequency range (bark)", U"0.0")
2779 REAL (toFrequency, U"right Frequency range (bark)", U"0.0")
2780 REAL (fromAmplitude, U"left Amplitude range (dB)", U"0.0")
2781 REAL (toAmplitude, U"right Amplitude range (dB)", U"0.0")
2782 BOOLEAN (garnish, U"Garnish", true)
2783 OK
2784 DO
2785 GRAPHICS_EACH (BandFilterSpectrogram)
2786 BandFilterSpectrogram_paintImage (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
2787 fromAmplitude, toAmplitude, garnish
2788 );
2789 GRAPHICS_EACH_END
2790 }
2791
2792 FORM (GRAPHICS_EACH__FilterBank_paintImage, U"FilterBank: Paint image", nullptr) {
2793 praat_TimeFunction_RANGE (fromTime, toTime)
2794 REAL (fromFrequency, U"left Frequency range", U"0.0")
2795 REAL (toFrequency, U"right Frequency range", U"0.0")
2796 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
2797 REAL (toAmplitude, U"right Amplitude range", U"0.0")
2798 OK
2799 DO
2800 GRAPHICS_EACH (Matrix)
2801 Matrix_paintImage (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, fromAmplitude, toAmplitude);
2802 GRAPHICS_EACH_END
2803 }
2804
2805 FORM (GRAPHICS_EACH__FilterBank_paintContours, U"FilterBank: Paint contours", nullptr) {
2806 praat_TimeFunction_RANGE (fromTime, toTime)
2807 REAL (fromFrequency, U"left Frequency range", U"0.0")
2808 REAL (toFrequency, U"right Frequency range", U"0.0")
2809 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
2810 REAL (toAmplitude, U"right Amplitude range", U"0.0")
2811 OK
2812 DO
2813 GRAPHICS_EACH (Matrix)
2814 Matrix_paintContours (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, fromAmplitude, toAmplitude);
2815 GRAPHICS_EACH_END
2816 }
2817
2818
2819 FORM (GRAPHICS_EACH__FilterBank_paintCells, U"FilterBank: Paint cells", nullptr) {
2820 praat_TimeFunction_RANGE (fromTime, toTime)
2821 REAL (fromFrequency, U"left Frequency range", U"0.0")
2822 REAL (toFrequency, U"right Frequency range", U"0.0")
2823 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
2824 REAL (toAmplitude, U"right Amplitude range", U"0.0")
2825 OK
2826 DO
2827 GRAPHICS_EACH (Matrix)
2828 Matrix_paintCells (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, fromAmplitude, toAmplitude);
2829 GRAPHICS_EACH_END
2830 }
2831
2832 FORM (GRAPHICS_EACH__FilterBank_paintSurface, U"FilterBank: Paint surface", nullptr) {
2833 praat_TimeFunction_RANGE (fromTime, toTime)
2834 REAL (fromFrequency, U"left Frequency range", U"0.0")
2835 REAL (toFrequency, U"right Frequency range", U"0.0")
2836 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
2837 REAL (toAmplitude, U"right Amplitude range", U"0.0")
2838 OK
2839 DO
2840 GRAPHICS_EACH (Matrix)
2841 Matrix_paintSurface (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, fromAmplitude, toAmplitude, 30, 45);
2842 GRAPHICS_EACH_END
2843 }
2844
2845 FORM (QUERY_ONE_FOR_REAL__FilterBank_getFrequencyInHertz, U"FilterBank: Get frequency in Hertz", U"FilterBank: Get frequency in Hertz...") {
2846 REAL (frequency, U"Frequency", U"10.0")
2847 CHOICE (frequencyUnit, U"Unit", 2)
2848 OPTION (U"Hertz")
2849 OPTION (U"Bark")
2850 OPTION (U"mel")
2851 OK
2852 DO
2853 QUERY_ONE_FOR_REAL (FilterBank)
2854 const double result = FilterBank_getFrequencyInHertz (me, frequency, frequencyUnit);
2855 QUERY_ONE_FOR_REAL_END (U" hertz")
2856 }
2857
2858 FORM (QUERY_ONE_FOR_REAL__FilterBank_getFrequencyInBark, U"FilterBank: Get frequency in Bark", U"FilterBank: Get frequency in Bark...") {
2859 REAL (frequency, U"Frequency", U"93.17")
2860 CHOICE (frequencyUnit, U"Unit", 1)
2861 OPTION (U"Hertz")
2862 OPTION (U"Bark")
2863 OPTION (U"mel")
2864 OK
2865 DO
2866 QUERY_ONE_FOR_REAL (FilterBank)
2867 const double result = FilterBank_getFrequencyInBark (me, frequency, frequencyUnit);
2868 QUERY_ONE_FOR_REAL_END (U" bark")
2869 }
2870
2871 FORM (QUERY_ONE_FOR_REAL__FilterBank_getFrequencyInMel, U"FilterBank: Get frequency in mel", U"FilterBank: Get frequency in mel...") {
2872 REAL (frequency, U"Frequency", U"1000.0")
2873 CHOICE (frequencyUnit, U"Unit", 1)
2874 OPTION (U"Hertz")
2875 OPTION (U"Bark")
2876 OPTION (U"mel")
2877 OK
2878 DO
2879 QUERY_ONE_FOR_REAL (FilterBank)
2880 const double result = FilterBank_getFrequencyInMel (me, frequency, frequencyUnit);
2881 QUERY_ONE_FOR_REAL_END (U" mel")
2882 }
2883
2884 FORM (MODIFY_EACH__FilterBank_equalizeIntensities, U"FilterBank: Equalize intensities", nullptr) {
2885 REAL (intensity_dB, U"Intensity (dB)", U"80.0")
2886 OK
2887 DO
2888 MODIFY_EACH (FilterBank)
2889 FilterBank_equalizeIntensities (me, intensity_dB);
2890 MODIFY_EACH_END
2891 }
2892
2893 FORM (MODIFY_EACH__BandFilterSpectrogram_equalizeIntensities, U"BandFilterSpectrogram: Equalize intensities", nullptr) {
2894 REAL (intensity_dB, U"Intensity (dB)", U"80.0")
2895 OK
2896 DO
2897 MODIFY_EACH (BandFilterSpectrogram)
2898 BandFilterSpectrogram_equalizeIntensities (me, intensity_dB);
2899 MODIFY_EACH_END
2900 }
2901
2902 DIRECT (CONVERT_EACH_TO_ONE__FilterBank_to_Matrix) {
2903 CONVERT_EACH_TO_ONE (FilterBank)
2904 autoMatrix result = FilterBank_to_Matrix (me);
2905 CONVERT_EACH_TO_ONE_END (my name.get())
2906 }
2907
2908 FORM (CONVERT_EACH_TO_ONE__BandFilterSpectrogram_to_Matrix, U"BandFilterSpectrogram: To Matrix", nullptr) {
2909 BOOLEAN (convertToDB, U"Convert to dB values", 1)
2910 OK
2911 DO
2912 CONVERT_EACH_TO_ONE (BandFilterSpectrogram)
2913 autoMatrix result = BandFilterSpectrogram_to_Matrix (me, convertToDB);
2914 CONVERT_EACH_TO_ONE_END (my name.get())
2915 }
2916
2917 FORM (CONVERT_TWO_TO_ONE__FilterBanks_crossCorrelate, U"FilterBanks: Cross-correlate", nullptr) {
2918 CHOICE_ENUM (kSounds_convolve_scaling, amplitudeScaling,
2919 U"Amplitude scaling", kSounds_convolve_scaling::DEFAULT)
2920 CHOICE_ENUM (kSounds_convolve_signalOutsideTimeDomain, signalOutsideTimeDomainIs,
2921 U"Signal outside time domain is...", kSounds_convolve_signalOutsideTimeDomain::DEFAULT)
2922 OK
2923 DO
2924 CONVERT_TWO_TO_ONE (FilterBank)
2925 autoSound result = FilterBanks_crossCorrelate (me, you, amplitudeScaling, signalOutsideTimeDomainIs);
2926 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
2927 }
2928
2929 FORM (CONVERT_TWO_TO_ONE__BandFilterSpectrograms_crossCorrelate, U"BandFilterSpectrograms: Cross-correlate", nullptr) {
2930 CHOICE_ENUM (kSounds_convolve_scaling, amplitudeScaling,
2931 U"Amplitude scaling", kSounds_convolve_scaling::DEFAULT)
2932 CHOICE_ENUM (kSounds_convolve_signalOutsideTimeDomain, signalOutsideTimeDomainIs,
2933 U"Signal outside time domain is...", kSounds_convolve_signalOutsideTimeDomain::DEFAULT)
2934 OK
2935 DO
2936 CONVERT_TWO_TO_ONE (BandFilterSpectrogram)
2937 autoSound result = BandFilterSpectrograms_crossCorrelate (me, you, amplitudeScaling, signalOutsideTimeDomainIs);
2938 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
2939 }
2940
2941 FORM (CONVERT_TWO_TO_ONE__FilterBanks_convolve, U"FilterBanks: Convolve", nullptr) {
2942 CHOICE_ENUM (kSounds_convolve_scaling, amplitudeScaling,
2943 U"Amplitude scaling", kSounds_convolve_scaling::DEFAULT)
2944 CHOICE_ENUM (kSounds_convolve_signalOutsideTimeDomain, signalOutsideTimeDomainIs,
2945 U"Signal outside time domain is...", kSounds_convolve_signalOutsideTimeDomain::DEFAULT)
2946 OK
2947 DO
2948 CONVERT_TWO_TO_ONE (FilterBank)
2949 autoSound result = FilterBanks_convolve (me, you, amplitudeScaling, signalOutsideTimeDomainIs);
2950 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
2951 }
2952
2953 FORM (CONVERT_TWO_TO_ONE__BandFilterSpectrograms_convolve, U"BandFilterSpectrograms: Convolve", nullptr) {
2954 CHOICE_ENUM (kSounds_convolve_scaling, amplitudeScaling,
2955 U"Amplitude scaling", kSounds_convolve_scaling::DEFAULT)
2956 CHOICE_ENUM (kSounds_convolve_signalOutsideTimeDomain, signalOutsideTimeDomainIs,
2957 U"Signal outside time domain is...", kSounds_convolve_signalOutsideTimeDomain::DEFAULT)
2958 OK
2959 DO
2960 CONVERT_TWO_TO_ONE (BandFilterSpectrogram)
2961 autoSound result = BandFilterSpectrograms_convolve (me, you, amplitudeScaling, signalOutsideTimeDomainIs);
2962 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
2963 }
2964
2965 DIRECT (CONVERT_EACH_TO_ONE__FilterBank_to_Intensity) {
2966 CONVERT_EACH_TO_ONE (FilterBank)
2967 autoIntensity result = FilterBank_to_Intensity (me);
2968 CONVERT_EACH_TO_ONE_END (my name.get())
2969 }
2970
2971 DIRECT (CONVERT_EACH_TO_ONE__BandFilterSpectrogram_to_Intensity) {
2972 CONVERT_EACH_TO_ONE (BandFilterSpectrogram)
2973 autoIntensity result = BandFilterSpectrogram_to_Intensity (me);
2974 CONVERT_EACH_TO_ONE_END (my name.get())
2975 }
2976
2977 /*********** FormantFilter *******************************************/
2978
2979 DIRECT (HELP__FormantFilter_help) {
2980 HELP (U"FormantFilter")
2981 }
2982
2983 FORM (GRAPHICS_EACH__FormantFilter_drawFilterFunctions, U"FormantFilter: Draw filter functions", U"FilterBank: Draw filter functions...") {
2984 INTEGER (fromFilter, U"left Filter range", U"0")
2985 INTEGER (toFilter, U"right Filter range", U"0")
2986 POSITIVE (bandwidth, U"Bandwidth (Hz)", U"100.0")
2987 CHOICE (frequencyScale, U"Frequency scale", 1)
2988 OPTION (U"Hertz")
2989 OPTION (U"Bark")
2990 OPTION (U"mel")
2991 REAL (fromFrequency, U"left Frequency range", U"0.0")
2992 REAL (toFrequency, U"right Frequency range", U"0.0")
2993 BOOLEAN (dBScale, U"Amplitude scale in dB", 1)
2994 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
2995 REAL (toAmplitude, U"right Amplitude range", U"0.0")
2996 BOOLEAN (garnish, U"Garnish", true)
2997 OK
2998 DO
2999 GRAPHICS_EACH (FormantFilter)
3000 FormantFilter_drawFilterFunctions (me, GRAPHICS, bandwidth, frequencyScale, fromFilter, toFilter,
3001 fromFrequency, toFrequency, dBScale, fromAmplitude, toAmplitude, garnish
3002 );
3003 GRAPHICS_EACH_END
3004 }
3005
3006 FORM (GRAPHICS_EACH__FormantFilter_drawSpectrum_slice, U"FormantFilter: Draw spectrum (slice)", U"FilterBank: Draw spectrum (slice)...") {
3007 REAL (time, U"Time (s)", U"0.1")
3008 REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
3009 REAL (toFrequency, U"right Frequency range (Hz)", U"0.0")
3010 REAL (fromAmplitude, U"left Amplitude range (dB)", U"0.0")
3011 REAL (toAmplitude, U"right Amplitude range (dB)", U"0.0")
3012 BOOLEAN (garnish, U"Garnish", true)
3013 OK
3014 DO
3015 GRAPHICS_EACH (FilterBank)
3016 FilterBank_drawTimeSlice (me, GRAPHICS, time, fromFrequency, toFrequency, fromAmplitude, toAmplitude, U"Hz", garnish);
3017 GRAPHICS_EACH_END
3018 }
3019
3020 /****************** FormantGrid *********************************/
3021
3022 FORM (GRAPHICS_EACH__old_FormantGrid_draw, U"FormantGrid: Draw", nullptr) {
3023 praat_TimeFunction_RANGE (fromTime, toTime)
3024 REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
3025 REAL (toFrequency, U"right Frequency range (Hz)", U"0.0 (= auto)")
3026 BOOLEAN (bandwidths, U"Bandwidths", false)
3027 BOOLEAN (garnish, U"Garnish", true)
3028 OK
3029 DO
3030 GRAPHICS_EACH (FormantGrid)
3031 FormantGrid_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, bandwidths, garnish, U"lines and speckles");
3032 GRAPHICS_EACH_END
3033 }
3034
3035 FORM (GRAPHICS_EACH__FormantGrid_draw, U"FormantGrid: Draw", nullptr) {
3036 praat_TimeFunction_RANGE (fromTime, toTime)
3037 REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
3038 REAL (toFrequency, U"right Frequency range (Hz)", U"0.0 (= auto)")
3039 BOOLEAN (bandwidths, U"Bandwidths", false)
3040 BOOLEAN (garnish, U"Garnish", true)
3041 COMMENT (U"")
3042 OPTIONMENUSTR (drawingMethod, U"Drawing method", 1)
3043 OPTION (U"lines")
3044 OPTION (U"speckles")
3045 OPTION (U"lines and speckles")
3046 OK
3047 DO_ALTERNATIVE (GRAPHICS_EACH__old_FormantGrid_draw)
3048 GRAPHICS_EACH (FormantGrid)
3049 FormantGrid_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, bandwidths, garnish, drawingMethod);
3050 GRAPHICS_EACH_END
3051 }
3052
3053 /****************** FunctionSeries *********************************/
3054
3055 FORM (GRAPHICS_EACH__FunctionSeries_draw, U"FunctionSeries: Draw", nullptr) {
3056 REAL (xmin, U"Xmin", U"0.0")
3057 REAL (xmax, U"Xmax", U"0.0")
3058 REAL (ymin, U"left Vertical range", U"0.0")
3059 REAL (ymax, U"right Vertical range", U"0.0")
3060 BOOLEAN (extrapolate, U"Extrapolate", false)
3061 BOOLEAN (garnish, U"Garnish", true)
3062 OK
3063 DO
3064 GRAPHICS_EACH (FunctionSeries)
3065 FunctionSeries_draw (me, GRAPHICS, xmin, xmax, ymin, ymax,extrapolate, garnish);
3066 GRAPHICS_EACH_END
3067 }
3068
3069 FORM (GRAPHICS_EACH__FunctionSeries_drawBasisFunction, U"FunctionSeries: Draw basis function", nullptr) {
3070 NATURAL (index, U"Index", U"1")
3071 REAL (xmin, U"Xmin", U"0.0")
3072 REAL (xmax, U"Xmax", U"0.0")
3073 REAL (ymin, U"left Vertical range", U"0.0")
3074 REAL (ymax, U"right Vertical range", U"0.0")
3075 BOOLEAN (extrapolate, U"Extrapolate", false)
3076 BOOLEAN (garnish, U"Garnish", true)
3077 OK
3078 DO
3079 GRAPHICS_EACH (FunctionSeries)
3080 FunctionSeries_drawBasisFunction (me, GRAPHICS, index, xmin, xmax, ymin, ymax, extrapolate, garnish);
3081 GRAPHICS_EACH_END
3082 }
3083
3084 FORM (QUERY_ONE_FOR_REAL__FunctionSeries_getValue, U"FunctionSeries: Evaluate", nullptr) {
3085 REAL (x, U"X", U"0.0")
3086 OK
3087 DO
3088 QUERY_ONE_FOR_REAL (FunctionSeries)
3089 const double result = FunctionSeries_evaluate (me, x);
3090 QUERY_ONE_FOR_REAL_END (U"")
3091 }
3092
3093 DIRECT (QUERY_ONE_FOR_INTEGER__FunctionSeries_getNumberOfCoefficients) {
3094 QUERY_ONE_FOR_INTEGER (FunctionSeries)
3095 const integer result = my numberOfCoefficients;
3096 QUERY_ONE_FOR_INTEGER_END (U"")
3097 }
3098
3099 FORM (QUERY_ONE_FOR_REAL__FunctionSeries_getCoefficient, U"FunctionSeries: Get coefficient", nullptr) {
3100 COMMENT (U"p(x) = c[1] + c[2] x + ... c[n+1] x^n")
3101 NATURAL (index, U"Index", U"1")
3102 OK
3103 DO
3104 QUERY_ONE_FOR_REAL (FunctionSeries)
3105 const double result = ( index > 0 && index <= my numberOfCoefficients ? my coefficients [index] : undefined );
3106 QUERY_ONE_FOR_REAL_END (U"")
3107 }
3108
3109 DIRECT (QUERY_ONE_FOR_INTEGER__FunctionSeries_getDegree) {
3110 QUERY_ONE_FOR_INTEGER (FunctionSeries)
3111 const integer result = FunctionSeries_getDegree (me);
3112 QUERY_ONE_FOR_INTEGER_END (U"")
3113 }
3114
3115 FORM (QUERY_ONE_FOR_REAL__FunctionSeries_getMaximum, U"FunctionSeries: Get maximum", U"Polynomial: Get maximum...") {
3116 COMMENT (U"Interval")
3117 REAL (xmin, U"Xmin", U"0.0")
3118 REAL (xmax, U"Xmax", U"0.0")
3119 OK
3120 DO
3121 QUERY_ONE_FOR_REAL (FunctionSeries)
3122 const double result = FunctionSeries_getMaximum (me, xmin, xmax);
3123 QUERY_ONE_FOR_REAL_END (U" (maximum)")
3124 }
3125
3126 FORM (QUERY_ONE_FOR_REAL__FunctionSeries_getMinimum, U"FunctionSeries: Get minimum", U"Polynomial: Get minimum...") {
3127 COMMENT (U"Interval")
3128 REAL (xmin, U"Xmin", U"0.0")
3129 REAL (xmax, U"Xmax", U"0.0")
3130 OK
3131 DO
3132 QUERY_ONE_FOR_REAL (FunctionSeries)
3133 const double result = FunctionSeries_getMinimum (me, xmin, xmax);
3134 QUERY_ONE_FOR_REAL_END (U" (minimum)")
3135 }
3136
3137 FORM (QUERY_ONE_FOR_REAL__FunctionSeries_getXOfMaximum, U"FunctionSeries: Get x of maximum", U"Polynomial: Get x of maximum...") {
3138 COMMENT (U"Interval")
3139 REAL (xmin, U"Xmin", U"0.0")
3140 REAL (xmax, U"Xmax", U"0.0")
3141 OK
3142 DO
3143 QUERY_ONE_FOR_REAL (FunctionSeries)
3144 const double result = FunctionSeries_getXOfMaximum (me, xmin, xmax);
3145 QUERY_ONE_FOR_REAL_END (U" (x of maximum)")
3146 }
3147
3148 FORM (QUERY_ONE_FOR_REAL__FunctionSeries_getXOfMinimum, U"FunctionSeries: Get x of minimum", U"Polynomial: Get x of minimum...") {
3149 COMMENT (U"Interval")
3150 REAL (xmin, U"Xmin", U"0.0")
3151 REAL (xmax, U"Xmax", U"0.0")
3152 OK
3153 DO
3154 QUERY_ONE_FOR_REAL (FunctionSeries)
3155 const double result = FunctionSeries_getXOfMinimum (me, xmin, xmax);
3156 QUERY_ONE_FOR_REAL_END (U" (x of minimum)")
3157 }
3158
3159 FORM (MODIFY_EACH__FunctionSeries_setCoefficient, U"FunctionSeries: Set coefficient", nullptr) {
3160 COMMENT (U"p(x) = c[1]F[0] + c[2]F[1] + ... c[n+1]F[n]")
3161 COMMENT (U"F[k] is of degree k")
3162 NATURAL (index, U"Index", U"1")
3163 REAL (value, U"Value", U"0.0")
3164 OK
3165 DO
3166 MODIFY_EACH (FunctionSeries)
3167 FunctionSeries_setCoefficient (me, index, value);
3168 MODIFY_EACH_END
3169 }
3170
3171 FORM (MODIFY_EACH__FunctionSeries_setDomain, U"FunctionSeries: Set domain", nullptr) {
3172 REAL (xmin, U"Xmin", U"0.0")
3173 REAL (xmax, U"Xmax", U"2.0")
3174 OK
3175 DO
3176 MODIFY_EACH (FunctionSeries)
3177 Melder_require (xmin < xmax,
3178 U"\"Xmin\" should be smaller than \"Xmax\"");
3179 FunctionSeries_setDomain (me, xmin, xmax);
3180 MODIFY_EACH_END
3181 }
3182
3183 /***************** Intensity ***************************************************/
3184
3185 FORM (CONVERT_EACH_TO_ONE__Intensity_to_TextGrid_silences, U"Intensity: To TextGrid (silences)", U"Intensity: To TextGrid (silences)...") {
3186 REAL (silenceThreshold, U"Silence threshold (dB)", U"-25.0")
3187 POSITIVE (minimumSilenceDuration, U"Minimum silent interval duration (s)", U"0.1")
3188 POSITIVE (minimumSoundingDuration, U"Minimum sounding interval duration (s)", U"0.05")
3189 WORD (silenceLabel, U"Silent interval label", U"silent")
3190 WORD (soundingLabel, U"Sounding interval label", U"sounding")
3191 OK
3192 DO
3193 CONVERT_EACH_TO_ONE (Intensity)
3194 autoTextGrid result = Intensity_to_TextGrid_detectSilences (me, silenceThreshold, minimumSilenceDuration,
3195 minimumSoundingDuration, silenceLabel, soundingLabel
3196 );
3197 CONVERT_EACH_TO_ONE_END (my name.get())
3198 }
3199
3200 FORM (QUERY_ONE_FOR_REAL__Intensity_getNearestLevelCrossing, U"Intensity: Get nearest level crossing", U"") {
3201 REAL (time, U"Time (s)", U"0.1")
3202 REAL (level, U"Level (dB)", U"60")
3203 OPTIONMENU_ENUM (kVectorSearchDirection, searchDirection, U"Search direction", kVectorSearchDirection::DEFAULT)
3204 OK
3205 DO
3206 QUERY_ONE_FOR_REAL (Intensity)
3207 const double result = Vector_getNearestLevelCrossing (me, 1, time, level, searchDirection);
3208 QUERY_ONE_FOR_REAL_END (U" seconds")
3209 }
3210
3211 /***************** IntensityTier ***************************************************/
3212
3213 FORM (CONVERT_EACH_TO_ONE__IntensityTier_to_TextGrid_silences, U"IntensityTier: To TextGrid (silences)", U"Intensity: To TextGrid (silences)...") {
3214 REAL (silenceThreshold, U"Silence threshold (dB)", U"-25.0")
3215 POSITIVE (minimumSilenceDuration, U"Minimum silent interval duration (s)", U"0.1")
3216 POSITIVE (minimumSoundingDuration, U"Minimum sounding interval duration (s)", U"0.05")
3217 WORD (silenceLabel, U"Silent interval label", U"silent")
3218 WORD (soundingLabel, U"Sounding interval label", U"sounding")
3219 POSITIVE (timeStep, U"Time step (s)", U"0.001")
3220 OK
3221 DO
3222 CONVERT_EACH_TO_ONE (IntensityTier)
3223 autoTextGrid result = IntensityTier_to_TextGrid_detectSilences (me, timeStep, silenceThreshold,
3224 minimumSilenceDuration, minimumSoundingDuration, silenceLabel, soundingLabel
3225 );
3226 CONVERT_EACH_TO_ONE_END (my name.get())
3227 }
3228
3229 FORM (CONVERT_EACH_TO_ONE__IntensityTier_to_Intensity, U"", nullptr) {
3230 POSITIVE (timeStep, U"Time step (s)", U"0.001")
3231 OK
3232 DO
3233 CONVERT_EACH_TO_ONE (IntensityTier)
3234 autoIntensity result = IntensityTier_to_Intensity (me, timeStep);
3235 CONVERT_EACH_TO_ONE_END (my name.get())
3236 }
3237
3238 /***************** ISpline ***************************************************/
3239
3240 DIRECT (HELP__ISpline_help) {
3241 HELP (U"ISpline")
3242 }
3243
3244 FORM (CREATE_ONE__ISpline_create, U"Create ISpline", U"Create ISpline...") {
3245 WORD (name, U"Name", U"ispline")
3246 COMMENT (U"Domain")
3247 REAL (xmin, U"Xmin", U"0")
3248 REAL (xmax, U"Xmax", U"1")
3249 COMMENT (U"ISpline(x) = c[1] I[1](x) + c[2] I[1](x) + ... c[n] I[n](x)")
3250 COMMENT (U"all I[k] are polynomials of degree \"Degree\"")
3251 COMMENT (U"Relation: numberOfCoefficients == numberOfInteriorKnots + degree")
3252 INTEGER (degree, U"Degree", U"3")
3253 REALVECTOR (coefficients, U"Coefficients (c[k])", WHITESPACE_SEPARATED_, U"1.2 2.0 1.2 1.2 3.0 0.0")
3254 REALVECTOR (interiorKnots, U"Interior knots", WHITESPACE_SEPARATED_, U"0.3 0.5 0.6")
3255 OK
3256 DO
3257 CREATE_ONE
3258 Melder_require (xmin < xmax,
3259 U"Xmin should be smaller than Xmax.");
3260 autoISpline result = ISpline_createWithCoefficients (xmin, xmax, degree, coefficients, interiorKnots);
3261 CREATE_ONE_END (name)
3262 }
3263
3264 /******************* KlattTable *********************************/
3265
3266 DIRECT (HELP__KlattTable_help) {
3267 HELP (U"KlattTable")
3268 }
3269
3270 DIRECT (CREATE_ONE__KlattTable_createExample) {
3271 CREATE_ONE
3272 autoKlattTable result = KlattTable_createExample ();
3273 CREATE_ONE_END (U"example")
3274 }
3275
3276 FORM (CONVERT_EACH_TO_ONE__KlattTable_to_Sound, U"KlattTable: To Sound", U"KlattTable: To Sound...") {
3277 POSITIVE (samplingFrequency, U"Sampling frequency (Hz)", U"16000")
3278 CHOICE (synthesisModel, U"Synthesis model", 1)
3279 OPTION (U"cascade")
3280 OPTION (U"parallel")
3281 NATURAL (numberOfFormants, U"Number of formants", U"5")
3282 POSITIVE (frameDuration, U"Frame duration (s)", U"0.005")
3283 REAL (flutter_percentage, U"Flutter percentage (%)", U"0.0") // ppgb: foutgevoelig
3284 OPTIONMENU (voicingSource, U"Voicing source", 1)
3285 OPTION (U"impulsive")
3286 OPTION (U"natural")
3287 OPTIONMENU (soundOutputType, U"Output type", 1)
3288 OPTION (U"sound")
3289 OPTION (U"voicing")
3290 OPTION (U"aspiration")
3291 OPTION (U"frication")
3292 OPTION (U"cascade-glottal-output")
3293 OPTION (U"parallel-glottal-output")
3294 OPTION (U"bypass-output")
3295 OPTION (U"all-excitations")
3296 OK
3297 DO
3298 Melder_require (flutter_percentage >= 0.0 && flutter_percentage <= 0.0,
3299 U"\"Flutter percentage\" should be between 0 and 100%.");
3300 CONVERT_EACH_TO_ONE (KlattTable)
3301 autoSound result = KlattTable_to_Sound (me, samplingFrequency, synthesisModel, numberOfFormants,
3302 frameDuration, voicingSource, flutter_percentage, soundOutputType
3303 );
3304 CONVERT_EACH_TO_ONE_END (my name.get())
3305 }
3306
3307 FORM (CONVERT_EACH_TO_ONE__KlattTable_to_KlattGrid, U"KlattTable: To KlattGrid", nullptr) {
3308 POSITIVE (frameDuration, U"Frame duration (s)", U"0.002")
3309 OK
3310 DO
3311 CONVERT_EACH_TO_ONE (KlattTable)
3312 autoKlattGrid result = KlattTable_to_KlattGrid (me, frameDuration);
3313 CONVERT_EACH_TO_ONE_END (my name.get())
3314 }
3315
3316 DIRECT (CONVERT_EACH_TO_ONE__KlattTable_to_Table) {
3317 CONVERT_EACH_TO_ONE (KlattTable)
3318 autoTable result = KlattTable_to_Table (me);
3319 CONVERT_EACH_TO_ONE_END (my name.get())
3320 }
3321
3322 DIRECT (CONVERT_EACH_TO_ONE__Table_to_KlattTable) {
3323 CONVERT_EACH_TO_ONE (Table)
3324 autoKlattTable result = Table_to_KlattTable (me);
3325 CONVERT_EACH_TO_ONE_END (my name.get())
3326 }
3327
3328 FORM (QUERY_ONE_FOR_REAL__Table_getMedianAbsoluteDeviation, U"Table: Get median absolute deviation", U"Table: Get median absolute deviation...") {
3329 SENTENCE (columnLabel, U"Column label", U"")
3330 OK
3331 DO
3332 QUERY_ONE_FOR_REAL (Table)
3333 const integer columnNumber = Table_columnNameToNumber_e (me, columnLabel);
3334 const double result = Table_getMedianAbsoluteDeviation (me, columnNumber);
3335 QUERY_ONE_FOR_REAL_END (U"")
3336 }
3337
3338 FORM (INFO_ONE__Table_reportRobustStatistics, U"Table: Report robust statistics", U"Table: Report robust statistics...") {
3339 SENTENCE (columnLabel, U"Column label", U"F1")
3340 POSITIVE (k_stdev, U"Number of standard deviations", U"1.5")
3341 POSITIVE (tolerance, U"Tolerance", U"1e-6")
3342 NATURAL (maximumNumberOfiterations, U"Maximum number of iterations", U"30")
3343 OK
3344 DO
3345 INFO_ONE (Table)
3346 const integer columnNumber = Table_columnNameToNumber_e (me, columnLabel);
3347 double location, scale;
3348 Table_reportHuberMStatistics (me, columnNumber, k_stdev, tolerance, & location, & scale, maximumNumberOfiterations);
3349 MelderInfo_open ();
3350 MelderInfo_writeLine (U"Location: ", location);
3351 MelderInfo_writeLine (U"Scale: ", scale);
3352 MelderInfo_close();
3353 INFO_ONE_END
3354 }
3355
3356 static void print_means (Table me);
3357 static void print_means (Table me) {
3358 Table_numericize_a (me, 2);
3359 Table_numericize_a (me, 3);
3360 if (my numberOfColumns < 3) {
3361 MelderInfo_writeLine (U"Table does not have the right format.");
3362 return;
3363 }
3364 MelderInfo_writeLine (
3365 Melder_padOrTruncateLeft (my columnHeaders [1]. label.get(), 15), U"\t",
3366 Melder_padOrTruncateLeft (my columnHeaders [2]. label.get(), 15), U"\t",
3367 Melder_padOrTruncateLeft (my columnHeaders [3]. label.get(), 15)
3368 );
3369 for (integer irow = 1; irow <= my rows.size; irow ++) {
3370 const TableRow row = my rows.at [irow];
3371 MelderInfo_writeLine (
3372 Melder_padOrTruncateLeft (row -> cells [1]. string.get(), 15), U"\t",
3373 Melder_padOrTruncateLeft (Melder_double (row -> cells [2]. number), 15), U"\t",
3374 Melder_padOrTruncateLeft (Melder_double (row -> cells [3]. number), 15)
3375 );
3376 }
3377 }
3378
3379 FORM (QUERY_ONE_FOR_INTEGER__Table_getNumberOfRowsWhere, U"", nullptr) {
3380 FORMULA (formula, U"Count only rows where the following condition holds", U"1; self$[\"gender\"]=\"M\"")
3381 OK
3382 DO
3383 QUERY_ONE_FOR_INTEGER (Table)
3384 const integer result = Table_getNumberOfRowsWhere (me, formula, interpreter);
3385 QUERY_ONE_FOR_INTEGER_END (U"")
3386 }
3387
3388 FORM (INFO_ONE__Table_reportOneWayAnova, U"Table: Report one-way anova", U"Table: Report one-way anova...") {
3389 SENTENCE (dataColumn_string, U"Column with data", U"F0")
3390 SENTENCE (factor_string, U"Factor", U"Vowel")
3391 BOOLEAN (wantMeans, U"Table with means", false);
3392 BOOLEAN (wantDifferencesBetweenMeans, U"Table with differences between means", false)
3393 BOOLEAN (wantTukeyPostHoc, U"Table with Tukey's post-hoc HSD test", false)
3394 OK
3395 DO
3396 INFO_ONE (Table)
3397 const integer factorColumn = Table_columnNameToNumber_e (me, factor_string);
3398 const integer dataColumn = Table_columnNameToNumber_e (me, dataColumn_string);
3399 autoTable means, meansDiff, meansDiffProbabilities;
3400 autoTable anova = Table_getOneWayAnalysisOfVarianceF (me, dataColumn, factorColumn, & means,
3401 & meansDiff, & meansDiffProbabilities);
3402 MelderInfo_open ();
3403 MelderInfo_writeLine (U"One-way analysis of \"", dataColumn_string, U"\" by \"", factor_string, U"\".\n");
3404 Table_printAsAnovaTable (anova.get());
3405 MelderInfo_writeLine (U"\nMeans:\n");
3406 print_means (means.get());
3407 MelderInfo_close ();
3408 if (wantMeans)
3409 praat_new (means.move(), my name.get(), U"_groupMeans");
3410 if (wantDifferencesBetweenMeans)
3411 praat_new (meansDiff.move(), my name.get(), U"_meansDiff");
3412 if (wantTukeyPostHoc)
3413 praat_new (meansDiffProbabilities.move(), my name.get(), U"_meansDiffP");
3414 INFO_ONE_END
3415 }
3416
3417 FORM (INFO_ONE__Table_reportTwoWayAnova, U"Table: Report two-way anova", U"Table: Report two-way anova...") {
3418 SENTENCE (dataColumn_string, U"Column with data", U"Data")
3419 SENTENCE (firstFactor_string, U"First factor", U"A")
3420 SENTENCE (secondFactor_string, U"Second factor", U"B")
3421 BOOLEAN (wantMeans, U"Table with means", false);
3422 OK
3423 DO
3424 INFO_ONE (Table)
3425 const integer firstFactorColumn = Table_columnNameToNumber_e (me, firstFactor_string);
3426 const integer secondFactorColumn = Table_columnNameToNumber_e (me, secondFactor_string);
3427 const integer dataColumn = Table_columnNameToNumber_e (me, dataColumn_string);
3428 autoTable means, sizes;
3429 autoTable anova = Table_getTwoWayAnalysisOfVarianceF (me, dataColumn, firstFactorColumn, secondFactorColumn, &means, &sizes);
3430 MelderInfo_open ();
3431 MelderInfo_writeLine (U"Two-way analysis of \"", dataColumn_string, U"\" by \"", firstFactor_string, U"\" and \"", secondFactor_string, U"\".\n");
3432 Table_printAsAnovaTable (anova.get());
3433 MelderInfo_writeLine (U"\nMeans:\n");
3434 Table_printAsMeansTable (means.get());
3435 MelderInfo_writeLine (U"\nCell sizes:\n");
3436 Table_printAsMeansTable (sizes.get());
3437 MelderInfo_close ();
3438 if (wantMeans)
3439 praat_new (means.move(), my name.get(), U"_groupMeans");
3440 INFO_ONE_END
3441 }
3442
3443 FORM (INFO_ONE__Table_reportOneWayKruskalWallis, U"Table: Report one-way Kruskal-Wallis", U"Table: Report one-way Kruskal-Wallis...") {
3444 SENTENCE (dataColumn_string, U"Column with data", U"Data")
3445 SENTENCE (factor_string, U"Factor", U"Group")
3446 OK
3447 DO
3448 INFO_ONE (Table)
3449 const integer factorColumn = Table_columnNameToNumber_e (me, factor_string);
3450 const integer dataColumn = Table_columnNameToNumber_e (me, dataColumn_string);
3451 double ndof, kruskalWallis, prob;
3452 autoTable result = Table_getOneWayKruskalWallis (me, dataColumn, factorColumn, & prob, & kruskalWallis, & ndof);
3453 MelderInfo_open ();
3454 MelderInfo_writeLine (U"One-way Kruskal-Wallis of \"", dataColumn_string, U"\" by \"", factor_string, U"\".\n");
3455 MelderInfo_writeLine (U"Chi squared: ", kruskalWallis);
3456 MelderInfo_writeLine (U"Degrees of freedom: ", ndof);
3457 MelderInfo_writeLine (U"Probability: ", prob);
3458 MelderInfo_writeLine (U"\nMeans:\n");
3459 print_means (result.get());
3460 MelderInfo_close ();
3461 INFO_ONE_END
3462 }
3463
3464 FORM (CONVERT_EACH_TO_ONE__Table_to_StringsIndex_column, U"Table: To StringsIndex (column)", nullptr) {
3465 SENTENCE (columnLabel, U"Column label", U"")
3466 OK
3467 DO
3468 CONVERT_EACH_TO_ONE (Table)
3469 const integer icol = Table_columnNameToNumber_e (me, columnLabel);
3470 autoStringsIndex result = Table_to_StringsIndex_column (me, icol, kStrings_sorting::NUMBER_AWARE);
3471 CONVERT_EACH_TO_ONE_END (my name.get(), U"_", columnLabel)
3472 }
3473
3474 /******************* LegendreSeries *********************************/
3475
3476 FORM (CREATE_ONE__LegendreSeries_create, U"Create LegendreSeries", U"Create LegendreSeries...") {
3477 WORD (name, U"Name", U"ls")
3478 COMMENT (U"Domain")
3479 REAL (xmin, U"Xmin", U"-1")
3480 REAL (xmax, U"Xmax", U"1")
3481 COMMENT (U"LegendreSeries(x) = c[1] P[0](x) + c[2] P[1](x) + ... c[n+1] P[n](x)")
3482 COMMENT (U"P[k] is a Legendre polynomial of degree k")
3483 REALVECTOR (coefficients, U"Coefficients", WHITESPACE_SEPARATED_, U"0 0 1.0")
3484 OK
3485 DO
3486 Melder_require (xmin < xmax,
3487 U"Xmin should be smaller than Xmax.");
3488 CREATE_ONE
3489 autoLegendreSeries result = LegendreSeries_createWithCoefficients (xmin, xmax, coefficients);
3490 CREATE_ONE_END (name)
3491 }
3492
3493 DIRECT (HELP__LegendreSeries_help) {
3494 HELP (U"LegendreSeries")
3495 }
3496
3497 DIRECT (CONVERT_EACH_TO_ONE__LegendreSeries_to_Polynomial) {
3498 CONVERT_EACH_TO_ONE (LegendreSeries)
3499 autoPolynomial result = LegendreSeries_to_Polynomial (me);
3500 CONVERT_EACH_TO_ONE_END (my name.get())
3501 }
3502
3503 /********************* LongSound **************************************/
3504
3505 FORM_READ (APPEND_ALL__LongSounds_appendToExistingSoundFile, U"LongSound: Append to existing sound file", 0, false) {
3506 APPEND_ALL (Sampled, U"append the selected LongSound object(s) to the existing sound file")
3507 LongSounds_appendToExistingSoundFile (& list, file);
3508 APPEND_ALL_END
3509 }
3510
3511 FORM_SAVE (SAVE_TWO__LongSounds_saveAsStereoAiffFile, U"LongSound: Save as AIFF file", 0, U"aiff") {
3512 SAVE_TWO (LongSound, U"save the selected LongSound objects to the AIFF file")
3513 LongSounds_writeToStereoAudioFile16 (me, you, Melder_AIFF, file);
3514 SAVE_TWO_END
3515 }
3516
3517 FORM_SAVE (SAVE_TWO__LongSounds_saveAsStereoAifcFile, U"LongSound: Save as AIFC file", 0, U"aifc") {
3518 SAVE_TWO (LongSound, U"save the selected LongSound objects to the AIFC file")
3519 LongSounds_writeToStereoAudioFile16 (me, you, Melder_AIFC, file);
3520 SAVE_TWO_END
3521 }
3522
3523 FORM_SAVE (SAVE_TWO__LongSounds_saveAsStereoWavFile, U"LongSound: Save as WAV file", 0, U"wav") {
3524 SAVE_TWO (LongSound, U"save the selected LongSound objects to the WAV file")
3525 LongSounds_writeToStereoAudioFile16 (me, you, Melder_WAV, file);
3526 SAVE_TWO_END
3527 }
3528
3529 FORM_SAVE (SAVE_TWO__LongSounds_saveAsStereoNextSunFile, U"LongSound: Save as NeXT/Sun file", 0, U"au") {
3530 SAVE_TWO (LongSound, U"save the selected LongSound objects to the NeXT/Sun file")
3531 LongSounds_writeToStereoAudioFile16 (me, you, Melder_NEXT_SUN, file);
3532 SAVE_TWO_END
3533 }
3534
3535 FORM_SAVE (SAVE_TWO__LongSounds_saveAsStereoNistFile, U"LongSound: Save as NIST file", 0, U"nist") {
3536 SAVE_TWO (LongSound, U"save the selected LongSound objects to the NIST file")
3537 LongSounds_writeToStereoAudioFile16 (me, you, Melder_NIST, file);
3538 SAVE_TWO_END
3539 }
3540
3541 /******************* Matrix **************************************************/
3542
3543 FORM (GRAPHICS_EACH__Matrix_drawAsSquares, U"Matrix: Draw as squares", U"Matrix: Draw as squares...") {
3544 REAL (xmin, U"left Horizontal range", U"0.0")
3545 REAL (xmax, U"right Horizontal range", U"0.0")
3546 REAL (ymin, U"left Vertical range", U"0.0")
3547 REAL (ymax, U"right Vertical range", U"0.0")
3548 BOOLEAN (garnish, U"Garnish", true)
3549 OK
3550 DO
3551 GRAPHICS_EACH (Matrix)
3552 Matrix_drawAsSquares (me, GRAPHICS, xmin, xmax, ymin, ymax, garnish);
3553 GRAPHICS_EACH_END
3554 }
3555
3556 FORM (GRAPHICS_EACH__Matrix_drawDistribution, U"Matrix: Draw distribution", U"Matrix: Draw distribution...") {
3557 COMMENT (U"Selection of (part of) Matrix")
3558 REAL (xmin, U"left Horizontal range", U"0.0")
3559 REAL (xmax, U"right Horizontal range", U"0.0")
3560 REAL (ymin, U"left Vertical range", U"0.0")
3561 REAL (ymax, U"right Vertical range", U"0.0")
3562 COMMENT (U"Selection of Matrix values")
3563 REAL (minimumValue, U"Minimum value", U"0.0")
3564 REAL (maximumValue, U"Maximum value", U"0.0")
3565 COMMENT (U"Display of the distribution")
3566 NATURAL (numberOfBins, U"Number of bins", U"10")
3567 REAL (minimumFrequency, U"Minimum frequency", U"0.0")
3568 REAL (maximumFrequency, U"Maximum frequency", U"0.0")
3569 BOOLEAN (garnish, U"Garnish", true)
3570 OK
3571 DO
3572 GRAPHICS_EACH (Matrix)
3573 Matrix_drawDistribution (me, GRAPHICS, xmin, xmax, ymin, ymax, minimumValue, maximumValue,
3574 numberOfBins, minimumFrequency, maximumFrequency, false, garnish
3575 );
3576 GRAPHICS_EACH_END
3577 }
3578
3579 FORM (GRAPHICS_EACH__Matrix_drawCumulativeDistribution, U"Matrix: Draw cumulative distribution", nullptr) {
3580 COMMENT (U"Selection of (part of) Matrix")
3581 REAL (xmin, U"left Horizontal range", U"0.0")
3582 REAL (xmax, U"right Horizontal range", U"0.0")
3583 REAL (ymin, U"left Vertical range", U"0.0")
3584 REAL (ymax, U"right Vertical range", U"0.0")
3585 COMMENT (U"Selection of Matrix values")
3586 REAL (minimumValue, U"Minimum value", U"0.0")
3587 REAL (maximumValue, U"Maximum value", U"0.0")
3588 COMMENT (U"Display of the distribution")
3589 NATURAL (numberOfBins, U"Number of bins", U"10")
3590 REAL (minimum, U"Minimum", U"0.0")
3591 REAL (maximum, U"Maximum", U"0.0")
3592 BOOLEAN (garnish, U"Garnish", true)
3593 OK
3594 DO
3595 GRAPHICS_EACH (Matrix)
3596 Matrix_drawDistribution (me, GRAPHICS, xmin, xmax, ymin, ymax, minimumValue, maximumValue,
3597 numberOfBins, minimum, maximum, true, garnish
3598 );
3599 GRAPHICS_EACH_END
3600 }
3601
3602 FORM (QUERY_ONE_FOR_REAL__Matrix_getMean, U"Matrix: Get mean", nullptr) {
3603 REAL (xmin, U"left Horizontal range", U"0.0")
3604 REAL (xmax, U"right Horizontal range", U"0.0")
3605 REAL (ymin, U"left Vertical range", U"0.0")
3606 REAL (ymax, U"right Vertical range", U"0.0")
3607 OK
3608 DO
3609 QUERY_ONE_FOR_REAL (Matrix)
3610 const double result = Matrix_getMean (me, xmin, xmax, ymin, ymax);
3611 QUERY_ONE_FOR_REAL_END (U" (mean)")
3612 }
3613
3614 FORM (QUERY_ONE_FOR_REAL__Matrix_getStandardDeviation, U"Matrix: Get standard deviation", nullptr) {
3615 REAL (xmin, U"left Horizontal range", U"0.0")
3616 REAL (xmax, U"right Horizontal range", U"0.0")
3617 REAL (ymin, U"left Vertical range", U"0.0")
3618 REAL (ymax, U"right Vertical range", U"0.0")
3619 OK
3620 DO
3621 QUERY_ONE_FOR_REAL (Matrix)
3622 const double result = Matrix_getStandardDeviation (me, xmin, xmax, ymin, ymax);
3623 QUERY_ONE_FOR_REAL_END (U" (std dev)")
3624 }
3625
3626 FORM (QUERY_ONE_FOR_REAL__Matrix_getNorm, U"Matrix: Get norm", U"Matrix: Get norm...") {
3627 REAL (power, U"Power", U"2.0")
3628 OK
3629 DO
3630 QUERY_ONE_FOR_REAL (Matrix)
3631 const double result = NUMnorm (my z.all(), power);
3632 QUERY_ONE_FOR_REAL_END (U" (norm with power = ", power, U")")
3633 }
3634
3635 FORM (MODIFY_Matrix_scale, U"Matrix: Scale", nullptr) {
3636 COMMENT (U"self[row, col] := self[row, col] / `Scale factor'")
3637 CHOICE (scaleMethod, U"Scale factor", 1)
3638 OPTION (U"extremum in matrix")
3639 OPTION (U"extremum in each row")
3640 OPTION (U"extremum in each column")
3641 OK
3642 DO
3643 MODIFY_EACH (Matrix)
3644 Matrix_scale (me, scaleMethod);
3645 MODIFY_EACH_END
3646 }
3647
3648 DIRECT (CONVERT_EACH_TO_ONE__Matrix_transpose) {
3649 CONVERT_EACH_TO_ONE (Matrix)
3650 autoMatrix result = Matrix_transpose (me);
3651 CONVERT_EACH_TO_ONE_END (my name.get(), U"_transposed")
3652 }
3653
3654 DIRECT (CONVERT_EACH_TO_ONE__Matrix_to_PCA_byColumns) {
3655 CONVERT_EACH_TO_ONE (Matrix)
3656 autoPCA result = Matrix_to_PCA_byColumns (me);
3657 CONVERT_EACH_TO_ONE_END (my name.get(), U"_columns");
3658 }
3659
3660 DIRECT (CONVERT_EACH_TO_ONE__Matrix_to_PCA_byRows) {
3661 CONVERT_EACH_TO_ONE (Matrix)
3662 autoPCA result = Matrix_to_PCA_byRows (me);
3663 CONVERT_EACH_TO_ONE_END (my name.get(), U"_rows")
3664 }
3665
3666 FORM (CONVERT_EACH_TO_ONE__Matrix_solveEquation, U"Matrix: Solve equation", U"Matrix: Solve equation...") {
3667 REAL (tolerance, U"Tolerance", U"1.0e-7")
3668 OK
3669 DO
3670 CONVERT_EACH_TO_ONE (Matrix)
3671 autoMatrix result = Matrix_solveEquation (me, tolerance);
3672 CONVERT_EACH_TO_ONE_END (my name.get(), U"_solution")
3673 }
3674
3675 FORM (CONVERT_TWO_TO_ONE__Matrix_solveMatrixEquation, U"Matrix: Solve matrix equation", U"Matrix: Solve matrix equation...") {
3676 REAL (tolerance, U"Tolerance", U"1.0e-7")
3677 OK
3678 DO
3679 CONVERT_TWO_TO_ONE (Matrix)
3680 autoMatrix result = Matrix_solveEquation (me, you, tolerance);
3681 CONVERT_TWO_TO_ONE_END (U"solution")
3682 }
3683
3684 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__Matrix_Categories_to_TableOfReal) {
3685 CONVERT_ONE_AND_ONE_GENERIC_TO_ONE (Categories, Matrix)
3686 autoTableOfReal result = Matrix_Categories_to_TableOfReal (you, me);
3687 CONVERT_ONE_AND_ONE_GENERIC_TO_ONE_END (my name.get(), U"_", your name.get())
3688 }
3689
3690 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__ActivationList_Categories_to_TableOfReal) {
3691 CONVERT_ONE_AND_ONE_TO_ONE (ActivationList, Categories)
3692 autoTableOfReal result = Matrix_Categories_to_TableOfReal (me, you);
3693 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
3694 }
3695
3696 FORM (GRAPHICS_EACH__Matrix_scatterPlot, U"Matrix: Scatter plot", nullptr) {
3697 NATURAL (xColumn, U"Column for X-axis", U"1")
3698 NATURAL (yColumn, U"Column for Y-axis", U"2")
3699 REAL (xmin, U"left Horizontal range", U"0.0")
3700 REAL (xmax, U"right Horizontal range", U"0.0")
3701 REAL (ymin, U"left Vertical range", U"0.0")
3702 REAL (ymax, U"right Vertical range", U"0.0")
3703 POSITIVE (markSize_mm, U"Mark size (mm)", U"1.0")
3704 SENTENCE (mark_string, U"Mark string (+xo.)", U"+")
3705 BOOLEAN (garnish, U"Garnish", true)
3706 OK
3707 DO
3708
3709 GRAPHICS_EACH (Matrix)
3710 Matrix_scatterPlot (me, GRAPHICS, xColumn, yColumn, xmin, xmax, ymin, ymax, markSize_mm, mark_string, garnish);
3711 GRAPHICS_EACH_END
3712 }
3713
3714 DIRECT (CONVERT_EACH_TO_ONE__Matrix_to_ActivationList) {
3715 CONVERT_EACH_TO_ONE (Matrix)
3716 autoActivationList result = Matrix_to_ActivationList (me);
3717 CONVERT_EACH_TO_ONE_END (my name.get())
3718 }
3719
3720 DIRECT (CONVERT_EACH_TO_ONE__Matrix_to_Eigen) {
3721 CONVERT_EACH_TO_ONE (Matrix)
3722 autoEigen result = Matrix_to_Eigen (me);
3723 CONVERT_EACH_TO_ONE_END (my name.get())
3724 }
3725
3726 FORM (CONVERT_EACH_TO_ONE__Matrix_to_Eigen_special, U"Matrix: To Eigen", U"Matrix: To Eigen") {
3727 OPTIONMENU_ENUM (kMAT_TYPE, matType, U"Matrix type", kMAT_TYPE::SYMMETRIC)
3728 INTEGER (numberOfEigenvalues, U"Number of eigenvalues", U"0 (=all)")
3729 BOOLEAN (sortAscending, U"Sort ascending", 0)
3730 OK
3731 DO
3732 CONVERT_EACH_TO_ONE (Matrix)
3733 autoEigen result = Matrix_to_Eigen_special (me, matType, numberOfEigenvalues, sortAscending);
3734 CONVERT_EACH_TO_ONE_END (my name.get())
3735 }
3736
3737 DIRECT (CONVERT_EACH_TO_ONE__Matrix_to_SVD) {
3738 CONVERT_EACH_TO_ONE (Matrix)
3739 autoSVD result = SVD_createFromGeneralMatrix (my z.get());
3740 CONVERT_EACH_TO_ONE_END (my name.get())
3741 }
3742
3743 DIRECT (CONVERT_EACH_TO_MULTIPLE_Matrix_eigen_complex) {
3744 CONVERT_EACH_TO_MULTIPLE (Matrix)
3745 autoMatrix vectors, values;
3746 Matrix_Eigen_complex (me, & vectors, & values);
3747 praat_new (vectors.move(), U"eigenvectors");
3748 praat_new (values.move(), U"eigenvalues");
3749 CONVERT_EACH_TO_MULTIPLE_END
3750 }
3751
3752 FORM (CONVERT_EACH_TO_ONE__Matrix_to_NMF_mu, U"Matrix: To NMF (m.u.)", U"Matrix: To NMF (m.u.)...") {
3753 NATURAL (numberOfFeatures, U"Number of features", U"2")
3754 INTEGER (maximumNumberOfIterations, U"Maximum number of iterations", U"400")
3755 REAL (tolx, U"Change tolerance", U"1e-9")
3756 REAL (told, U"Approximation tolerance", U"1e-9")
3757 OPTIONMENU_ENUM (kNMF_Initialization, initializationMethod, U"Initialisation method", kNMF_Initialization::RANDOM_UNIFORM)
3758 BOOLEAN (info, U"Info", 0)
3759 OK
3760 DO
3761 Melder_require (maximumNumberOfIterations >= 0,
3762 U"The maximum number of iterations should not be negative.");
3763 CONVERT_EACH_TO_ONE (Matrix)
3764 autoNMF result = Matrix_to_NMF_mu (me, numberOfFeatures, maximumNumberOfIterations, tolx, told, initializationMethod, info);
3765 CONVERT_EACH_TO_ONE_END (my name.get(), U"_mu")
3766 }
3767
3768 FORM (CONVERT_EACH_TO_ONE__Matrix_to_NMF_als, U"Matrix: To NMF (ALS)", U"Matrix: To NMF (ALS)...") {
3769 NATURAL (numberOfFeatures, U"Number of features", U"2")
3770 INTEGER (maximumNumberOfIterations, U"Maximum number of iterations", U"20")
3771 REAL (tolx, U"Change tolerance", U"1e-9")
3772 REAL (told, U"Approximation tolerance", U"1e-9")
3773 OPTIONMENU_ENUM (kNMF_Initialization, initializationMethod, U"Initialisation method", kNMF_Initialization::RANDOM_UNIFORM)
3774 BOOLEAN (info, U"Info", 0)
3775 OK
3776 DO
3777 Melder_require (maximumNumberOfIterations >= 0,
3778 U"The maximum number of iterations should not be negative.");
3779 CONVERT_EACH_TO_ONE (Matrix)
3780 autoNMF result = Matrix_to_NMF_als (me, numberOfFeatures, maximumNumberOfIterations, tolx, told, initializationMethod, info);
3781 CONVERT_EACH_TO_ONE_END (my name.get(), U"_als")
3782 }
3783
3784 FORM (CONVERT_EACH_TO_ONE__Matrix_to_NMF_is, U"Matrix: To NMF (IS)", U"Matrix: To NMF (IS)...") {
3785 NATURAL (numberOfFeatures, U"Number of features", U"2")
3786 INTEGER (maximumNumberOfIterations, U"Maximum number of iterations", U"20")
3787 REAL (tolx, U"Change tolerance", U"1e-9")
3788 REAL (told, U"Approximation tolerance", U"1e-9")
3789 OPTIONMENU_ENUM (kNMF_Initialization, initializationMethod, U"Initialisation method", kNMF_Initialization::RANDOM_UNIFORM)
3790 BOOLEAN (info, U"Info", 0)
3791 OK
3792 DO
3793 Melder_require (maximumNumberOfIterations >= 0,
3794 U"The maximum number of iterations should not be negative.");
3795 CONVERT_EACH_TO_ONE (Matrix)
3796 autoNMF result = Matrix_to_NMF_is (me, numberOfFeatures, maximumNumberOfIterations, tolx, told, initializationMethod, info);
3797 CONVERT_EACH_TO_ONE_END (my name.get(), U"_als")
3798 }
3799
3800 DIRECT (QUERY_ONE_AND_ONE_FOR_REAL__NMF_Matrix_getEuclideanDistance) {
3801 QUERY_ONE_AND_ONE_FOR_REAL (NMF, Matrix)
3802 const double result = NMF_getEuclideanDistance (me, your z.get());
3803 QUERY_ONE_AND_ONE_FOR_REAL_END (U" (= ", result / (your ny * your nx), U" * nrow * ncol)")
3804 }
3805
3806 DIRECT (QUERY_ONE_AND_ONE_FOR_REAL__NMF_Matrix_getItakuraSaitoDivergence) {
3807 QUERY_ONE_AND_ONE_FOR_REAL (NMF, Matrix)
3808 const double result = NMF_getItakuraSaitoDivergence (me, your z.get());
3809 QUERY_ONE_AND_ONE_FOR_REAL_END (U" (= ", result / (your ny * your nx), U" * nrow * ncol)")
3810 }
3811
3812 FORM (MODIFY_FIRST_OF_ONE_AND_ONE__NMF_Matrix_improveFactorization_mu, U"NMF & Matrix: Improve factorization (m.u.)", nullptr) {
3813 NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"100")
3814 REAL (tolx, U"Change tolerance", U"1e-9")
3815 REAL (told, U"Approximation tolerance", U"1e-9")
3816 BOOLEAN (info, U"Info", 0)
3817 OK
3818 DO
3819 MODIFY_FIRST_OF_ONE_AND_ONE (NMF, Matrix)
3820 NMF_improveFactorization_mu (me, your z.get(), maximumNumberOfIterations, tolx, told, info);
3821 MODIFY_FIRST_OF_ONE_AND_ONE_END
3822 }
3823
3824 FORM (MODIFY_FIRST_OF_ONE_AND_ONE__NMF_Matrix_improveFactorization_als, U"NMF & Matrix: Improve factorization (ALS)", nullptr) {
3825 NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"10")
3826 REAL (tolx, U"Change tolerance", U"1e-9")
3827 REAL (told, U"Approximation tolerance", U"1e-9")
3828 BOOLEAN (info, U"Info", 0)
3829 OK
3830 DO
3831 MODIFY_FIRST_OF_ONE_AND_ONE (NMF, Matrix)
3832 NMF_improveFactorization_als (me, your z.get(), maximumNumberOfIterations, tolx, told, info);
3833 MODIFY_FIRST_OF_ONE_AND_ONE_END
3834 }
3835
3836 FORM (MODIFY_FIRST_OF_ONE_AND_ONE__NMF_Matrix_improveFactorization_is, U"NMF & Matrix: Improve factorization (IS)", nullptr) {
3837 NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"10")
3838 REAL (tolx, U"Change tolerance", U"1e-9")
3839 REAL (told, U"Approximation tolerance", U"1e-9")
3840 BOOLEAN (info, U"Info", 0)
3841 OK
3842 DO
3843 MODIFY_FIRST_OF_ONE_AND_ONE (NMF, Matrix)
3844 NMF_improveFactorization_is (me, your z.get(), maximumNumberOfIterations, tolx, told, info);
3845 MODIFY_FIRST_OF_ONE_AND_ONE_END
3846 }
3847
3848 FORM (CONVERT_TWO_TO_ONE__Matrices_to_DTW, U"Matrices: To DTW", U"Matrix: To DTW...") {
3849 COMMENT (U"Distance between cepstral coefficients")
3850 REAL (distanceMetric, U"Distance metric", U"2.0")
3851 DTW_constraints_addCommonFields (matchStart, matchEnd, slopeConstraint)
3852 OK
3853 DO
3854 CONVERT_TWO_TO_ONE (Matrix)
3855 autoDTW result = Matrices_to_DTW (me, you, matchStart, matchEnd, slopeConstraint, distanceMetric);
3856 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
3857 }
3858
3859 FORM (CONVERT_EACH_TO_ONE__Matrix_to_PatternList, U"Matrix: To PatternList", nullptr) {
3860 NATURAL (join, U"Join", U"1")
3861 OK
3862 DO
3863 CONVERT_EACH_TO_ONE (Matrix)
3864 autoPatternList result = Matrix_to_PatternList (me, join);
3865 CONVERT_EACH_TO_ONE_END (my name.get())
3866 }
3867
3868 /**** Filterbank (deprecated) *******/
3869
3870 DIRECT (QUERY_ONE_FOR_REAL__FilterBank_getHighestFrequency) {
3871 QUERY_ONE_FOR_REAL (FilterBank)
3872 const double result = my ymax;
3873 QUERY_ONE_FOR_REAL_END (U" ", my v_getFrequencyUnit ())
3874 }
3875
3876 DIRECT (QUERY_ONE_FOR_REAL__FilterBank_getLowestFrequency) {
3877 QUERY_ONE_FOR_REAL (FilterBank)
3878 const double result = my ymin;
3879 QUERY_ONE_FOR_REAL_END (U" ", my v_getFrequencyUnit ())
3880 }
3881
3882 DIRECT (QUERY_ONE_FOR_INTEGER__FilterBank_getNumberOfFrequencies) {
3883 QUERY_ONE_FOR_INTEGER (FilterBank)
3884 const integer result = my ny;
3885 QUERY_ONE_FOR_INTEGER_END (U"")
3886 }
3887
3888 DIRECT (QUERY_ONE_FOR_REAL__FilterBank_getFrequencyDistance) {
3889 QUERY_ONE_FOR_REAL (FilterBank)
3890 const double result = my dy;
3891 QUERY_ONE_FOR_REAL_END (U" ", my v_getFrequencyUnit ())
3892 }
3893
3894 FORM (QUERY_ONE_FOR_REAL__FilterBank_getTimeFromColumn, U"Get time of column", nullptr) {
3895 NATURAL (columnNumber, U"Column number", U"1")
3896 OK
3897 DO
3898 QUERY_ONE_FOR_REAL (FilterBank)
3899 const double result = Matrix_columnToX (me, columnNumber);
3900 QUERY_ONE_FOR_REAL_END (U"")
3901 }
3902
3903 FORM (QUERY_ONE_FOR_REAL__FilterBank_getFrequencyFromRow, U"Get frequency of row", nullptr) {
3904 NATURAL (rowNumber, U"Row number", U"1")
3905 OK
3906 DO
3907 QUERY_ONE_FOR_REAL (FilterBank)
3908 const double result = Matrix_rowToY (me, rowNumber);
3909 QUERY_ONE_FOR_REAL_END (U" ", my v_getFrequencyUnit ())
3910 }
3911
3912 static double Matrix_getValueAtNearestColRow (Matrix me, double x, double y) {
3913 /*
3914 Compatibility with old behaviour. Having real values as arguments would suggest interpolation which is not done.
3915 */
3916 if ((y >= my ymin && y <= my ymax) && (x >= my xmin && x <= my xmax)) {
3917 integer icol = Matrix_xToNearestColumn (me, x);
3918 Melder_clip (1_integer, & icol, my nx);
3919 integer irow = Matrix_yToNearestRow (me, y);
3920 Melder_clip (1_integer, & irow, my ny);
3921 return my z [irow] [icol];
3922 } else
3923 return undefined;
3924 }
3925
3926 FORM (QUERY_ONE_FOR_REAL__FilterBank_getValueInCell, U"Get value in cell", nullptr) {
3927 REAL (time, U"Time (s)", U"0.5")
3928 POSITIVE (frequency, U"Frequency", U"1.0")
3929 OK
3930 DO
3931 QUERY_ONE_FOR_REAL (FilterBank)
3932 const double result = Matrix_getValueAtNearestColRow (me, time, frequency);
3933 QUERY_ONE_FOR_REAL_END (U"")
3934 }
3935
3936 /***** MATRIXFT *************/
3937
3938 DIRECT (QUERY_ONE_FOR_REAL__BandFilterSpectrogram_getHighestFrequency) {
3939 QUERY_ONE_FOR_REAL (BandFilterSpectrogram)
3940 const double result = my ymax;
3941 QUERY_ONE_FOR_REAL_END (U" ", my v_getFrequencyUnit ())
3942 }
3943
3944 DIRECT (QUERY_ONE_FOR_REAL__BandFilterSpectrogram_getLowestFrequency) {
3945 QUERY_ONE_FOR_REAL (BandFilterSpectrogram)
3946 const double result = my ymin;
3947 QUERY_ONE_FOR_REAL_END (U" ", my v_getFrequencyUnit ())
3948 }
3949
3950 DIRECT (QUERY_ONE_FOR_INTEGER__BandFilterSpectrogram_getNumberOfFrequencies) {
3951 QUERY_ONE_FOR_INTEGER (BandFilterSpectrogram)
3952 const integer result = my ny;
3953 QUERY_ONE_FOR_INTEGER_END (U"")
3954 }
3955
3956 DIRECT (QUERY_ONE_FOR_REAL__BandFilterSpectrogram_getFrequencyDistance) {
3957 QUERY_ONE_FOR_REAL (BandFilterSpectrogram)
3958 const double result = my dy;
3959 QUERY_ONE_FOR_REAL_END (U" ", my v_getFrequencyUnit ())
3960 }
3961
3962 FORM (QUERY_ONE_FOR_REAL__BandFilterSpectrogram_getFrequencyFromRow, U"Get frequency of row", nullptr) {
3963 NATURAL (rowNumber, U"Row number", U"1")
3964 OK
3965 DO
3966 QUERY_ONE_FOR_REAL (BandFilterSpectrogram)
3967 const double result = Matrix_rowToY (me, rowNumber);
3968 QUERY_ONE_FOR_REAL_END (U" ", my v_getFrequencyUnit ())
3969 }
3970
3971 FORM (QUERY_ONE_FOR_REAL__BandFilterSpectrogram_getTimeFromColumn, U"Get time of column", nullptr) {
3972 NATURAL (columnNumber, U"Column number", U"1")
3973 OK
3974 DO
3975 QUERY_ONE_FOR_REAL (BandFilterSpectrogram)
3976 const double result = Matrix_columnToX (me, columnNumber);
3977 QUERY_ONE_FOR_REAL_END (U" s")
3978 }
3979
3980 FORM (QUERY_ONE_FOR_REAL__BandFilterSpectrogram_getValueInCell, U"Get value in cell", nullptr) {
3981 REAL (time, U"Time (s)", U"0.5")
3982 POSITIVE (frequency, U"Frequency", U"1")
3983 OK
3984 DO
3985 QUERY_ONE_FOR_REAL (BandFilterSpectrogram)
3986 const double result = Matrix_getValueAtNearestColRow (me, time, frequency);
3987 QUERY_ONE_FOR_REAL_END (U"")
3988 }
3989
3990 /**************** MelFilter *******************************************/
3991
3992 DIRECT (HELP__MelFilter_help) {
3993 HELP (U"MelFilter")
3994 }
3995
3996 DIRECT (HELP__MelSpectrogram_help) {
3997 HELP (U"MelSpectrogram")
3998 }
3999
4000 FORM (GRAPHICS_EACH__MelFilter_drawFilterFunctions, U"MelFilter: Draw filter functions", U"FilterBank: Draw filter functions...") {
4001 INTEGER (fromFilter, U"left Filter range", U"0")
4002 INTEGER (toFilter, U"right Filter range", U"0")
4003 CHOICE (frequencyScale, U"Frequency scale", 1)
4004 OPTION (U"Hertz")
4005 OPTION (U"Bark")
4006 OPTION (U"mel")
4007 REAL (fromFrequency, U"left Frequency range", U"0.0")
4008 REAL (toFrequency, U"right Frequency range", U"0.0")
4009 BOOLEAN (dBScale, U"Amplitude scale in dB", false)
4010 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
4011 REAL (toAmplitude, U"right Amplitude range", U"0.0")
4012 BOOLEAN (garnish, U"Garnish", true)
4013 OK
4014 DO
4015 GRAPHICS_EACH (MelFilter)
4016 MelFilter_drawFilterFunctions (me, GRAPHICS, frequencyScale, fromFilter, toFilter,
4017 fromFrequency, toFrequency, dBScale, fromAmplitude, toAmplitude, garnish
4018 );
4019 GRAPHICS_EACH_END
4020 }
4021
4022 FORM (GRAPHICS_EACH__MelSpectrogram_drawTriangularFilterFunctions, U"MelSpectrogram: Draw triangulat filter functions", U"MelSpectrogram: Draw filter functions...") {
4023 INTEGER (fromFilter, U"left Filter range", U"0")
4024 INTEGER (toFilter, U"right Filter range", U"0")
4025 CHOICE (frequencyScale, U"Frequency scale", 1)
4026 OPTION (U"mel")
4027 OPTION (U"Hertz")
4028 REAL (fromFrequency, U"left Frequency range", U"0.0")
4029 REAL (toFrequency, U"right Frequency range", U"0.0")
4030 BOOLEAN (dBScale, U"Amplitude scale in dB", false)
4031 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
4032 REAL (toAmplitude, U"right Amplitude range", U"0.0")
4033 BOOLEAN (garnish, U"Garnish", true)
4034 OK
4035 DO
4036 GRAPHICS_EACH (MelSpectrogram)
4037 MelSpectrogram_drawTriangularFilterFunctions (me, GRAPHICS, frequencyScale - 1, fromFilter, toFilter,
4038 fromFrequency, toFrequency, dBScale, fromAmplitude, toAmplitude, garnish
4039 );
4040 GRAPHICS_EACH_END
4041 }
4042
4043 FORM (GRAPHICS_EACH__MelFilter_drawSpectrum, U"MelFilter: Draw spectrum (slice)", U"FilterBank: Draw spectrum (slice)...") {
4044 REAL (time, U"Time (s)", U"0.1")
4045 REAL (fromFrequency, U"left Frequency range (mel)", U"0.0")
4046 REAL (toFrequency, U"right Frequency range (mel)", U"0.0")
4047 REAL (fromAmplitude, U"left Amplitude range (dB)", U"0.0")
4048 REAL (toAmplitude, U"right Amplitude range (dB)", U"0.0")
4049 BOOLEAN (garnish, U"Garnish", true)
4050 OK
4051 DO
4052 GRAPHICS_EACH (FilterBank)
4053 FilterBank_drawTimeSlice (me, GRAPHICS, time, fromFrequency, toFrequency, fromAmplitude, toAmplitude, U"Mels", garnish);
4054 GRAPHICS_EACH_END
4055 }
4056
4057 FORM (GRAPHICS_EACH__MelSpectrogram_drawSpectrumAtNearestTimeSlice, U"MelSpectrogram: Draw spectrum at nearest time slice", U"BandFilterSpectrogram: Draw spectrum at nearest time slice...") {
4058 REAL (time, U"Time (s)", U"0.1")
4059 REAL (fromFrequency, U"left Frequency range (mel)", U"0.0")
4060 REAL (toFrequency, U"right Frequency range (mel)", U"0.0")
4061 REAL (fromAmplitude, U"left Amplitude range (dB)", U"0.0")
4062 REAL (toAmplitude, U"right Amplitude range (dB)", U"0.0")
4063 BOOLEAN (garnish, U"Garnish", true)
4064 OK
4065 DO
4066 GRAPHICS_EACH (MelSpectrogram)
4067 BandFilterSpectrogram_drawSpectrumAtNearestTimeSlice (me, GRAPHICS, time, fromFrequency, toFrequency,
4068 fromAmplitude, toAmplitude, garnish
4069 );
4070 GRAPHICS_EACH_END
4071 }
4072
4073 FORM (GRAPHICS_EACH__BarkSpectrogram_drawSpectrumAtNearestTimeSlice, U"BarkSpectrogram: Draw spectrum at nearest time slice", U"BandFilterSpectrogram: Draw spectrum at nearest time slice...") {
4074 REAL (time, U"Time (s)", U"0.1")
4075 REAL (fromFrequency, U"left Frequency range (bark)", U"0.0")
4076 REAL (toFrequency, U"right Frequency range (bark)", U"0.0")
4077 REAL (fromAmplitude, U"left Amplitude range (dB)", U"0.0")
4078 REAL (toAmplitude, U"right Amplitude range (dB)", U"0.0")
4079 BOOLEAN (garnish, U"Garnish", true)
4080 OK
4081 DO
4082 GRAPHICS_EACH (MelSpectrogram)
4083 BandFilterSpectrogram_drawSpectrumAtNearestTimeSlice (me, GRAPHICS, time,
4084 fromFrequency, toFrequency, fromAmplitude, toAmplitude, garnish
4085 );
4086 GRAPHICS_EACH_END
4087 }
4088
4089 FORM (GRAPHICS_EACH__MelFilter_paint, U"FilterBank: Paint", nullptr) {
4090 praat_TimeFunction_RANGE (fromTime, toTime)
4091 REAL (fromFrequency, U"left Frequency range (mel)", U"0.0")
4092 REAL (toFrequency, U"right Frequency range (mel)", U"0.0")
4093 REAL (fromAmplitude, U"left Amplitude range", U"0.0")
4094 REAL (toAmplitude, U"right Amplitude range", U"0.0")
4095 BOOLEAN (garnish, U"Garnish", false)
4096 OK
4097 DO
4098 GRAPHICS_EACH (MelFilter)
4099 FilterBank_paint (me, GRAPHICS,
4100 fromTime, toTime, fromFrequency, toFrequency, fromAmplitude, toAmplitude, garnish
4101 );
4102 GRAPHICS_EACH_END
4103 }
4104
4105 FORM (CONVERT_EACH_TO_ONE__MelFilter_to_MFCC, U"MelFilter: To MFCC", U"MelSpectrogram: To MFCC...") {
4106 NATURAL (numberOfCoefficients, U"Number of coefficients", U"12")
4107 OK
4108 DO
4109 CONVERT_EACH_TO_ONE (MelFilter)
4110 autoMFCC result = MelFilter_to_MFCC (me, numberOfCoefficients);
4111 CONVERT_EACH_TO_ONE_END (my name.get())
4112 }
4113
4114 FORM (CONVERT_EACH_TO_ONE__MelSpectrogram_to_MFCC, U"MelSpectrogram: To MFCC", U"MelSpectrogram: To MFCC...") {
4115 NATURAL (numberOfCoefficients, U"Number of coefficients", U"12")
4116 OK
4117 DO
4118 CONVERT_EACH_TO_ONE (MelSpectrogram)
4119 autoMFCC result = MelSpectrogram_to_MFCC (me, numberOfCoefficients);
4120 CONVERT_EACH_TO_ONE_END (my name.get())
4121 }
4122
4123 /**************** Ltas *******************************************/
4124
4125 #include "../kar/UnicodeData.h"
4126 FORM (INFO_ONE__Ltas_reportSpectralTrend, U"Ltas: Report spectral trend", nullptr) {
4127 POSITIVE (fromFrequency, U"left Frequency range (Hz)", U"100.0")
4128 POSITIVE (toFrequency, U"right Frequency range (Hz)", U"5000.0")
4129 OPTIONMENU (frequencyScale, U"Frequency scale", 1)
4130 OPTION (U"linear")
4131 OPTION (U"logarithmic")
4132 OPTIONMENU (fitMethod, U"Fit method", 2)
4133 OPTION (U"least squares")
4134 OPTION (U"robust")
4135 OK
4136 DO
4137 bool logScale = frequencyScale == 2;
4138 INFO_ONE (Ltas)
4139 double a, b;
4140 Ltas_fitTrendLine (me, fromFrequency, toFrequency, logScale, fitMethod, &a, &b);
4141 MelderInfo_open ();
4142 MelderInfo_writeLine (U"Spectral model: amplitude_dB(frequency_Hz) " UNITEXT_ALMOST_EQUAL_TO " ", logScale ? U"offset + slope * log (frequency_Hz)" : U"offset + slope * frequency_Hz");
4143 MelderInfo_writeLine (U"Slope: ", a, logScale ? U" dB/decade" : U" dB/Hz");
4144 MelderInfo_writeLine (U"Offset: ", b, U" dB");
4145 MelderInfo_close ();
4146 INFO_ONE_END
4147 }
4148
4149
4150 /**************** MFCC *******************************************/
4151
4152 DIRECT (HELP__MFCC_help) {
4153 HELP (U"MFCC")
4154 }
4155
4156 FORM (CONVERT_EACH_TO_ONE__MFCC_to_MelFilter, U"MFCC: To MelFilter", nullptr) {
4157 INTEGER (fromCoefficient, U"From coefficient", U"0")
4158 INTEGER (toCoefficient, U"To coefficient", U"0")
4159 OK
4160 DO
4161 CONVERT_EACH_TO_ONE (MFCC)
4162 autoMelFilter result = MFCC_to_MelFilter (me, fromCoefficient, toCoefficient);
4163 CONVERT_EACH_TO_ONE_END (my name.get())
4164 }
4165
4166 FORM (CONVERT_EACH_TO_ONE__MFCC_to_MelSpectrogram, U"MFCC: MelSpectrogram", U"MFCC: To MelSpectrogram...") {
4167 INTEGER (fromCoefficient, U"From coefficient", U"0")
4168 INTEGER (toCoefficient, U"To coefficient", U"0")
4169 BOOLEAN (includeConstant, U"Include constant term", true)
4170 OK
4171 DO
4172 CONVERT_EACH_TO_ONE (MFCC)
4173 autoMelSpectrogram result = MFCC_to_MelSpectrogram (me, fromCoefficient, toCoefficient, includeConstant);
4174 CONVERT_EACH_TO_ONE_END (my name.get())
4175 }
4176
4177 FORM (CONVERT_EACH_TO_ONE__MFCC_to_TableOfReal, U"MFCC: To TableOfReal", U"MFCC: To TableOfReal...") {
4178 BOOLEAN (includeEnergy, U"Include energy", false)
4179 OK
4180 DO
4181 CONVERT_EACH_TO_ONE (MFCC)
4182 autoTableOfReal result = MFCC_to_TableOfReal (me, includeEnergy);
4183 CONVERT_EACH_TO_ONE_END (my name.get())
4184 }
4185
4186 FORM (CONVERT_EACH_TO_ONE__MFCC_to_Matrix_features, U"MFCC: To Matrix (features)", nullptr) {
4187 POSITIVE (windowLength, U"Window length (s)", U"0.025")
4188 BOOLEAN (includeEnergy, U"Include energy", false)
4189 OK
4190 DO
4191 CONVERT_EACH_TO_ONE (MFCC)
4192 autoMatrix result = MFCC_to_Matrix_features (me, windowLength, includeEnergy);
4193 CONVERT_EACH_TO_ONE_END (my name.get())
4194 }
4195
4196 FORM (CONVERT_TWO_TO_ONE__MFCCs_crossCorrelate, U"MFCC & MFCC: Cross-correlate", nullptr) {
4197 CHOICE_ENUM (kSounds_convolve_scaling, amplitudeScaling,
4198 U"Amplitude scaling", kSounds_convolve_scaling::DEFAULT)
4199 CHOICE_ENUM (kSounds_convolve_signalOutsideTimeDomain, signalOutsideTimeDomainIs,
4200 U"Signal outside time domain is...", kSounds_convolve_signalOutsideTimeDomain::DEFAULT)
4201 OK
4202 DO
4203 CONVERT_TWO_TO_ONE (MFCC)
4204 autoSound result = MFCCs_crossCorrelate (me, you, amplitudeScaling, signalOutsideTimeDomainIs);
4205 CONVERT_TWO_TO_ONE_END (my name.get(), U"_",your name.get())
4206 }
4207
4208 FORM (CONVERT_TWO_TO_ONE__MFCCs_convolve, U"MFCC & MFCC: Convolve", nullptr) {
4209 CHOICE_ENUM (kSounds_convolve_scaling, amplitudeScaling,
4210 U"Amplitude scaling", kSounds_convolve_scaling::DEFAULT)
4211 CHOICE_ENUM (kSounds_convolve_signalOutsideTimeDomain, signalOutsideTimeDomainIs,
4212 U"Signal outside time domain is...", kSounds_convolve_signalOutsideTimeDomain::DEFAULT)
4213 OK
4214 DO
4215 CONVERT_TWO_TO_ONE (MFCC)
4216 autoSound result = MFCCs_convolve (me, you, amplitudeScaling, signalOutsideTimeDomainIs);
4217 CONVERT_TWO_TO_ONE_END (my name.get(), U"_",your name.get())
4218 }
4219
4220 DIRECT (CONVERT_EACH_TO_ONE__MFCC_to_Sound) {
4221 CONVERT_EACH_TO_ONE (MFCC)
4222 autoSound result = MFCC_to_Sound (me);
4223 CONVERT_EACH_TO_ONE_END (my name.get())
4224 }
4225
4226 /**************** MSpline *******************************************/
4227
4228 FORM (CREATE_ONE__MSpline_create, U"Create MSpline", U"Create MSpline...") {
4229 WORD (name, U"Name", U"mspline")
4230 COMMENT (U"Domain")
4231 REAL (xmin, U"Xmin", U"0")
4232 REAL (xmax, U"Xmax", U"1")
4233 COMMENT (U"MSpline(x) = c[1] M[1](x) + c[2] M[1](x) + ... c[n] M[n](x)")
4234 COMMENT (U"all M[k] are polynomials of degree \"Degree\"")
4235 COMMENT (U"Relation: numberOfCoefficients == numberOfInteriorKnots + degree + 1")
4236 INTEGER (degree, U"Degree", U"2")
4237 REALVECTOR (coefficients, U"Coefficients (c[k])", WHITESPACE_SEPARATED_, U"1.2 2.0 1.2 1.2 3.0 0.0")
4238 REALVECTOR (interiorKnots, U"Interior knots", WHITESPACE_SEPARATED_, U"0.3 0.5 0.6")
4239 OK
4240 DO
4241 Melder_require (xmin < xmax,
4242 U"\"Xmin\" should be smaller than \"Xmax\".");
4243 CREATE_ONE
4244 autoMSpline result = MSpline_createWithCoefficients (xmin, xmax, degree, coefficients, interiorKnots);
4245 CREATE_ONE_END (name)
4246 }
4247
4248 DIRECT (HELP__MSpline_help) {
4249 HELP (U"MSpline")
4250 }
4251
4252 FORM (MODIFY_EACH__NavigationContext_modifyUseCriterion, U"NavigationContext: Modify use criterion", nullptr) {
4253 OPTIONMENU_ENUM (kContext_combination, combinationCriterion, U"Use criterion", kContext_combination::DEFAULT)
4254 BOOLEAN (excludeTopic, U"Exclude topic", false)
4255 OK
4256 DO
4257 MODIFY_EACH (NavigationContext)
4258 NavigationContext_modifyUseCriterion (me, combinationCriterion, excludeTopic);
4259 MODIFY_EACH_END
4260 }
4261
4262 FORM (MODIFY_EACH__NavigationContext_modifyTopicCriterion, U"NavigationContext: Modify Topic match criterion", nullptr) {
4263 OPTIONMENU_ENUM (kMelder_string, criterion, U"Match criterion", kMelder_string::DEFAULT)
4264 OPTIONMENU_ENUM (kMatchBoolean, topicMatchBoolean, U"Combine topic matches with", kMatchBoolean::OR_)
4265 OK
4266 DO
4267 MODIFY_EACH (NavigationContext)
4268 NavigationContext_modifyTopicCriterion (me, criterion, topicMatchBoolean);
4269 MODIFY_EACH_END
4270 }
4271
4272 FORM (MODIFY_EACH__NavigationContext_modifyBeforeCriterion, U"NavigationContext: Modify Before match criterion", nullptr) {
4273 OPTIONMENU_ENUM (kMelder_string, criterion, U"Match criterion", kMelder_string::DEFAULT)
4274 OPTIONMENU_ENUM (kMatchBoolean, beforeMatchBoolean, U"Combine before matches with", kMatchBoolean::OR_)
4275 OK
4276 DO
4277 MODIFY_EACH (NavigationContext)
4278 NavigationContext_modifyBeforeCriterion (me, criterion, beforeMatchBoolean);
4279 MODIFY_EACH_END
4280 }
4281
4282 FORM (MODIFY_EACH__NavigationContext_modifyAfterCriterion, U"NavigationContext: Modify After match criterion", nullptr) {
4283 OPTIONMENU_ENUM (kMelder_string, criterion, U"Match criterion", kMelder_string::DEFAULT)
4284 OPTIONMENU_ENUM (kMatchBoolean, afterMatchBoolean, U"Combine after matches with", kMatchBoolean::OR_)
4285 OK
4286 DO
4287 MODIFY_EACH (NavigationContext)
4288 NavigationContext_modifyAfterCriterion (me, criterion, afterMatchBoolean);
4289 MODIFY_EACH_END
4290 }
4291
4292 DIRECT (MODIFY_FIRST_OF_ONE_AND_ONE__NavigationContext_replaceTopicLabels) {
4293 MODIFY_FIRST_OF_ONE_AND_ONE (NavigationContext, Strings)
4294 NavigationContext_replaceTopicLabels (me, you);
4295 MODIFY_FIRST_OF_ONE_AND_ONE_END
4296 }
4297
4298 DIRECT (MODIFY_FIRST_OF_ONE_AND_ONE__NavigationContext_replaceBeforeLabels) {
4299 MODIFY_FIRST_OF_ONE_AND_ONE (NavigationContext, Strings)
4300 NavigationContext_replaceBeforeLabels (me, you);
4301 MODIFY_FIRST_OF_ONE_AND_ONE_END
4302 }
4303
4304 DIRECT (MODIFY_FIRST_OF_ONE_AND_ONE__NavigationContext_replaceAfterLabels) {
4305 MODIFY_FIRST_OF_ONE_AND_ONE (NavigationContext, Strings)
4306 NavigationContext_replaceAfterLabels (me, you);
4307 MODIFY_FIRST_OF_ONE_AND_ONE_END
4308 }
4309
4310
4311 FORM (CONVERT_ONE_AND_ONE_TO_ONE__TextGrid_and_NavigationContext_to_TextGridNavigator, U"TextGrid & NavigationContext: To TextGridNavigator", nullptr) {
4312 NATURAL (tierNumber, U"Tier number", U"1")
4313 OPTIONMENU_ENUM (kMatchDomain, matchDomain, U"Match domain", kMatchDomain::DEFAULT)
4314 OK
4315 DO
4316 CONVERT_ONE_AND_ONE_TO_ONE (TextGrid, NavigationContext)
4317 autoTextGridNavigator result = TextGrid_and_NavigationContext_to_TextGridNavigator (me, you, tierNumber, matchDomain);
4318 CONVERT_ONE_AND_ONE_TO_ONE_END (U"tgn")
4319 }
4320
4321 FORM (CONVERT_ONE_AND_ONE_TO_ONE__TextGrid_and_NavigationContext_to_TextGridTierNavigator, U"TextGrid & NavigationContext: To TextGridTierNavigator", nullptr) {
4322 NATURAL (tierNumber, U"Tier number", U"1")
4323 OPTIONMENU_ENUM (kMatchDomain, matchDomain, U"Match domain", kMatchDomain::DEFAULT)
4324 OK
4325 DO
4326 CONVERT_ONE_AND_ONE_TO_ONE (TextGrid, NavigationContext)
4327 autoTextGridTierNavigator result = TextGrid_and_NavigationContext_to_TextGridTierNavigator (me, you, tierNumber, matchDomain);
4328 CONVERT_ONE_AND_ONE_TO_ONE_END (U"ttgn_", tierNumber)
4329 }
4330
4331 DIRECT (HELP__NMF_help) {
4332 HELP (U"NMF")
4333 }
4334
4335 FORM (GRAPHICS_EACH__NMF_paintFeatures, U"NMF: Paint features", U"") {
4336 NATURAL (fromFeature, U"From feature", U"1")
4337 INTEGER (toFeature, U"To feature", U"0 (= all)")
4338 NATURAL (fromRow, U"From row", U"1")
4339 INTEGER (toRow, U"To row", U"0 (= all)")
4340 REAL (minimum, U"Minimum", U"0.0")
4341 REAL (maximum, U"maximum", U"0.0")
4342 BOOLEAN (garnish, U"Garnish", 1)
4343 OK
4344 DO
4345 GRAPHICS_EACH (NMF)
4346 NMF_paintFeatures (me, GRAPHICS, fromFeature, toFeature, fromRow, toRow, minimum, maximum, 0, 0, garnish);
4347 GRAPHICS_EACH_END
4348 }
4349
4350 FORM (GRAPHICS_EACH__NMF_paintWeights, U"NMF: Paint weights", U"") {
4351 NATURAL (fromWeight, U"From weight", U"1")
4352 INTEGER (toWeight, U"To weight", U"0 (= all)")
4353 NATURAL (fromRow, U"From row", U"1")
4354 INTEGER (toRow, U"To row", U"0 (= all)")
4355 REAL (minimum, U"Minimum", U"0.0")
4356 REAL (maximum, U"maximum", U"0.0")
4357 BOOLEAN (garnish, U"Garnish", 1)
4358 OK
4359 DO
4360 GRAPHICS_EACH (NMF)
4361 NMF_paintWeights (me, GRAPHICS, fromWeight, toWeight, fromRow, toRow, minimum, maximum, 0, 0, garnish);
4362 GRAPHICS_EACH_END
4363 }
4364
4365 DIRECT (CONVERT_EACH_TO_ONE__NMF_to_Matrix) {
4366 CONVERT_EACH_TO_ONE (NMF)
4367 autoMatrix result = NMF_to_Matrix (me);
4368 CONVERT_EACH_TO_ONE_END (my name.get())
4369 }
4370
4371 /********************** PatternList *******************************************/
4372
4373 DIRECT (CONVERT_ONE_AND_ONE__TO_ONE_PatternList_Categories_to_Discriminant) {
4374 CONVERT_ONE_AND_ONE_TO_ONE (PatternList, Categories)
4375 autoDiscriminant result = PatternList_Categories_to_Discriminant (me, you);
4376 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
4377 }
4378
4379 FORM (GRAPHICS_EACH__PatternList_draw, U"PatternList: Draw", nullptr) {
4380 NATURAL (patternNumber, U"Pattern number", U"1")
4381 REAL (xmin, U"left Horizontal range", U"0.0")
4382 REAL (xmax, U"right Horizontal range", U"0.0")
4383 REAL (ymin, U"left Vertical range", U"0.0")
4384 REAL (ymax, U"right Vertical range", U"0.0")
4385 BOOLEAN (garnish, U"Garnish", true)
4386 OK
4387 DO
4388 GRAPHICS_EACH (PatternList)
4389 PatternList_draw (me, GRAPHICS, patternNumber, xmin, xmax, ymin, ymax, garnish);
4390 GRAPHICS_EACH_END
4391 }
4392
4393 DIRECT (QUERY_ONE_FOR_INTEGER__PatternList_getNumberOfPatterns) {
4394 QUERY_ONE_FOR_INTEGER (PatternList)
4395 const integer result = my ny;
4396 QUERY_ONE_FOR_INTEGER_END (U" (number of patterns)")
4397 }
4398
4399 DIRECT (QUERY_ONE_FOR_INTEGER__PatternList_getPatternSize) {
4400 QUERY_ONE_FOR_INTEGER (PatternList)
4401 const integer result = my nx;
4402 QUERY_ONE_FOR_INTEGER_END (U" (pattern size)")
4403 }
4404
4405 FORM (QUERY_ONE_FOR_REAL__PatternList_getValue, U"", nullptr) {
4406 NATURAL (patternNumber, U"Pattern number", U"1")
4407 NATURAL (nodeNumber, U"Node number", U"2")
4408 OK
4409 DO
4410 QUERY_ONE_FOR_REAL (PatternList)
4411 const double result = ( patternNumber <= my ny && nodeNumber <= my nx ? my z [patternNumber] [nodeNumber] : undefined );
4412 QUERY_ONE_FOR_REAL_END (U"")
4413 }
4414
4415 DIRECT (NUMMAT_PatternList_getAllValues) {
4416 QUERY_ONE_FOR_MATRIX (PatternList)
4417 autoMAT result = copy_MAT (my z.all());
4418 QUERY_ONE_FOR_MATRIX_END
4419 }
4420
4421 FORM (MODIFY_PatternList_formula, U"PatternList: Formula", nullptr) {
4422 COMMENT (U"# `col` is the node number, `row` is the pattern number")
4423 COMMENT (U"for row from 1 to nrow ; for all patterns")
4424 COMMENT (U" for col from 1 to ncol ; for all nodes")
4425 COMMENT (U" self [row, col] =")
4426 FORMULA (formula, U"Formula", U"5 * exp (-0.5 * ((col - 10 - row/100) / 1.5) ^ 2) - 0.5 ; sliding peak")
4427 COMMENT (U" endfor")
4428 COMMENT (U"endfor")
4429 OK
4430 DO
4431 MODIFY_EACH_WEAK (PatternList)
4432 Matrix_formula (me, formula, interpreter, nullptr);
4433 MODIFY_EACH_WEAK_END
4434 }
4435
4436 FORM (MODIFY_PatternList_setValue, U"PatternList: Set value", U"PatternList: Set value...") {
4437 NATURAL (rowNumber, U"Row number", U"1")
4438 NATURAL (columnNumber, U"Column number", U"1")
4439 REAL (newValue, U"New value", U"0.0")
4440 OK
4441 DO
4442 MODIFY_EACH (PatternList)
4443 Melder_require (rowNumber <= my ny,
4444 U"The row number should not be greater than the number of rows.");
4445 Melder_require (columnNumber <= my nx,
4446 U"The column number should not be greater than the number of columns.");
4447 my z [rowNumber] [columnNumber] = newValue;
4448 MODIFY_EACH_END
4449 }
4450
4451 DIRECT (CONVERT_EACH_TO_ONE__PatternList_to_Matrix) {
4452 CONVERT_EACH_TO_ONE (PatternList)
4453 autoMatrix result = PatternList_to_Matrix (me);
4454 CONVERT_EACH_TO_ONE_END (my name.get())
4455 }
4456
4457 /******************* PCA ******************************/
4458
4459 DIRECT (HELP__PCA_help) {
4460 HELP (U"PCA")
4461 }
4462
4463 DIRECT (HINT__hint_PCA_TableOfReal_to_Configuration) {
4464 INFO_NONE
4465 Melder_information (U"You can get principal components by selecting a PCA and a TableOfReal\n"
4466 "together and choosing \"To Configuration...\".");
4467 INFO_NONE_END
4468 }
4469
4470 DIRECT (HINT_hint__PCA_Covariance_Project) {
4471 INFO_NONE
4472 Melder_information (U"You can get a new Covariance object rotated to the directions of the direction vectors\n"
4473 " in the PCA object by selecting a PCA and a Covariance object together.");
4474 INFO_NONE_END
4475 }
4476
4477 DIRECT (HINT_hint__PCA_Configuration_to_TableOfReal_reconstruct) {
4478 INFO_NONE
4479 Melder_information (U"You can reconstruct the original TableOfReal as well as possible from\n"
4480 " the principal components in the Configuration and the direction vectors in the PCA object.");
4481 INFO_NONE_END
4482 }
4483
4484 FORM (QUERY_ONE_AND_ONE_FOR_REAL__PCA_TableOfReal_getFractionVariance, U"PCA & TableOfReal: Get fraction variance", U"PCA & TableOfReal: Get fraction variance...") {
4485 NATURAL (fromPrincipalComponent, U"left Principal component range", U"1")
4486 NATURAL (toPrincipalComponent, U"right Principal component range", U"1")
4487 OK
4488 DO
4489 QUERY_ONE_AND_ONE_FOR_REAL (PCA, TableOfReal)
4490 const double result = PCA_TableOfReal_getFractionVariance (me, you, fromPrincipalComponent, toPrincipalComponent);
4491 QUERY_ONE_AND_ONE_FOR_REAL_END (U"")
4492 }
4493
4494 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__PCA_Configuration_to_TableOfReal_reconstruct) {
4495 CONVERT_ONE_AND_ONE_TO_ONE (PCA, Configuration)
4496 autoTableOfReal result = PCA_Configuration_to_TableOfReal_reconstruct (me, you);
4497 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
4498 }
4499
4500 FORM (CONVERT_ONE_AND_ONE_TO_ONE__PCA_TableOfReal_to_TableOfReal_projectRows, U"PCA & TableOfReal: To TableOfReal (project rows)", U"PCA & TableOfReal: To Configuration...") {
4501 INTEGER (numberOfDimensionsToKeep, U"Number of dimensions to keep", U"0 (= all)")
4502 OK
4503 DO
4504 Melder_require (numberOfDimensionsToKeep >= 0, U"The number of dimensions to keep should be at least zero.");
4505 CONVERT_ONE_AND_ONE_GENERIC_TO_ONE (PCA, TableOfReal)
4506 autoTableOfReal result = PCA_TableOfReal_to_TableOfReal_projectRows (me, you, numberOfDimensionsToKeep);
4507 CONVERT_ONE_AND_ONE_GENERIC_TO_ONE_END (my name.get(), U"_", your name.get())
4508 }
4509
4510 FORM (CONVERT_ONE_AND_ONE_GENERIC_TO_ONE__PCA_TableOfReal_to_Configuration, U"PCA & TableOfReal: To Configuration", U"PCA & TableOfReal: To Configuration...") {
4511 INTEGER (numberOfDimensions, U"Number of dimensions", U"0 (= all)")
4512 OK
4513 DO
4514 Melder_require (numberOfDimensions >= 0,
4515 U"The number of dimensions should be at least zero.");
4516 CONVERT_ONE_AND_ONE_GENERIC_TO_ONE (PCA, TableOfReal)
4517 autoConfiguration result = PCA_TableOfReal_to_Configuration (me, you, numberOfDimensions);
4518 CONVERT_ONE_AND_ONE_GENERIC_TO_ONE_END (my name.get(), U"_", your name.get())
4519 }
4520
4521 FORM (CONVERT_ONE_AND_ONE_GENERIC_TO_ONE__PCA_TableOfReal_to_TableOfReal_zscores, U"PCA & TableOfReal: To TableOfReal (z-scores)", U"PCA & TableOfReal: To TableOfReal (z-scores)...") {
4522 INTEGER (numberOfDimensions, U"Number of dimensions", U"0 (= all)")
4523 OK
4524 DO
4525 Melder_require (numberOfDimensions >= 0,
4526 U"The number of dimensions should be at least zero.");
4527 CONVERT_ONE_AND_ONE_GENERIC_TO_ONE (PCA, TableOfReal)
4528 autoTableOfReal result = PCA_TableOfReal_to_TableOfReal_zscores (me, you, numberOfDimensions);
4529 CONVERT_ONE_AND_ONE_GENERIC_TO_ONE_END (my name.get(), U"_", your name.get(), U"_zscores")
4530 }
4531
4532 FORM (CONVERT_ONE_AND_ONE_TO_ONE__PCA_Matrix_to_Matrix_projectRows, U"PCA & Matrix: To Matrix (project rows)", nullptr) {
4533 INTEGER (numberOfDimensions, U"Number of dimensions", U"0 (= all)")
4534 OK
4535 DO
4536 Melder_require (numberOfDimensions >= 0,
4537 U"The number of dimensions should be at least zero.");
4538 CONVERT_ONE_AND_ONE_TO_ONE (PCA, Matrix)
4539 autoMatrix result = Eigen_Matrix_to_Matrix_projectRows (me, you, numberOfDimensions);
4540 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
4541 }
4542
4543 FORM (CONVERT_ONE_AND_ONE_GENERIC_TO_ONE__Matrix_to_Matrix_projectColumns, U"PCA & Matrix: To Matrix (project columns)", nullptr) {
4544 INTEGER (numberOfDimensions, U"Number of dimensions", U"0 (= all)")
4545 OK
4546 DO
4547 Melder_require (numberOfDimensions >= 0,
4548 U"The number of dimensions should be at least zero.");
4549 CONVERT_ONE_AND_ONE_GENERIC_TO_ONE (PCA, Matrix)
4550 autoMatrix result = Eigen_Matrix_to_Matrix_projectColumns (me, you, numberOfDimensions);
4551 CONVERT_ONE_AND_ONE_GENERIC_TO_ONE_END (my name.get(), U"_", your name.get())
4552 }
4553
4554 FORM (QUERY_ONE_FOR_REAL__PCA_getCentroidElement, U"PCA: Get centroid element...", nullptr) {
4555 NATURAL (number, U"Number", U"1")
4556 OK
4557 DO
4558 QUERY_ONE_FOR_REAL (PCA)
4559 Melder_require (number <= my dimension,
4560 U"Number should not be greater than ", my dimension, U".");
4561 const double result = my centroid [number];
4562 QUERY_ONE_FOR_REAL_END (U" (element ", number, U")")
4563 }
4564
4565 FORM (QUERY_ONE_FOR_REAL__PCA_getEqualityOfEigenvalues, U"PCA: Get equality of eigenvalues", U"PCA: Get equality of eigenvalues...") {
4566 INTEGER (fromEigenvalue, U"left Eigenvalue range", U"0")
4567 INTEGER (toEigenvalue, U"right Eigenvalue range", U"0")
4568 BOOLEAN (conservativeTest, U"Conservative test", false)
4569 OK
4570 DO
4571 QUERY_ONE_FOR_REAL (PCA)
4572 double result, chisq, df;
4573 PCA_getEqualityOfEigenvalues (me, fromEigenvalue, toEigenvalue,
4574 conservativeTest, & result, & chisq, & df
4575 );
4576 QUERY_ONE_FOR_REAL_END (U" (probability, based on chisq = ", chisq, U" and df = ", df, U")")
4577 }
4578
4579 FORM (QUERY_ONE_FOR_INTEGER__PCA_getNumberOfComponents_VAF, U"PCA: Get number of components (VAF)", U"PCA: Get number of components (VAF)...") {
4580 POSITIVE (varianceFraction, U"Variance fraction (0-1)", U"0.95")
4581 OK
4582 DO
4583 Melder_require (varianceFraction >= 0.0 && varianceFraction <= 1.0,
4584 U"The variance fraction should be in the interval [0, 1].");
4585 QUERY_ONE_FOR_INTEGER (PCA)
4586 const integer result = Eigen_getDimensionOfFraction (me, varianceFraction);
4587 QUERY_ONE_FOR_INTEGER_END (U" (for variance fraction)")
4588 }
4589
4590 FORM (QUERY_ONE_FOR_REAL__PCA_getFractionVAF, U"PCA: Get fraction variance accounted for", U"PCA: Get fraction variance accounted for...") {
4591 NATURAL (fromPrincipalComponent, U"left Principal component range", U"1")
4592 NATURAL (toPrincipalComponent, U"right Principal component range", U"1")
4593 OK
4594 DO
4595 Melder_require (fromPrincipalComponent <= toPrincipalComponent,
4596 U"The second component should be greater than or equal to the first component.");
4597 QUERY_ONE_FOR_REAL (PCA)
4598 const double result = Eigen_getCumulativeContributionOfComponents (me, fromPrincipalComponent, toPrincipalComponent);
4599 QUERY_ONE_FOR_REAL_END (U"")
4600 }
4601
4602 FORM (MODIFY_PCA_invertEigenvector, U"PCA: Invert eigenvector", nullptr) {
4603 NATURAL (eigenvectorNumber, U"Eigenvector number", U"1")
4604 OK
4605 DO
4606 MODIFY_EACH (Eigen)
4607 Eigen_invertEigenvector (me, eigenvectorNumber);
4608 MODIFY_EACH_END
4609 }
4610
4611 FORM (CONVERT_EACH_TO_ONE__PCA_extractEigenvector, U"PCA: Extract eigenvector", U"Eigen: Extract eigenvector...") {
4612 NATURAL (eigenvectorNumber, U"Eigenvector number", U"1")
4613 COMMENT (U"Reshape as")
4614 INTEGER (numberOfRows, U"Number of rows", U"0")
4615 INTEGER (numberOfColumns, U"Number of columns", U"0")
4616 OK
4617 DO
4618 Melder_require (numberOfRows >= 0,
4619 U"The number of rows should be at least 0.");
4620 Melder_require (numberOfColumns >= 0,
4621 U"The number of columns should be at least 0.");
4622 CONVERT_EACH_TO_ONE (PCA);
4623 autoMatrix result = Eigen_extractEigenvector (me, eigenvectorNumber, numberOfRows, numberOfColumns);
4624 CONVERT_EACH_TO_ONE_END (my name.get(), U"_ev", eigenvectorNumber)
4625 }
4626
4627 DIRECT (CONVERT_EACH_TO_ONE__PCA_extractEigen) {
4628 CONVERT_EACH_TO_ONE (PCA)
4629 autoEigen result = PCA_to_Eigen (me);
4630 CONVERT_EACH_TO_ONE_END (my name.get())
4631 }
4632
4633 FORM (CONVERT_EACH_TO_ONE__PCA_to_TableOfReal_reconstruct1, U"PCA: To TableOfReal (reconstruct)", U"PCA: To TableOfReal (reconstruct 1)...") {
4634 REALVECTOR (coefficients, U"Coefficients", WHITESPACE_SEPARATED_, U"1.0 1.0")
4635 OK
4636 DO
4637 CONVERT_EACH_TO_ONE (PCA)
4638 autoTableOfReal result = PCA_to_TableOfReal_reconstruct1 (me, coefficients);
4639 CONVERT_EACH_TO_ONE_END (my name.get(), U"_reconstructed")
4640 }
4641
4642 FORM (CONVERT_TWO_TO_ONE__PCAs_to_Procrustes, U"PCA & PCA: To Procrustes", U"PCA & PCA: To Procrustes...") {
4643 NATURAL (fromEigenvector, U"left Eigenvector range", U"1")
4644 NATURAL (toEigenvector, U"right Eigenvector range", U"2")
4645 OK
4646 DO
4647 CONVERT_TWO_TO_ONE (PCA)
4648 autoProcrustes result = Eigens_to_Procrustes (me, you, fromEigenvector, toEigenvector);
4649 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
4650 }
4651
4652 DIRECT (QUERY_TWO_FOR_REAL__PCAs_getAngleBetweenPc1Pc2Plane_degrees) {
4653 QUERY_TWO_FOR_REAL (PCA)
4654 Melder_require (my numberOfEigenvalues > 1,
4655 U"There must be at least two eigenvectors in the first PCA.");
4656 Melder_require (your numberOfEigenvalues > 1,
4657 U"There must be at least two eigenvectors in the second PCA.");
4658 const double result = Eigens_getAngleBetweenEigenplanes_degrees (me, you);
4659 QUERY_TWO_FOR_REAL_END (U" degrees (angle of intersection between the two pc1-pc2 eigenplanes)")
4660 }
4661
4662 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__PCA_SSCP_project) {
4663 CONVERT_ONE_AND_ONE_TO_ONE (PCA, SSCP)
4664 autoSSCP result = Eigen_SSCP_project (me, you);
4665 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
4666 }
4667
4668 /******************* Permutation **************************************/
4669
4670 DIRECT (HELP__Permutation_help) {
4671 HELP (U"Permutation")
4672 }
4673
4674 FORM (GRAPHICS_EACH__Permutation_drawAsLine, U"", nullptr) {
4675 BOOLEAN (garnish, U"Garnish", true)
4676 OK
4677 DO
4678 GRAPHICS_EACH (Permutation)
4679 Permutation_drawAsLine (me, GRAPHICS, garnish);
4680 GRAPHICS_EACH_END
4681 }
4682
4683 FORM (CREATE_ONE__Permutation_create, U"Create Permutation", U"Create Permutation...") {
4684 WORD (name, U"Name", U"p")
4685 NATURAL (numberOfElements, U"Number of elements", U"10")
4686 BOOLEAN (identity, U"Identity Permutation", false)
4687 OK
4688 DO
4689 CREATE_ONE
4690 autoPermutation result = Permutation_create (numberOfElements, identity);
4691 CREATE_ONE_END (name)
4692 }
4693
4694 FORM (CREATE_ONE__Permutation_createSimplePermutation, U"Permutation: Create simple Permutation", U"") {
4695 WORD (name, U"Name", U"p")
4696 INTEGERVECTOR (numbers, U"The Permutation", WHITESPACE_SEPARATED_, U"3 1 2")
4697 OK
4698 DO
4699 CREATE_ONE
4700 autoPermutation result = Permutation_createSimplePermutation (numbers);
4701 CREATE_ONE_END (name)
4702 }
4703
4704 DIRECT (QUERY_ONE_FOR_INTEGER__Permutation_getNumberOfElements) {
4705 QUERY_ONE_FOR_INTEGER (Permutation)
4706 const integer result = my numberOfElements;
4707 QUERY_ONE_FOR_INTEGER_END (U" (number of elements)")
4708 }
4709
4710 FORM (QUERY_ONE_FOR_INTEGER__Permutation_getValueAtIndex, U"Permutation: Get value", U"Permutation: Get value...") {
4711 NATURAL (index, U"Index", U"1")
4712 OK
4713 DO
4714 QUERY_ONE_FOR_INTEGER (Permutation)
4715 const integer result = Permutation_getValueAtIndex (me, index);
4716 QUERY_ONE_FOR_INTEGER_END (U" (value, at index = ", index, U")")
4717 }
4718
4719 DIRECT (QUERY_ONE_FOR_REAL_VECTOR__Permutation_listValues) {
4720 QUERY_ONE_FOR_REAL_VECTOR (Permutation)
4721 autoVEC result = raw_VEC (my numberOfElements);
4722 for (integer i = 1; i <= my numberOfElements; i++)
4723 result [i] = my p [i];
4724 QUERY_ONE_FOR_REAL_VECTOR_END
4725 }
4726
4727 DIRECT (QUERY_ONE_FOR_INTEGER__Permutation_getNumberOfInversions) {
4728 QUERY_ONE_FOR_INTEGER (Permutation)
4729 const integer result = Permutation_getNumberOfInversions (me);
4730 QUERY_ONE_FOR_INTEGER_END (U" (inversions)")
4731 }
4732
4733 FORM (QUERY_ONE_FOR_MATRIX__Permutation_listRandomInversions, U"Permutation: Get random inversions", U"Permutation: Get random inversions...") {
4734 NATURAL (maxNumberOfInversions, U"max. number of inversions", U"1")
4735 OK
4736 DO
4737 QUERY_ONE_FOR_MATRIX (Permutation)
4738 autoMAT result = Permutation_getRandomInversions (me, maxNumberOfInversions);
4739 QUERY_ONE_FOR_MATRIX_END
4740 }
4741
4742 DIRECT (QUERY_ONE_FOR_MATRIX__Permutation_listAllInversions) {
4743 QUERY_ONE_FOR_MATRIX (Permutation)
4744 autoMAT result = Permutation_getAllInversions (me);
4745 QUERY_ONE_FOR_MATRIX_END
4746 }
4747
4748 FORM (QUERY_ONE_FOR_INTEGER__Permutation_getIndexAtValue, U"Permutation: Get index", U"Permutation: Get index...") {
4749 NATURAL (value, U"Value", U"1")
4750 OK
4751 DO
4752 QUERY_ONE_FOR_INTEGER (Permutation)
4753 const integer result = Permutation_getIndexAtValue (me, value);
4754 QUERY_ONE_FOR_INTEGER_END (U" (index, at value = ", value, U")")
4755 }
4756
4757 FORM (MODIFY_Permutation_tableJump, U"Permutation: Table jump", U"Permutation: Table jump...") {
4758 NATURAL (jumpSize, U"Jump size", U"4")
4759 NATURAL (first, U"First", U"1")
4760 OK
4761 DO
4762 MODIFY_EACH (Permutation)
4763 Permutation_tableJump_inline (me, jumpSize, first);
4764 MODIFY_EACH_END
4765 }
4766
4767 DIRECT (MODIFY_Permutation_sort) {
4768 MODIFY_EACH (Permutation)
4769 Permutation_sort (me);
4770 MODIFY_EACH_END
4771 }
4772
4773 FORM (MODIFY_Permutation_swapBlocks, U"Permutation: Swap blocks", U"Permutation: Swap blocks...") {
4774 NATURAL (fromIndex, U"From index", U"1")
4775 NATURAL (toIndex, U"To index", U"2")
4776 NATURAL (blockSize, U"Block size", U"1")
4777 OK
4778 DO
4779 MODIFY_EACH (Permutation)
4780 Permutation_swapBlocks (me, fromIndex, toIndex, blockSize);
4781 MODIFY_EACH_END
4782 }
4783
4784 FORM (MODIFY_Permutation_swapPositions, U"Permutation: Swap positions", U"Permutation: Swap positions...") {
4785 NATURAL (firstIndex, U"First index", U"1")
4786 NATURAL (secondIndex, U"Second index", U"2")
4787 OK
4788 DO
4789 MODIFY_EACH (Permutation)
4790 Permutation_swapPositions (me, firstIndex, secondIndex);
4791 MODIFY_EACH_END
4792 }
4793
4794 FORM (MODIFY_Permutation_swapNumbers, U"Permutation: Swap numbers", U"Permutation: Swap numbers...") {
4795 NATURAL (firstNumber, U"First number", U"1")
4796 NATURAL (secondNumber, U"Second number", U"2")
4797 OK
4798 DO
4799 MODIFY_EACH (Permutation)
4800 Permutation_swapNumbers (me, firstNumber, secondNumber);
4801 MODIFY_EACH_END
4802 }
4803
4804 FORM (MODIFY_Permutation_swapOneFromRange, U"Permutation: Swap one from range", U"Permutation: Swap one from range...") {
4805 COMMENT (U"A randomly chosen element from ")
4806 INTEGER (fromIndex, U"left Index range", U"0")
4807 INTEGER (toIndex, U"right Index range", U"0")
4808 COMMENT (U"is swapped with the element at")
4809 NATURAL (index, U"Index", U"1")
4810 BOOLEAN (forbidSame, U"Forbid same", true)
4811 OK
4812 DO
4813 MODIFY_EACH (Permutation)
4814 Permutation_swapOneFromRange (me, fromIndex, toIndex, index, forbidSame);
4815 MODIFY_EACH_END
4816 }
4817
4818 FORM (CONVERT_EACH_TO_ONE__Permutation_permuteRandomly, U"Permutation: Permute randomly", U"Permutation: Permute randomly...") {
4819 INTEGER (fromIndex, U"left Index range", U"0")
4820 INTEGER (toIndex, U"right Index range", U"0")
4821 OK
4822 DO
4823 CONVERT_EACH_TO_ONE (Permutation)
4824 autoPermutation result = Permutation_permuteRandomly (me, fromIndex, toIndex);
4825 CONVERT_EACH_TO_ONE_END (my name.get(), U"_rdm")
4826 }
4827
4828 FORM (CONVERT_EACH_TO_ONE__Permutation_rotate, U"Permutation: Rotate", U"Permutation: Rotate...") {
4829 INTEGER (fromIndex, U"left Index range", U"0")
4830 INTEGER (toIndex, U"right Index range", U"0")
4831 INTEGER (step, U"Step size", U"1")
4832 OK
4833 DO
4834 CONVERT_EACH_TO_ONE (Permutation)
4835 autoPermutation result = Permutation_rotate (me, fromIndex, toIndex, step);
4836 CONVERT_EACH_TO_ONE_END (my name.get(), U"_rot", step)
4837 }
4838
4839 FORM (CONVERT_EACH_TO_ONE__Permutation_reverse, U"Permutation: Reverse", U"Permutation: Reverse...") {
4840 INTEGER (fromIndex, U"left Index range", U"0")
4841 INTEGER (toIndex, U"right Index range", U"0")
4842 OK
4843 DO
4844 CONVERT_EACH_TO_ONE (Permutation)
4845 autoPermutation result = Permutation_reverse (me, fromIndex, toIndex);
4846 CONVERT_EACH_TO_ONE_END (my name.get(), U"_rev")
4847 }
4848
4849 FORM (CONVERT_EACH_TO_ONE__Permutation_permuteBlocksRandomly, U"Permutation: Permute blocks randomly", U"Permutation: Permute randomly (blocks)...") {
4850 INTEGER (fromIndex, U"left Index range", U"0")
4851 INTEGER (toIndex, U"right Index range", U"0")
4852 NATURAL (blockSize, U"Block size", U"12")
4853 BOOLEAN (permuteWithinBlocks, U"Permute within blocks", true)
4854 BOOLEAN (noDoublets, U"No doublets", false)
4855 OK
4856 DO
4857 CONVERT_EACH_TO_ONE (Permutation)
4858 autoPermutation result = Permutation_permuteBlocksRandomly (me, fromIndex, toIndex,
4859 blockSize, permuteWithinBlocks, noDoublets
4860 );
4861 CONVERT_EACH_TO_ONE_END (my name.get(), U"_pbr", blockSize)
4862 }
4863
4864 FORM (CONVERT_EACH_TO_ONE__Permutation_interleave, U"Permutation: Interleave", U"Permutation: Interleave...") {
4865 INTEGER (fromIndex, U"left Index range", U"0")
4866 INTEGER (toIndex, U"right Index range", U"0")
4867 NATURAL (blockSize, U"Block size", U"12")
4868 INTEGER (offset, U"Offset", U"0")
4869 OK
4870 DO
4871 CONVERT_EACH_TO_ONE (Permutation)
4872 autoPermutation result = Permutation_interleave (me, fromIndex, toIndex, blockSize, offset);
4873 CONVERT_EACH_TO_ONE_END (my name.get(), U"_itl")
4874 }
4875
4876 DIRECT (CONVERT_EACH_TO_ONE__Permutation_invert) {
4877 CONVERT_EACH_TO_ONE (Permutation)
4878 autoPermutation result = Permutation_invert (me);
4879 CONVERT_EACH_TO_ONE_END (my name.get(), U"_inv")
4880 }
4881
4882 DIRECT (COMBINE_ALL_TO_ONE__Permutations_multiply) {
4883 COMBINE_ALL_TO_ONE (Permutation)
4884 autoPermutation result = Permutations_multiply (& list);
4885 COMBINE_ALL_TO_ONE_END (U"mul_", list.size);
4886 }
4887
4888 FORM (CONVERT_TWO_TO_ONE__Permutation_permutePartByOther, U"Permutation: Permute part by other", U"Permutation: Permute part...") {
4889 NATURAL (startPos, U"Start index", U"1")
4890 OK
4891 DO
4892 CONVERT_TWO_TO_ONE (Permutation)
4893 autoPermutation result = Permutation_permutePartByOther (me, startPos, you);
4894 CONVERT_TWO_TO_ONE_END (U"")
4895 }
4896 DIRECT (MODIFY_Permutations_next) {
4897 MODIFY_EACH (Permutation)
4898 Permutation_next_inplace (me);
4899 MODIFY_EACH_END
4900 }
4901
4902 DIRECT (MODIFY_Permutations_previous) {
4903 MODIFY_EACH (Permutation)
4904 Permutation_previous_inplace (me);
4905 MODIFY_EACH_END
4906 }
4907
4908 FORM (MODIFY__Permutation_permuteRandomlyInplace, U"Permutation: Permute randomly (in-place)", nullptr) {
4909 INTEGER (fromIndex, U"left Index range", U"0")
4910 INTEGER (toIndex, U"right Index range", U"0")
4911 OK
4912 DO
4913 MODIFY_EACH (Permutation)
4914 Permutation_permuteRandomly_inplace (me, fromIndex, toIndex);
4915 MODIFY_EACH_END
4916 }
4917
4918 FORM (CONVERT_TWO_TO_ONE__Pitches_to_DTW, U"Pitches: To DTW", U"Pitches: To DTW...") {
4919 REAL (vuvCosts, U"Voiced-unvoiced costs", U"24.0")
4920 REAL (weight, U"Time costs weight", U"10.0")
4921 DTW_constraints_addCommonFields (matchStart, matchEnd, slopeConstraint)
4922 OK
4923 DO
4924 CONVERT_TWO_TO_ONE (Pitch)
4925 autoDTW result = Pitches_to_DTW (me, you, vuvCosts, weight, matchStart, matchEnd, slopeConstraint);
4926 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
4927 }
4928
4929 FORM (CONVERT_EACH_TO_ONE__PitchTier_to_Pitch, U"PitchTier: To Pitch", U"PitchTier: To Pitch...") {
4930 POSITIVE (stepSize, U"Step size", U"0.02")
4931 POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"60.0")
4932 POSITIVE (pitchCeiling, U"Pitch ceiling (Hz)", U"400.0")
4933 OK
4934 DO
4935 CONVERT_EACH_TO_ONE (PitchTier)
4936 autoPitch result = PitchTier_to_Pitch (me, stepSize, pitchFloor, pitchCeiling);
4937 CONVERT_EACH_TO_ONE_END (my name.get())
4938 }
4939
4940 FORM (MODIFY_PitchTier_modifyInterval, U"PitchTier: Modify interval", U"PitchTier: Modify interval...") {
4941 REAL (fromTime, U"left Time range (s)", U"0.0")
4942 REAL (toTime, U"right Time range", U"0.0 (= all)")
4943 COMMENT (U"")
4944 REALVECTOR (relativeTimes, U"Relative times", WHITESPACE_SEPARATED_, U"0.0 0.5 1.0")
4945 OPTIONMENU (timeOffset, U"...are...", 1)
4946 OPTION (U"fractions")
4947 OPTION (U"percentages")
4948 OPTION (U"independent")
4949 COMMENT (U"...of the interval duration which will be added...")
4950 COMMENT (U"...to the start time of the interval.")
4951 SENTENCE (pitches_string, U"The \"pitch\" values", U"100 200 100")
4952 OPTIONMENU (pitch_as, U"...are...", 1)
4953 OPTION (U"frequencies")
4954 OPTION (U"fractions")
4955 OPTION (U"percentages")
4956 OPTION (U"start and slopes")
4957 OPTION (U"slopes and end")
4958 OPTION (U"music notes")
4959 // OPTION (U"semitones")
4960 COMMENT (U"...to be added to the anchor value (if used)...")
4961 OPTIONMENU (pitch_is, U"...which is the...", 1)
4962 OPTION (U"not used")
4963 OPTION (U"current")
4964 OPTION (U"start")
4965 OPTION (U"end")
4966 OPTION (U"mean of the curve")
4967 OPTION (U"mean of the points")
4968 OPTION (U"maximum")
4969 OPTION (U"minimum")
4970 COMMENT (U"...frequency value in the interval.")
4971 COMMENT (U"")
4972 OPTIONMENU (pitch_unit, U"Pitch frequency unit", 1)
4973 OPTION (U"Hertz")
4974 OK
4975 DO
4976 MODIFY_EACH (PitchTier)
4977 PitchTier_modifyInterval (me, fromTime, toTime, relativeTimes, timeOffset, pitches_string, pitch_unit, pitch_as, pitch_is);
4978 MODIFY_EACH_END
4979 }
4980
4981 FORM (MODIFY_PitchTier_modifyInterval_toneLevels, U"PitchTier: Modify interval (tone levels)", U"PitchTier: Modify interval (tone levels)...") {
4982 REAL (fromTime, U"left Time range (s)", U"0.0")
4983 REAL (toTime, U"right Time range", U"0.0 (= all)")
4984 REAL (fmin, U"left Pitch range (Hz)", U"80.0")
4985 REAL (fmax, U"right Pitch range", U"200.0")
4986 NATURAL (numberOfToneLevels, U"Number of tone levels", U"5")
4987 COMMENT (U"")
4988 REALVECTOR (relativeTimes, U"Relative times", WHITESPACE_SEPARATED_, U"0.0 0.5 1.0")
4989 OPTIONMENU (time_offset, U"...are...", 1)
4990 OPTION (U"fractions")
4991 OPTION (U"percentages")
4992 OPTION (U"independent")
4993 COMMENT (U"...of the interval duration which will be added...")
4994 COMMENT (U"...to the start time of the interval.")
4995 REALVECTOR (pitchesAsToneLevels, U"Pitches as tone levels", WHITESPACE_SEPARATED_, U"2.1 2.1 5.0")
4996 OK
4997 DO
4998 MODIFY_EACH (PitchTier)
4999 PitchTier_modifyInterval_toneLevels (me, fromTime, toTime, fmin, fmax, numberOfToneLevels,
5000 relativeTimes, time_offset, pitchesAsToneLevels
5001 );
5002 MODIFY_EACH_END
5003 }
5004
5005 /******************* Polygon & Categories *************************************/
5006
5007 FORM (CREATE_ONE__Polygon_createSimple, U"Create simple Polygon", U"Create simple Polygon...") {
5008 WORD (name, U"Name", U"p")
5009 REALVECTOR (vertices_asXYPairs, U"Vertices as X-Y pairs", WHITESPACE_SEPARATED_, U"0.0 0.0 0.0 1.0 1.0 0.0")
5010 OK
5011 DO
5012 CREATE_ONE
5013 autoPolygon result = Polygon_createSimple (vertices_asXYPairs);
5014 CREATE_ONE_END (name)
5015 }
5016
5017 FORM (CREATE_ONE__Polygon_createFromRandomPoints, U"Polygon: Create from random points", nullptr) {
5018 WORD (name, U"Name", U"p")
5019 NATURAL (numberOfPoints, U"Number of points", U"10")
5020 REAL (xmin, U"left X range", U"0.0")
5021 REAL (xmax, U"right X range", U"1.0")
5022 REAL (ymin, U"left Y range", U"0.0")
5023 REAL (ymax, U"right Y range", U"1.0")
5024 OK
5025 DO
5026 CREATE_ONE
5027 autoPolygon result = Polygon_createFromRandomPoints (numberOfPoints, xmin, xmax, ymin, ymax);
5028 CREATE_ONE_END (name)
5029 }
5030
5031 DIRECT (QUERY_ONE_FOR_INTEGER__Polygon_getNumberOfPoints) {
5032 QUERY_ONE_FOR_INTEGER (Polygon)
5033 const integer result = my numberOfPoints;
5034 QUERY_ONE_FOR_INTEGER_END (U" (number of points)")
5035 }
5036
5037 FORM (QUERY_ONE_FOR_REAL__Polygon_getPointX, U"Polygon: Get point (x)", nullptr) {
5038 NATURAL (pointNumber, U"Point number", U"1")
5039 OK
5040 DO
5041 QUERY_ONE_FOR_REAL (Polygon)
5042 const double result = ( pointNumber <= my numberOfPoints ? my x [pointNumber] : undefined );
5043 QUERY_ONE_FOR_REAL_END (U" (x [", pointNumber, U"])")
5044 }
5045
5046 FORM (QUERY_ONE_FOR_REAL__Polygon_getPointY, U"Polygon: Get point (y)", nullptr) {
5047 NATURAL (pointNumber, U"Point number", U"1")
5048 OK
5049 DO
5050 QUERY_ONE_FOR_REAL (Polygon)
5051 const double result = ( pointNumber <= my numberOfPoints ? my y [pointNumber] : undefined );
5052 QUERY_ONE_FOR_REAL_END (U" (y [", pointNumber, U"])")
5053 }
5054
5055 FORM (QUERY_ONE_FOR_STRING__Polygon_getLocationOfPoint, U"Get location of point", U"Polygon: Get location of point...") {
5056 COMMENT (U"Point is (I)n, (O)ut, (E)dge or (V)ertex?")
5057 REAL (x, U"X", U"0.0")
5058 REAL (y, U"Y", U"0.0")
5059 REAL (eps, U"Precision", U"1.64e-15")
5060 OK
5061 DO
5062 Melder_require (eps >= 0.0,
5063 U"The precision cannot be negative.");
5064 QUERY_ONE_FOR_STRING (Polygon)
5065 const int loc = Polygon_getLocationOfPoint (me, x, y, eps);
5066 conststring32 result = ( loc == Polygon_INSIDE ? U"I" : loc == Polygon_OUTSIDE ? U"O" :
5067 loc == Polygon_EDGE ? U"E" : U"V" );
5068 QUERY_ONE_FOR_STRING_END
5069 }
5070
5071 DIRECT (QUERY_ONE_FOR_REAL__Polygon_getAreaOfConvexHull) {
5072 QUERY_ONE_FOR_REAL (Polygon)
5073 const double result = Polygon_getAreaOfConvexHull (me);
5074 QUERY_ONE_FOR_REAL_END (U" (area convex hull)")
5075 }
5076
5077 FORM (CONVERT_EACH_TO_ONE__Polygon_circularPermutation, U"Polygon: Circular permutation", nullptr) {
5078 INTEGER (shift, U"Shift", U"1")
5079 OK
5080 DO
5081 CONVERT_EACH_TO_ONE (Polygon)
5082 autoPolygon result = Polygon_circularPermutation (me, shift);
5083 CONVERT_EACH_TO_ONE_END (my name.get(), U"_", shift)
5084 }
5085
5086
5087 DIRECT (CONVERT_EACH_TO_ONE__Polygon_simplify) {
5088 CONVERT_EACH_TO_ONE (Polygon)
5089 autoPolygon result = Polygon_simplify (me);
5090 CONVERT_EACH_TO_ONE_END (my name.get(), U"_s")
5091 }
5092
5093 DIRECT (CONVERT_EACH_TO_ONE__Polygon_convexHull) {
5094 CONVERT_EACH_TO_ONE (Polygon)
5095 autoPolygon result = Polygon_convexHull (me);
5096 CONVERT_EACH_TO_ONE_END (my name.get(), U"_hull")
5097 }
5098
5099 FORM (MODIFY_EACH__Polygon_translate, U"Polygon: Translate", U"Polygon: Translate...") {
5100 REAL (xDistance, U"X distance", U"0.0")
5101 REAL (yDistance, U"Y distance", U"0.0")
5102 OK
5103 DO
5104 MODIFY_EACH (Polygon)
5105 Polygon_translate (me, xDistance, yDistance);
5106 MODIFY_EACH_END
5107 }
5108
5109 FORM (MODIFY_EACH__Polygon_rotate, U"Polygon: Rotate", U"Polygon: Rotate...") {
5110 COMMENT (U"Rotate counterclockwise over the")
5111 REAL (angle_degrees, U"Angle (degrees)", U"0.0")
5112 COMMENT (U"With respect to the point")
5113 REAL (x, U"X", U"0.0")
5114 REAL (y, U"Y", U"0.0")
5115 OK
5116 DO
5117 MODIFY_EACH (Polygon)
5118 Polygon_rotate (me, angle_degrees, x, y);
5119 MODIFY_EACH_END
5120 }
5121
5122 FORM (MODIFY_EACH__Polygon_scale, U"Polygon: Scale polygon", nullptr) {
5123 REAL (x, U"X", U"0.0")
5124 REAL (y, U"Y", U"0.0")
5125 OK
5126 DO
5127 MODIFY_EACH (Polygon)
5128 Polygon_scale (me, x, y);
5129 MODIFY_EACH_END
5130 }
5131
5132 FORM (GRAPHICS_ONE_AND_ONE__Polygon_Categories_draw, U"Polygon & Categories: Draw", nullptr) {
5133 REAL (xmin, U"left Horizontal range", U"0.0")
5134 REAL (xmax, U"right Horizontal range", U"0.0")
5135 REAL (ymin, U"left Vertical range", U"0.0")
5136 REAL (ymax, U"right Vertical range", U"0.0")
5137 BOOLEAN (garnish, U"Garnish", true)
5138 OK
5139 DO
5140 GRAPHICS_ONE_AND_ONE (Polygon, Categories)
5141 Polygon_Categories_draw (me, you, GRAPHICS, xmin, xmax, ymin, ymax, garnish);
5142 GRAPHICS_ONE_AND_ONE_END
5143 }
5144
5145 DIRECT (MODIFY_EACH__Polygon_reverseX) {
5146 MODIFY_EACH (Polygon)
5147 Polygon_reverseX (me);
5148 MODIFY_EACH_END
5149 }
5150
5151 DIRECT (MODIFY_EACH__Polygon_reverseY) {
5152 MODIFY_EACH (Polygon)
5153 Polygon_reverseY (me);
5154 MODIFY_EACH_END
5155 }
5156
5157 /***************** Polynomial *******************/
5158
5159 DIRECT (HELP__Polynomial_help) {
5160 HELP (U"Polynomial")
5161 }
5162
5163 FORM (CREATE_ONE__Polynomial_create, U"Create Polynomial from coefficients", U"Create Polynomial...") {
5164 WORD (name, U"Name", U"p")
5165 COMMENT (U"Domain of polynomial")
5166 REAL (xmin, U"Xmin", U"-3.0")
5167 REAL (xmax, U"Xmax", U"4.0")
5168 COMMENT (U"p(x) = c[1] + c[2] x + ... c[n+1] x^n")
5169 REALVECTOR (coefficients, U"Coefficients", WHITESPACE_SEPARATED_, U"2.0 -1.0 -2.0 1.0")
5170 OK
5171 DO
5172 Melder_require (xmin < xmax, U"Xmin should be less than Xmax.");
5173 CREATE_ONE
5174 autoPolynomial result = Polynomial_createWithCoefficients (xmin, xmax, coefficients);
5175 CREATE_ONE_END (name)
5176 }
5177
5178 FORM (CREATE_ONE__Polynomial_createFromProductTerms, U"Create Polynomial from second order products", nullptr) {
5179 WORD (name, U"Name", U"p")
5180 COMMENT (U"Domain of polynomial")
5181 REAL (xmin, U"Xmin", U"-2.0")
5182 REAL (xmax, U"Xmax", U"2.0")
5183 COMMENT (U"(1+a[1]*x+x^2)*(1+a[2]*x+x^2)*...*(1+a[n]*x+x^2)")
5184 REALVECTOR (coefficients, U"The a's", WHITESPACE_SEPARATED_, U"1.0 2.0")
5185 OK
5186 DO
5187 Melder_require (xmin < xmax, U"Xmin should be less than Xmax.");
5188 CREATE_ONE
5189 autoPolynomial result = Polynomial_createFromProductOfSecondOrderTerms (xmin, xmax, coefficients);
5190 CREATE_ONE_END (name)
5191 }
5192
5193 FORM (CREATE_ONE__Polynomial_createFromRealZeros, U"Create Polynomial from first order products", nullptr) {
5194 WORD (name, U"Name", U"p")
5195 COMMENT (U"Domain of polynomial")
5196 REAL (xmin, U"Xmin", U"-3.0")
5197 REAL (xmax, U"Xmax", U"3.0")
5198 COMMENT (U"(P(x) = (x-zero[1])*(1-zero[2])*...*(x-zero[n])")
5199 REALVECTOR (zeroes, U"The zeroes", WHITESPACE_SEPARATED_, U"1.0 2.0")
5200 OK
5201 DO
5202 Melder_require (xmin < xmax, U"Xmin should be less than Xmax.");
5203 CREATE_ONE
5204 autoPolynomial result = Polynomial_createFromRealRoots (xmin, xmax, zeroes);
5205 CREATE_ONE_END (name)
5206 }
5207
5208 FORM (MODIFY_EACH__Polynomial_divide_secondOrderFactor, U"Polynomial: Divide second order factor", nullptr) {
5209 COMMENT (U"P(x) / (x^2 - factor)")
5210 REAL (factor, U"Factor", U"1.0")
5211 OK
5212 DO
5213 MODIFY_EACH (Polynomial)
5214 Polynomial_divide_secondOrderFactor (me, factor);
5215 MODIFY_EACH_END
5216 }
5217
5218 FORM (QUERY_ONE_FOR_REAL__Polynomial_getArea, U"Polynomial: Get area", U"Polynomial: Get area...") {
5219 COMMENT (U"Interval")
5220 REAL (xmin, U"Xmin", U"0.0")
5221 REAL (xmax, U"Xmax", U"0.0")
5222 OK
5223 DO
5224 QUERY_ONE_FOR_REAL (Polynomial)
5225 const double result = Polynomial_getArea (me, xmin, xmax);
5226 QUERY_ONE_FOR_REAL_END (U" (area)")
5227 }
5228
5229 FORM (QUERY_ONE_FOR_REAL__Polynomial_getRemainderAfterDivision, U"Polynomial: Get remainder after division", nullptr) {
5230 COMMENT (U"P(x) / (x - factor)")
5231 REAL (factor, U"Monomial factor", U"1.0")
5232 OK
5233 DO
5234 QUERY_ONE_FOR_REAL (Polynomial)
5235 double result;
5236 autoPolynomial p = Data_copy (me);
5237 Polynomial_divide_firstOrderFactor (p.get(), factor, & result);
5238 QUERY_ONE_FOR_REAL_END (U" (remainder)")
5239 }
5240
5241 FORM (INFO_ONE__Polynomial_getDerivativesAtX, U"Polynomial: Get derivatives at X", nullptr) {
5242 REAL (x, U"X", U"0.5")
5243 INTEGER (numberOfDerivatives, U"Number of derivatives", U"2")
5244 OK
5245 DO
5246 INFO_ONE (Polynomial)
5247 autoVEC derivatives = Polynomial_evaluateDerivatives (me, x, numberOfDerivatives);
5248 MelderInfo_open ();
5249 MelderInfo_writeLine (U"Function value: ", derivatives [1]);
5250 for (integer i = 2; i <= numberOfDerivatives + 1; i ++) {
5251 MelderInfo_writeLine (U"Derivative ", i - 1, U": ", i < my numberOfCoefficients ? derivatives [i] : undefined, U"");
5252 }
5253 MelderInfo_close ();
5254 INFO_ONE_END
5255 }
5256
5257 FORM (QUERY_ONE_FOR_REAL__Polynomial_getOneRealRoot, U"Polynomial: Get one real root", nullptr) {
5258 COMMENT (U"Interval: ")
5259 REAL (xmin, U"left X Range", U"-1.0")
5260 REAL (xmax, U"right X Range", U"1.0")
5261 OK
5262 DO
5263 QUERY_ONE_FOR_REAL (Polynomial)
5264 const double result = Polynomial_findOneSimpleRealRoot_nr (me, xmin, xmax);
5265 QUERY_ONE_FOR_REAL_END (U" (root)")
5266 }
5267
5268 DIRECT (CONVERT_EACH_TO_ONE__Polynomial_getDerivative) {
5269 CONVERT_EACH_TO_ONE (Polynomial)
5270 autoPolynomial result = Polynomial_getDerivative (me);
5271 CONVERT_EACH_TO_ONE_END (my name.get(), U"_derivative")
5272 }
5273
5274 FORM (CONVERT_EACH_TO_ONE__Polynomial_getPrimitive, U"Polynomial: Get primitive", nullptr) {
5275 REAL (constant, U"Constant", U"0.0")
5276 OK
5277 DO
5278 CONVERT_EACH_TO_ONE (Polynomial)
5279 autoPolynomial result = Polynomial_getPrimitive (me,constant);
5280 CONVERT_EACH_TO_ONE_END (my name.get(), U"_primitive")
5281 }
5282
5283 FORM (CONVERT_EACH_TO_ONE__Polynomial_scaleX, U"Polynomial: Scale x", U"Polynomial: Scale x...") {
5284 COMMENT (U"New domain")
5285 REAL (xmin, U"Xmin", U"-1.0")
5286 REAL (xmax, U"Xmax", U"1.0")
5287 OK
5288 DO
5289 Melder_require (xmin < xmax, U"Xmin should be less than Xmax.");
5290 CONVERT_EACH_TO_ONE (Polynomial)
5291 autoPolynomial result = Polynomial_scaleX (me, xmin, xmax);
5292 CONVERT_EACH_TO_ONE_END (my name.get(), U"_scaleX")
5293 }
5294
5295 DIRECT (MODIFY_Polynomial_scaleCoefficients_monic) {
5296 MODIFY_EACH (Polynomial)
5297 Polynomial_scaleCoefficients_monic (me);
5298 MODIFY_EACH_END
5299 }
5300
5301 DIRECT (CONVERT_EACH_TO_ONE__Polynomial_to_Roots) {
5302 CONVERT_EACH_TO_ONE (Polynomial)
5303 autoRoots result = Polynomial_to_Roots (me);
5304 CONVERT_EACH_TO_ONE_END (my name.get())
5305 }
5306
5307 FORM (INFO_ONE__Polynomial_evaluate_z, U"Polynomial: Get value (complex)", U"Polynomial: Get value (complex)...") {
5308 REAL (x, U"Real part", U"0.0")
5309 REAL (y, U"Imaginary part", U"0.0")
5310 OK
5311 DO
5312 dcomplex z { x, y };
5313 INFO_ONE (Polynomial)
5314 const dcomplex result = Polynomial_evaluate_z (me, z);
5315 MelderInfo_open ();
5316 MelderInfo_writeLine (result);
5317 MelderInfo_close ();
5318 INFO_ONE_END
5319 }
5320
5321 FORM (CONVERT_EACH_TO_ONE__Polynomial_to_Spectrum, U"Polynomial: To Spectrum", U"Polynomial: To Spectrum...") {
5322 POSITIVE (maximumFrequency, U"Maximum frequency (Hz)", U"5000.0")
5323 NATURAL (numberOfFrequencies, U"Number of frequencies (>1)", U"1025")
5324 OK
5325 DO
5326 CONVERT_EACH_TO_ONE (Polynomial)
5327 autoSpectrum result = Polynomial_to_Spectrum (me, maximumFrequency, numberOfFrequencies, 1.0);
5328 CONVERT_EACH_TO_ONE_END (my name.get())
5329 }
5330
5331 DIRECT (CONVERT_EACH_TO_ONE__Polynomials_multiply) {
5332 CONVERT_TWO_TO_ONE (Polynomial)
5333 autoPolynomial result = Polynomials_multiply (me, you);
5334 CONVERT_TWO_TO_ONE_END (my name.get(), U"_x_", your name.get())
5335 }
5336
5337 FORM (CONVERT_TWO_TO_MULTIPLE__Polynomials_divide, U"Polynomials: Divide", U"Polynomials: Divide...") {
5338 BOOLEAN (wantQuotient, U"Want quotient", true)
5339 BOOLEAN (wantRemainder, U"Want remainder", true)
5340 OK
5341 DO
5342 Melder_require (wantQuotient || wantRemainder,
5343 U"You should select \"Want quotient\", \"Want remainder\", or both.");
5344 CONVERT_TWO_TO_MULTIPLE (Polynomial)
5345 autoPolynomial quotient, remainder;
5346 Polynomials_divide (me, you, wantQuotient ? & quotient : nullptr, wantRemainder ? & remainder : nullptr);
5347 if (wantQuotient)
5348 praat_new (quotient.move(), my name.get(), U"_q");
5349 if (wantRemainder)
5350 praat_new (remainder.move(), my name.get(), U"_r");
5351 CONVERT_TWO_TO_MULTIPLE_END
5352 }
5353
5354 /********************* Roots ******************************/
5355
5356 DIRECT (HELP__Roots_help) {
5357 HELP (U"Roots")
5358 }
5359
5360 FORM (GRAPHICS_EACH__Roots_draw, U"Roots: Draw", nullptr) {
5361 REAL (xmin, U"Minimum of real axis", U"0.0")
5362 REAL (xmax, U"Maximum of real axis", U"0.0")
5363 REAL (ymin, U"Minimum of imaginary axis", U"0.0")
5364 REAL (ymax, U"Maximum of imaginary axis", U"0.0")
5365 SENTENCE (mark_string, U"Mark string (+x0...)", U"o")
5366 POSITIVE (markSize, U"Mark size", U"12")
5367 BOOLEAN (garnish, U"Garnish", false)
5368 OK
5369 DO
5370 GRAPHICS_EACH (Roots)
5371 Roots_draw (me, GRAPHICS, xmin, xmax, ymin, ymax, mark_string, markSize, garnish);
5372 GRAPHICS_EACH_END
5373 }
5374
5375 DIRECT (QUERY_ONE_FOR_INTEGER__Roots_getNumberOfRoots) {
5376 QUERY_ONE_FOR_INTEGER (Roots)
5377 const integer result = Roots_getNumberOfRoots (me);
5378 QUERY_ONE_FOR_INTEGER_END (U"")
5379 }
5380
5381 FORM (COMPLEX_Roots_getRoot, U"Roots: Get root", nullptr) {
5382 NATURAL (rootNumber, U"Root number", U"1")
5383 OK
5384 DO
5385 QUERY_ONE_FOR_COMPLEX (Roots)
5386 const dcomplex result = Roots_getRoot (me, rootNumber);
5387 QUERY_ONE_FOR_COMPLEX_END (U"")
5388 }
5389
5390 FORM (QUERY_ONE_FOR_REAL__Roots_getRealPartOfRoot, U"Roots: Get real part", nullptr) {
5391 NATURAL (rootNumber, U"Root number", U"1")
5392 OK
5393 DO
5394 QUERY_ONE_FOR_REAL (Roots)
5395 const dcomplex z = Roots_getRoot (me, rootNumber);
5396 const double result = z.real();
5397 QUERY_ONE_FOR_REAL_END (U"")
5398 }
5399
5400 FORM (QUERY_ONE_FOR_REAL__Roots_getImaginaryPartOfRoot, U"Roots: Get imaginary part", nullptr) {
5401 NATURAL (rootNumber, U"Root number", U"1")
5402 OK
5403 DO
5404 QUERY_ONE_FOR_REAL (Roots)
5405 const dcomplex z = Roots_getRoot (me, rootNumber);
5406 const double result = z.imag();
5407 QUERY_ONE_FOR_REAL_END (U" i")
5408 }
5409
5410 FORM (MODIFY_EACH__Roots_setRoot, U"Roots: Set root", nullptr) {
5411 NATURAL (rootNumber, U"Root number", U"1")
5412 REAL (x, U"Real part", U"1.0/sqrt(2)")
5413 REAL (y, U"Imaginary part", U"1.0/sqrt(2)")
5414 OK
5415 DO
5416 MODIFY_EACH (Roots)
5417 Roots_setRoot (me, rootNumber, x, y);
5418 MODIFY_EACH_END
5419 }
5420
5421 FORM (CONVERT_EACH_TO_ONE__Roots_to_Spectrum, U"Roots: To Spectrum", U"Roots: To Spectrum...") {
5422 POSITIVE (maximumFrequency, U"Maximum frequency (Hz)", U"5000.0")
5423 NATURAL (numberOfFrequencies, U"Number of frequencies (>1)", U"1025")
5424 OK
5425 DO
5426 CONVERT_EACH_TO_ONE (Roots)
5427 autoSpectrum result = Roots_to_Spectrum (me, maximumFrequency, numberOfFrequencies, 1.0);
5428 CONVERT_EACH_TO_ONE_END (my name.get())
5429 }
5430
5431 DIRECT (MODIFY_FIRST_OF_ONE_AND_ONE__Roots_Polynomial_polish) {
5432 MODIFY_FIRST_OF_ONE_AND_ONE (Roots, Polynomial)
5433 Roots_Polynomial_polish (me, you);
5434 MODIFY_FIRST_OF_ONE_AND_ONE_END
5435 }
5436
5437 /*****************************************************************************/
5438
5439 FORM (QUERY_NONE_FOR_REAL__Praat_getTukeyQ, U"Get TukeyQ", nullptr) {
5440 POSITIVE (criticalValue, U"Critical value", U"2.0")
5441 NATURAL (numberOfMeans, U"Number of means", U"3")
5442 POSITIVE (degreesOfFreedon, U"Degrees of freedom", U"10.0")
5443 NATURAL (numberOfRows, U"Number of rows", U"1")
5444 OK
5445 DO
5446 QUERY_NONE_FOR_REAL
5447 const double result = NUMtukeyQ (criticalValue, numberOfMeans, degreesOfFreedon, numberOfRows);
5448 QUERY_NONE_FOR_REAL_END (U" (tukeyQ)")
5449 }
5450
5451 FORM (QUERY_NONE_FOR_REAL__Praat_getInvTukeyQ, U"Get invTukeyQ", nullptr) {
5452 REAL (probability, U"Probability", U"0.05")
5453 NATURAL (numberOfMeans, U"Number of means", U"3")
5454 POSITIVE (degreesOfFreedon, U"Degrees of freedom", U"10.0")
5455 NATURAL (numberOfRows, U"Number of rows", U"1")
5456 OK
5457 DO
5458 QUERY_NONE_FOR_REAL
5459 Melder_require (probability >= 0.0 && probability <= 1.0,
5460 U"The probability should be in the interval [0, 1].");
5461 const double result = NUMinvTukeyQ (probability, numberOfMeans, degreesOfFreedon, numberOfRows);
5462 QUERY_NONE_FOR_REAL_END (U" (inv tukeyQ)")
5463 }
5464
5465 FORM (QUERY_NONE_FOR_COMPLEX__Praat_getIncompleteGamma, U"Get incomplete gamma", U"Get incomplete gamma...") {
5466 POSITIVE (reAlpha, U"Real part of alpha", U"4.0")
5467 REAL (imAlpha, U"Imaginary part of alpha", U"0.0")
5468 REAL (reX, U"Real part of X", U"4.0")
5469 REAL (imX, U"Imaginary part of X", U"0.0")
5470 OK
5471 DO
5472 QUERY_NONE_FOR_COMPLEX
5473 const dcomplex result = NUMincompleteGammaFunction (dcomplex {reAlpha, imAlpha}, dcomplex {reX, imX});
5474 QUERY_NONE_FOR_COMPLEX_END (U"")
5475 }
5476
5477 /******************** Sound ****************************************/
5478
5479 #define Sound_create_addCommonFields(startTime,endTime,samplingFrequency) \
5480 REAL (startTime, U"Start time (s)", U"0.0") \
5481 REAL (endTime, U"End time (s)", U"1.0") \
5482 POSITIVE (samplingFrequency, U"Sampling frequency (Hz)", U"44100.0")
5483
5484
5485 static void Sound_create_checkCommonFields (double startTime, double endTime, double samplingFrequency) {
5486 double numberOfSamples_real;
5487 numberOfSamples_real = round ((endTime - startTime) * samplingFrequency);
5488 if (endTime <= startTime) {
5489 if (endTime == startTime)
5490 Melder_throw (U"A Sound cannot have a duration of zero.");
5491 else
5492 Melder_throw (U"A Sound cannot have a duration less than zero.");
5493 if (startTime == 0.0)
5494 Melder_throw (U"Please set the finishing time to something greater than 0 seconds.");
5495 else
5496 Melder_throw (U"Please lower the starting time or raise the finishing time.");
5497 }
5498 if (samplingFrequency <= 0.0)
5499 Melder_throw (U"A Sound cannot have a negative sampling frequency.\n"
5500 U"Please set the sampling frequency to something greater than zero, e.g. 44100 Hz.");
5501
5502 if (numberOfSamples_real < 1.0) {
5503 Melder_appendError (U"A Sound cannot have zero samples.\n");
5504 if (startTime == 0.0) {
5505 Melder_throw (U"Please raise the finishing time.");
5506 } else {
5507 Melder_throw (U"Please lower the starting time or raise the finishing time.");
5508 }
5509 }
5510 if (numberOfSamples_real > INT54_MAX)
5511 Melder_throw (U"A Sound cannot have ", numberOfSamples_real,
5512 U" samples; the maximum is ", Melder_bigInteger (INT54_MAX), U" samples.");
5513 if (sizeof (integer) == 4 && numberOfSamples_real > INT32_MAX)
5514 Melder_throw (U"A Sound cannot have ", Melder_bigInteger (int64 (numberOfSamples_real)),
5515 U" samples; the maximum is ", Melder_bigInteger (INT32_MAX), U" samples.");
5516 }
5517
5518 FORM_SAVE (SAVE__Sound_saveAsHighestQualityMP3File, U"Sound: Save as MP3 file", nullptr, U"mp3") {
5519 SAVE_ONE (Sound, U"save the selected Sound object to the highest-quality MP3 file")
5520 Sound_saveAsMP3File_VBR (me, file, 0.0);
5521 SAVE_ONE_END
5522 }
5523
5524 FORM (CONVERT_ONE_AND_ONE_TO_ONE__Sound_Pitch_to_FormantFilter, U"Sound & Pitch: To FormantFilter", U"Sound & Pitch: To Spectrogram...") {
5525 POSITIVE (windowLength, U"Analysis window duration (s)", U"0.015")
5526 POSITIVE (timeStep, U"Time step (s)", U"0.005")
5527 COMMENT (U"Filter bank parameters")
5528 POSITIVE (firstFrequency, U"Position of first filter (Hz)", U"100.0")
5529 POSITIVE (deltaFrequency, U"Distance between filters (Hz)", U"50.0")
5530 REAL (maximumFrequency, U"Maximum frequency", U"0");
5531 POSITIVE (relativeBandwidth, U"Relative bandwidth", U"1.1")
5532 OK
5533 DO
5534 CONVERT_ONE_AND_ONE_TO_ONE (Sound, Pitch)
5535 autoFormantFilter result = Sound_Pitch_to_FormantFilter (me, you, windowLength, timeStep,
5536 firstFrequency, maximumFrequency, deltaFrequency, relativeBandwidth
5537 );
5538 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
5539 }
5540
5541 FORM (CONVERT_ONE_AND_ONE_TO_ONE__Sound_Pitch_to_Spectrogram, U"Sound & Pitch: To Spectrogram", U"Sound & Pitch: To Spectrogram...") {
5542 POSITIVE (windowLength, U"Analysis window duration (s)", U"0.015")
5543 POSITIVE (timeStep, U"Time step (s)", U"0.005")
5544 COMMENT (U"Filter bank parameters")
5545 POSITIVE (firstFrequency, U"Position of first filter (Hz)", U"100.0")
5546 POSITIVE (deltaFrequency, U"Distance between filters (Hz)", U"50.0")
5547 REAL (maximumFrequency, U"Maximum frequency", U"0");
5548 POSITIVE (relativeBandwidth, U"Relative bandwidth", U"1.1")
5549 OK
5550 DO
5551 CONVERT_ONE_AND_ONE_TO_ONE (Sound, Pitch)
5552 autoSpectrogram result = Sound_Pitch_to_Spectrogram (me, you, windowLength, timeStep,
5553 firstFrequency, maximumFrequency, deltaFrequency, relativeBandwidth
5554 );
5555 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
5556 }
5557
5558 FORM (CONVERT_ONE_AND_ONE_TO_ONE__Sound_Pitch_changeGender, U"Sound & Pitch: Change gender", U"Sound & Pitch: Change gender...") {
5559 POSITIVE (formantShiftRatio, U"Formant shift ratio", U"1.2")
5560 REAL (newPitchMedian, U"New pitch median (Hz)", U"0.0 (= no change)")
5561 POSITIVE (pitchRangeFactor, U"Pitch range factor", U"1.0 (= no change)")
5562 POSITIVE (durationFactor, U"Duration factor", U"1.0")
5563 OK
5564 DO
5565 CONVERT_ONE_AND_ONE_TO_ONE (Sound, Pitch)
5566 autoSound result = Sound_Pitch_changeGender_old (me, you, formantShiftRatio,
5567 newPitchMedian, pitchRangeFactor, durationFactor
5568 );
5569 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
5570 }
5571
5572 FORM (CONVERT_ONE_AND_ONE_TO_ONE__Sound_Pitch_changeSpeaker, U"Sound & Pitch: Change speaker", U"Sound & Pitch: Change speaker...") {
5573 POSITIVE (formantFrequencyMultiplicationFactor, U"Multiply formants by", U"1.1 (male->female)")
5574 POSITIVE (pitchMultiplicationFactor, U"Multiply pitch by", U"1.8 (male->female")
5575 REAL (pitchRangeMultiplicationFactor, U"Multiply pitch range by", U"1.0 (= no change)")
5576 POSITIVE (durationMultiplicationFactor, U"Multiply duration by", U"1.0")
5577 OK
5578 DO
5579 CONVERT_ONE_AND_ONE_TO_ONE (Sound, Pitch)
5580 autoSound result = Sound_Pitch_changeSpeaker (me, you, formantFrequencyMultiplicationFactor,
5581 pitchMultiplicationFactor, pitchRangeMultiplicationFactor, durationMultiplicationFactor
5582 );
5583 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
5584 }
5585
5586 FORM (CONVERT_ONE_AND_ONE_TO_ONE__Sound_IntervalTier_cutPartsMatchingLabel, U"Sound & IntervalTier: Cut parts matching label", nullptr) {
5587 SENTENCE (label, U"Label", U"cut")
5588 OK
5589 DO
5590 CONVERT_ONE_AND_ONE_TO_ONE (Sound, IntervalTier)
5591 autoSound result = Sound_IntervalTier_cutPartsMatchingLabel (me, you, label);
5592 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_cut")
5593 }
5594
5595 FORM (CREATE_ONE__Sound_createAsGammaTone, U"Create a gammatone", U"Create Sound as gammatone...") {
5596 WORD (name, U"Name", U"gammatone")
5597 Sound_create_addCommonFields (startTime, endTime, samplingFrequency)
5598 INTEGER (gamma, U"Gamma", U"4")
5599 POSITIVE (frequency, U"Frequency (Hz)", U"1000.0")
5600 POSITIVE (bandwidth, U"Bandwidth (Hz)", U"150.0")
5601 REAL (initialPhase, U"Initial phase (radians)", U"0.0")
5602 REAL (additionFactor, U"Addition factor", U"0.0")
5603 BOOLEAN (scaleAmplitudes, U"Scale amplitudes", true)
5604 OK
5605 DO
5606 CREATE_ONE
5607 Sound_create_checkCommonFields (startTime, endTime, samplingFrequency);
5608 Melder_require (frequency < 0.5 * samplingFrequency,
5609 U"Your frequency should not be greater than half the sampling frequency. Use a frequency less than ", 0.5 * samplingFrequency, U".");
5610 Melder_require (gamma >= 0,
5611 U"Gamma should not be negative.");
5612 autoSound result = Sound_createGammaTone (startTime, endTime, samplingFrequency, gamma,
5613 frequency, bandwidth, initialPhase, additionFactor, scaleAmplitudes
5614 );
5615 CREATE_ONE_END (name)
5616 }
5617
5618 FORM (CREATE_ONE__Sound_createAsShepardTone, U"Create a Shepard tone", U"Create Sound as Shepard tone...") {
5619 WORD (name, U"Name", U"shepardTone")
5620 Sound_create_addCommonFields (startTime, endTime, samplingFrequency)
5621 POSITIVE (minimumFrequency, U"Lowest frequency (Hz)", U"4.863")
5622 NATURAL (numberOfComponents, U"Number of components", U"10")
5623 REAL (frequencyChange, U"Frequency change (semitones/s)", U"4.0")
5624 POSITIVE (amplitudeRange_dB, U"Amplitude range (dB)", U"30.0")
5625 REAL (octaveShiftFraction, U"Octave shift fraction ([0,1))", U"0.0")
5626 OK
5627 DO
5628 CREATE_ONE
5629 Sound_create_checkCommonFields (startTime, endTime, samplingFrequency);
5630 autoSound result = Sound_createShepardToneComplex (startTime, endTime, samplingFrequency, minimumFrequency,
5631 numberOfComponents, frequencyChange, amplitudeRange_dB, octaveShiftFraction
5632 );
5633 CREATE_ONE_END (name)
5634 }
5635
5636 FORM (GRAPHICS_EACH__Sound_drawWhere, U"Sound: Draw where", U"Sound: Draw where...") {
5637 praat_TimeFunction_RANGE (fromTime, toTime)
5638 REAL (ymin, U"left Vertical range", U"0.0")
5639 REAL (ymax, U"right Vertical range", U"0.0 (= auto)")
5640 BOOLEAN (garnish, U"Garnish", true)
5641 COMMENT (U"")
5642 OPTIONMENUSTR (drawingMethod, U"Drawing method", 1)
5643 OPTION (U"curve")
5644 OPTION (U"bars")
5645 OPTION (U"poles")
5646 OPTION (U"speckles")
5647 FORMULA (formula, U"Draw only those parts where the following condition holds", U"x < xmin + (xmax - xmin) / 2; first half")
5648 OK
5649 DO
5650 const integer numberOfBisections = 10;
5651 GRAPHICS_EACH (Sound)
5652 Sound_drawWhere (me, GRAPHICS, fromTime, toTime, ymin, ymax, garnish, drawingMethod,
5653 numberOfBisections, formula, interpreter
5654 );
5655 GRAPHICS_EACH_END
5656 }
5657
5658 FORM (PLAY_EACH__Sound_playOneChannel, U"Sound: Play one channel", nullptr) {
5659 NATURAL (channel, U"Channel", U"1")
5660 OK
5661 DO
5662 PLAY_EACH (Sound)
5663 Melder_require (channel <= my ny,
5664 me, U": there is no channel ", channel, U". Sound has only ", my ny, U" channel",
5665 (my ny > 1 ? U"s." : U"."));
5666 autoSound thee = Sound_extractChannel (me, channel);
5667 Sound_play (thee.get(), nullptr, nullptr);
5668 PLAY_EACH_END
5669 }
5670
5671 FORM (PLAY_EACH__Sound_playAsFrequencyShifted, U"Sound: Play as frequency shifted", U"Sound: Play as frequency shifted...") {
5672 REAL (frequencyShift, U"Shift by (Hz)", U"1000.0")
5673 POSITIVE (samplingFrequency, U"New sampling frequency (Hz)", U"44100.0")
5674 NATURAL (samplePrecision, U"Precision (samples)", U"50")
5675 OK
5676 DO
5677 PLAY_EACH (Sound)
5678 Sound_playAsFrequencyShifted (me, frequencyShift, samplingFrequency, samplePrecision);
5679 PLAY_EACH_END
5680 }
5681
5682 FORM (QUERY_ONE_FOR_REAL__Sound_getNearestLevelCrossing, U"Sound: Get nearest level crossing", U"Sound: Get nearest level crossing...") {
5683 CHANNEL (channel, U"Channel (number, Left, or Right)", U"1")
5684 REAL (time, U"Time (s)", U"0.1")
5685 REAL (level, U"Level", U"0.1")
5686 OPTIONMENU_ENUM (kVectorSearchDirection, searchDirection, U"Search direction", kVectorSearchDirection::DEFAULT)
5687 OK
5688 DO
5689 QUERY_ONE_FOR_REAL (Sound)
5690 Melder_require (channel > 0 && channel <= my ny,
5691 U"The channel number should be between 1 and ", my ny, U".");
5692 const double result = Vector_getNearestLevelCrossing (me, channel, time, level, searchDirection);
5693 QUERY_ONE_FOR_REAL_END (U" seconds")
5694 }
5695
5696 FORM (CONVERT_TWO_TO_ONE__Sounds_to_DTW, U"Sounds: To DTW", nullptr) {
5697 POSITIVE (windowLength, U"Window length (s)", U"0.015")
5698 POSITIVE (timeStep, U"Time step (s)", U"0.005")
5699 COMMENT (U"")
5700 REAL (sakoeChibaBand, U"Sakoe-Chiba band (s)", U"0.1")
5701 CHOICE (slopeConstraint, U"Slope constraint", 1)
5702 OPTION (U"no restriction")
5703 OPTION (U"1/3 < slope < 3")
5704 OPTION (U"1/2 < slope < 2")
5705 OPTION (U"2/3 < slope < 3/2")
5706 OK
5707 DO
5708 CONVERT_TWO_TO_ONE (Sound)
5709 autoDTW result = Sounds_to_DTW (me, you, windowLength, timeStep, sakoeChibaBand, slopeConstraint);
5710 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
5711 }
5712
5713 FORM (CONVERT_EACH_TO_ONE__Sound_to_TextGrid_detectSilences, U"Sound: To TextGrid (silences)", U"Sound: To TextGrid (silences)...") {
5714 COMMENT (U"Parameters for the intensity analysis")
5715 POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"100")
5716 REAL (timeStep, U"Time step (s)", U"0.0 (= auto)")
5717 COMMENT (U"Silent intervals detection")
5718 REAL (silenceThreshold, U"Silence threshold (dB)", U"-25.0")
5719 POSITIVE (minimumSilenceDuration, U"Minimum silent interval (s)", U"0.1")
5720 POSITIVE (minimumSoundingDuration, U"Minimum sounding interval (s)", U"0.1")
5721 WORD (silenceLabel, U"Silent interval label", U"silent")
5722 WORD (soundingLabel, U"Sounding interval label", U"sounding")
5723 OK
5724 DO
5725 CONVERT_EACH_TO_ONE (Sound)
5726 autoTextGrid result = Sound_to_TextGrid_detectSilences (me, pitchFloor, timeStep, silenceThreshold,
5727 minimumSilenceDuration, minimumSoundingDuration, silenceLabel, soundingLabel
5728 );
5729 CONVERT_EACH_TO_ONE_END (my name.get())
5730 }
5731
5732 FORM (CONVERT_EACH_TO_ONE__Sound_to_TextGrid_speechActivity, U"Sound: To TextGrid (speech activity, LTSF)", U"Sound: To TextGrid (speech activity, LTSF)...") {
5733 REAL (timeStep, U"Time step (s)", U"0.0 (= auto)")
5734 POSITIVE (longtermWindow, U"Long term window (s)", U"0.3")
5735 POSITIVE (shorttermWindow, U"Short term window (s)", U"0.1")
5736 POSITIVE (fmin, U"left Frequency range (Hz)", U"70.0")
5737 POSITIVE (fmax, U"right Frequency range (Hz)", U"6000.0")
5738 REAL (flatnessThreshold, U"Flatness threshold", U"-10.0")
5739 REAL (nonspeechThreshold_dB, U"Non-speech threshold (dB)", U"-35.0")
5740 POSITIVE (minimumNonspeechDuration, U"Min. non-speech interval (s)", U"0.1")
5741 POSITIVE (minimumSpeechDuration, U"Min. speech interval (s)", U"0.1")
5742 WORD (nonspeechLabel, U"Non-speech interval label", U"non-speech")
5743 WORD (speechLabel, U"Speech interval label", U"speech")
5744 OK
5745 DO
5746 CONVERT_EACH_TO_ONE (Sound)
5747 autoTextGrid result = Sound_to_TextGrid_speechActivity_ltsf (me, timeStep, longtermWindow, shorttermWindow,
5748 fmin, fmax, flatnessThreshold, nonspeechThreshold_dB, minimumNonspeechDuration, minimumSpeechDuration,
5749 nonspeechLabel, speechLabel
5750 );
5751 CONVERT_EACH_TO_ONE_END (my name.get())
5752 }
5753
5754 FORM (CONVERT_EACH_TO_ONE__Sound_to_TextGrid_highMidLowIntervals, U"Sound: To TextGrid (high, mid, low)", nullptr) {
5755 REAL (maxLevel, U"Maximum level", U"0.5")
5756 REAL (minLevel, U"Minimum level", U"-0.5")
5757 OK
5758 DO
5759 CONVERT_EACH_TO_ONE (Sound)
5760 autoTextGrid result = Sound_to_TextGrid_highMidLowIntervals (me, minLevel, maxLevel);
5761 CONVERT_EACH_TO_ONE_END (my name.get())
5762 }
5763
5764 FORM (CONVERT_EACH_TO_ONE__Sound_copyChannelRanges, U"Sound: Copy channel ranges", nullptr) {
5765 NATURALVECTOR (channels, U"Create a new Sound from the following channels", RANGES_, U"1:64")
5766 OK
5767 DO
5768 CONVERT_EACH_TO_ONE (Sound)
5769 autoSound result = Sound_extractChannels (me, sortedSet_INTVEC (channels).get()); // TODO: why sorting? (ppgb 20210711)
5770 CONVERT_EACH_TO_ONE_END (my name.get(), U"_channels")
5771 }
5772
5773 FORM (CONVERT_EACH_TO_ONE__Sound_trimSilences, U"Sound: Trim silences", U"Sound: Trim silences...") {
5774 REAL (trimDuration, U"Trim duration (s)", U"0.08")
5775 BOOLEAN (onlyAtStartAndEnd, U"Only at start and end", true);
5776 COMMENT (U"Parameters for the intensity analysis")
5777 POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"100")
5778 REAL (timeStep, U"Time step (s)", U"0.0 (= auto)")
5779 COMMENT (U"Silent intervals detection")
5780 REAL (silenceThreshold, U"Silence threshold (dB)", U"-35.0")
5781 POSITIVE (minimumSilenceDuration, U"Minimum silent interval duration (s)", U"0.1")
5782 POSITIVE (minimumSoundingDuration, U"Minimum sounding interval duration (s)", U"0.05")
5783 BOOLEAN (saveTextGrid, U"Save trimming info as TextGrid", false)
5784 WORD (trim_string, U"Trim label", U"trimmed")
5785 OK
5786 DO
5787 Melder_clipLeft (0.0, & trimDuration);
5788 CONVERT_EACH_TO_ONE (Sound)
5789 autoTextGrid tg;
5790 autoSound result = Sound_trimSilences (me, trimDuration, onlyAtStartAndEnd, pitchFloor, timeStep,
5791 silenceThreshold, minimumSilenceDuration, minimumSoundingDuration,
5792 ( saveTextGrid ? & tg : nullptr ), trim_string
5793 );
5794 if (saveTextGrid)
5795 praat_new (tg.move(), my name.get(), U"_trimmed");
5796 CONVERT_EACH_TO_ONE_END (my name.get(), U"_trimmed")
5797 }
5798
5799 // deprecated
5800 FORM (CONVERT_EACH_TO_ONE__Sound_to_BarkFilter, U"Sound: To BarkFilter", U"Sound: To BarkSpectrogram...") {
5801 POSITIVE (windowLength, U"Window length (s)", U"0.015")
5802 POSITIVE (timeStep, U"Time step (s)", U"0.005")
5803 COMMENT (U"Filter bank parameters")
5804 POSITIVE (firstFrequency, U"Position of first filter (bark)", U"1.0")
5805 POSITIVE (deltaFrequency, U"Distance between filters (bark)", U"1.0")
5806 REAL (maximumFrequency, U"Maximum frequency (bark)", U"0.0");
5807 OK
5808 DO
5809 CONVERT_EACH_TO_ONE (Sound)
5810 autoBarkFilter result = Sound_to_BarkFilter (me, windowLength, timeStep, firstFrequency, maximumFrequency, deltaFrequency);
5811 CONVERT_EACH_TO_ONE_END (my name.get())
5812 }
5813
5814 FORM (CONVERT_EACH_TO_ONE__Sound_to_BarkSpectrogram, U"Sound: To BarkSpectrogram", U"Sound: To BarkSpectrogram...") {
5815 POSITIVE (windowLength, U"Window length (s)", U"0.015")
5816 POSITIVE (timeStep, U"Time step (s)", U"0.005")
5817 COMMENT (U"Filter bank parameters")
5818 POSITIVE (firstFrequency, U"Position of first filter (bark)", U"1.0")
5819 POSITIVE (deltaFrequency, U"Distance between filters (bark)", U"1.0")
5820 REAL (maximumFrequency, U"Maximum frequency (bark)", U"0.0");
5821 OK
5822 DO
5823 CONVERT_EACH_TO_ONE (Sound)
5824 autoBarkSpectrogram result = Sound_to_BarkSpectrogram (me, windowLength, timeStep,
5825 firstFrequency, maximumFrequency, deltaFrequency
5826 );
5827 CONVERT_EACH_TO_ONE_END (my name.get())
5828 }
5829
5830 FORM (CONVERT_EACH_TO_ONE__Sound_to_Spectrum_resampled, U"Sound To Spectrum (resampled)",
5831 U"Sound: To Spectrum (resampled)...")
5832 {
5833 NATURAL (precision, U"Precision (samples)", U"50")
5834 OK
5835 DO
5836 CONVERT_EACH_TO_ONE (Sound)
5837 autoSpectrum result = Sound_to_Spectrum_resampled (me, precision);
5838 CONVERT_EACH_TO_ONE_END (my name.get())
5839 }
5840
5841 // deprecated
5842 FORM (CONVERT_EACH_TO_ONE__Sound_to_FormantFilter, U"Sound: To FormantFilter", U"Sound: To FormantFilter...") {
5843 POSITIVE (windowLength, U"Window length (s)", U"0.015")
5844 POSITIVE (timeStep, U"Time step (s)", U"0.005")
5845 COMMENT (U"Filter bank parameters")
5846 POSITIVE (firstFrequency, U"Position of first filter (Hz)", U"100.0")
5847 POSITIVE (deltaFrequency, U"Distance between filters (Hz)", U"50.0")
5848 REAL (maximumFrequency, U"Maximum frequency", U"0.0");
5849 POSITIVE (relativeBandwidth, U"Relative bandwidth", U"1.1")
5850 COMMENT (U"Pitch analysis")
5851 POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"75.0")
5852 POSITIVE (pitchCeiling, U"Pitch ceiling (Hz)", U"600.0")
5853 OK
5854 DO
5855 CONVERT_EACH_TO_ONE (Sound)
5856 autoFormantFilter result = Sound_to_FormantFilter (me, windowLength, timeStep,
5857 firstFrequency, maximumFrequency, deltaFrequency, relativeBandwidth, pitchFloor, pitchCeiling
5858 );
5859 CONVERT_EACH_TO_ONE_END (my name.get())
5860 }
5861
5862 FORM (CONVERT_EACH_TO_ONE__Sound_to_Spectrogram_pitchDependent, U"Sound: To Spectrogram (pitch-dependent)", U"Sound: To Spectrogram (pitch-dependent)...") {
5863 POSITIVE (windowLength, U"Window length (s)", U"0.015")
5864 POSITIVE (timeStep, U"Time step (s)", U"0.005")
5865 COMMENT (U"Filter bank parameters")
5866 POSITIVE (firstFrequency, U"Position of first filter (Hz)", U"100.0")
5867 POSITIVE (deltaFrequency, U"Distance between filters (Hz)", U"50.0")
5868 REAL (maximumFrequency, U"Maximum frequency", U"0.0");
5869 POSITIVE (relativeBandwidth, U"Relative bandwidth", U"1.1")
5870 COMMENT (U"Pitch analysis")
5871 POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"75.0")
5872 POSITIVE (pitchCeiling, U"Pitch ceiling (Hz)", U"600.0")
5873 OK
5874 DO
5875 CONVERT_EACH_TO_ONE (Sound)
5876 autoSpectrogram result = Sound_to_Spectrogram_pitchDependent (me, windowLength, timeStep, firstFrequency,
5877 maximumFrequency, deltaFrequency, relativeBandwidth, pitchFloor, pitchCeiling
5878 );
5879 CONVERT_EACH_TO_ONE_END (my name.get())
5880 }
5881
5882 // deprecated
5883 FORM (CONVERT_EACH_TO_ONE__Sound_to_MelFilter, U"Sound: To MelFilter", U"Sound: To MelFilter...") {
5884 POSITIVE (windowLength, U"Window length (s)", U"0.015")
5885 POSITIVE (timeStep, U"Time step (s)", U"0.005")
5886 COMMENT (U"Filter bank parameters")
5887 POSITIVE (firstFrequency, U"Position of first filter (mel)", U"100.0")
5888 POSITIVE (deltaFrequency, U"Distance between filters (mel)", U"100.0")
5889 REAL (maximumFrequency, U"Maximum frequency (mel)", U"0.0");
5890 OK
5891 DO
5892 CONVERT_EACH_TO_ONE (Sound)
5893 autoMelFilter result = Sound_to_MelFilter (me, windowLength, timeStep, firstFrequency, maximumFrequency, deltaFrequency);
5894 CONVERT_EACH_TO_ONE_END (my name.get())
5895 }
5896
5897 FORM (CONVERT_EACH_TO_ONE__Sound_to_MelSpectrogram, U"Sound: To MelSpectrogram", U"Sound: To MelSpectrogram...") {
5898 POSITIVE (windowLength, U"Window length (s)", U"0.015")
5899 POSITIVE (timeStep, U"Time step (s)", U"0.005")
5900 COMMENT (U"Filter bank parameters")
5901 POSITIVE (firstFrequency, U"Position of first filter (mel)", U"100.0")
5902 POSITIVE (deltaFrequency, U"Distance between filters (mel)", U"100.0")
5903 REAL (maximumFrequency, U"Maximum frequency (mel)", U"0.0");
5904 OK
5905 DO
5906 CONVERT_EACH_TO_ONE (Sound)
5907 autoMelSpectrogram result = Sound_to_MelSpectrogram (me, windowLength, timeStep,
5908 firstFrequency, maximumFrequency, deltaFrequency
5909 );
5910 CONVERT_EACH_TO_ONE_END (my name.get())
5911 }
5912
5913 FORM (CONVERT_EACH_TO_ONE__Sound_to_ComplexSpectrogram, U"Sound: To ComplexSpectrogram", nullptr) {
5914 POSITIVE (windowLength, U"Window length (s)", U"0.015")
5915 POSITIVE (maximumFrequency, U"Maximum frequency (Hz)", U"8000.0")
5916 OK
5917 DO
5918 CONVERT_EACH_TO_ONE (Sound)
5919 autoComplexSpectrogram result = Sound_to_ComplexSpectrogram (me, windowLength, maximumFrequency);
5920 CONVERT_EACH_TO_ONE_END (my name.get())
5921 }
5922
5923 FORM (CONVERT_EACH_TO_ONE__Sound_to_Pitch_shs, U"Sound: To Pitch (shs)", U"Sound: To Pitch (shs)...") {
5924 POSITIVE (timeStep, U"Time step (s)", U"0.01")
5925 POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"50.0")
5926 NATURAL (maximumNumberOfCandidates, U"Max. number of candidates (Hz)", U"15")
5927 COMMENT (U"Algorithm parameters")
5928 POSITIVE (maximumFrequency, U"Maximum frequency component (Hz)", U"1250.0")
5929 NATURAL (maximumNumberOfSubharmonics, U"Max. number of subharmonics", U"15")
5930 POSITIVE (compressionFactor, U"Compression factor (<=1)", U"0.84")
5931 POSITIVE (pitchCeiling, U"Pitch ceiling (Hz)", U"600.0")
5932 NATURAL (numberOfPointsPerOctave, U"Number of points per octave", U"48");
5933 OK
5934 DO
5935 Melder_require (pitchFloor < pitchCeiling,
5936 U"The pitch floor should be less than the pitch ceiling.");
5937 Melder_require (pitchCeiling < maximumFrequency,
5938 U"The maximum frequency should be greater than or equal to the pitch ceiling.");
5939 CONVERT_EACH_TO_ONE (Sound)
5940 autoPitch result = Sound_to_Pitch_shs (me, timeStep, pitchFloor, maximumFrequency, pitchCeiling,
5941 maximumNumberOfSubharmonics, maximumNumberOfCandidates, compressionFactor, numberOfPointsPerOctave
5942 );
5943 CONVERT_EACH_TO_ONE_END (my name.get())
5944 }
5945
5946 FORM (MODIFY_EACH__Sound_fadeIn, U"Sound: Fade in", U"Sound: Fade in...") {
5947 CHANNEL (channel, U"Channel (number; 0 = all)", U"1")
5948 REAL (time, U"Time (s)", U"-10000.0")
5949 REAL (fadeTime, U"Fade time (s)", U"0.005")
5950 BOOLEAN (silentFromStart, U"Silent from start", false)
5951 OK
5952 DO
5953 MODIFY_EACH (Sound)
5954 Sound_fade (me, channel, time, fadeTime, false, silentFromStart);
5955 MODIFY_EACH_END
5956 }
5957
5958 FORM (MODIFY_Sound_fadeOut, U"Sound: Fade out", U"Sound: Fade out...") {
5959 CHANNEL (channel, U"Channel (number; 0 = all)", U"1")
5960 REAL (time, U"Time (s)", U"10000.0")
5961 REAL (fadeTime, U"Fade time (s)", U"-0.005")
5962 BOOLEAN (silentToEnd, U"Silent to end", false)
5963 OK
5964 DO
5965 MODIFY_EACH (Sound)
5966 Sound_fade (me, channel, time, fadeTime, true, silentToEnd);
5967 MODIFY_EACH_END
5968 }
5969
5970 FORM (CONVERT_EACH_TO_ONE__Sound_to_KlattGrid_simple, U"Sound: To KlattGrid (simple)", U"Sound: To KlattGrid (simple)...") {
5971 POSITIVE (timeStep, U"Time step (s)", U"0.005")
5972 COMMENT (U"Formant determination")
5973 NATURAL (numberOfFormants, U"Max. number of formants", U"5")
5974 POSITIVE (formantCeiling, U"Formant ceiling (Hz)", U"5500 (= adult female)")
5975 POSITIVE (windowLength, U"Window length (s)", U"0.025")
5976 POSITIVE (preEmphasisFrequency, U"Pre-emphasis from (Hz)", U"50.0")
5977 COMMENT (U"Pitch determination")
5978 POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"60.0")
5979 POSITIVE (pitchCeiling, U"Pitch ceiling (Hz)", U"600.0")
5980 COMMENT (U"Intensity determination")
5981 POSITIVE (pitchFloorForIntensity, U"Pitch floor for intensity (Hz)", U"100.0")
5982 BOOLEAN (subtractMean, U"Subtract mean", true)
5983 OK
5984 DO
5985 CONVERT_EACH_TO_ONE (Sound)
5986 autoKlattGrid result = Sound_to_KlattGrid_simple (me, timeStep, numberOfFormants, formantCeiling, windowLength,
5987 preEmphasisFrequency, pitchFloor, pitchCeiling, pitchFloorForIntensity, subtractMean
5988 );
5989 CONVERT_EACH_TO_ONE_END (my name.get())
5990 }
5991
5992 FORM (CONVERT_EACH_TO_ONE__Sound_to_Pitch_SPINET, U"Sound: To SPINET", U"Sound: To SPINET...") {
5993 POSITIVE (timeStep, U"Time step (s)", U"0.005")
5994 POSITIVE (windowLength, U"Window length (s)", U"0.040")
5995 COMMENT (U"Gammatone filter bank")
5996 POSITIVE (minimumFrequency, U"Minimum filter frequency (Hz)", U"70.0")
5997 POSITIVE (maximumFrequency, U"Maximum filter frequency (Hz)", U"5000.0")
5998 NATURAL (numberOfFilters, U"Number of filters", U"250");
5999 POSITIVE (pitchCeiling, U"Ceiling (Hz)", U"500.0")
6000 NATURAL (maximumNumberOfCandidates, U"Max. number of candidates", U"15")
6001 OK
6002 DO
6003 Melder_require (minimumFrequency < maximumFrequency,
6004 U"The maximum frequency should be greater than the minimum frequency.");
6005 CONVERT_EACH_TO_ONE (Sound)
6006 autoPitch result = Sound_to_Pitch_SPINET (me, timeStep, windowLength, minimumFrequency, maximumFrequency,
6007 numberOfFilters, pitchCeiling, maximumNumberOfCandidates
6008 );
6009 CONVERT_EACH_TO_ONE_END (my name.get())
6010 }
6011
6012 FORM (CONVERT_EACH_TO_ONE__Sound_to_Polygon, U"Sound: To Polygon", U"Sound: To Polygon...") {
6013 CHANNEL (channel, U"Channel (number, Left, or Right)", U"1")
6014 praat_TimeFunction_RANGE (fromTime, toTime)
6015 REAL (ymin, U"left Vertical range", U"0.0")
6016 REAL (ymax, U"right Vertical range", U"0.0")
6017 REAL (connectionY, U"Connection y-value", U"0.0")
6018 OK
6019 DO
6020 CONVERT_EACH_TO_ONE (Sound)
6021 Melder_require (channel > 0 && channel <= my ny,
6022 U"The channel number should be between 1 and ", my ny, U".");
6023 autoPolygon result = Sound_to_Polygon (me, channel, fromTime, toTime, ymin, ymax, connectionY);
6024 CONVERT_EACH_TO_ONE_END (my name.get())
6025 }
6026
6027 FORM (CONVERT_TWO_TO_ONE__Sounds_to_Polygon_enclosed, U"Sounds: To Polygon (enclosed)", U"Sounds: To Polygon (enclosed)...") {
6028 CHANNEL (channel, U"Channel (number, Left, or Right)", U"1")
6029 praat_TimeFunction_RANGE (fromTime, toTime)
6030 REAL (ymin, U"left Vertical range", U"0.0")
6031 REAL (ymax, U"right Vertical range", U"0.0")
6032 OK
6033 DO
6034 CONVERT_TWO_TO_ONE (Sound)
6035 autoPolygon result = Sounds_to_Polygon_enclosed (me, you, channel, fromTime, toTime, ymin, ymax);
6036 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
6037 }
6038
6039 FORM (CONVERT_EACH_TO_ONE__Sound_filterByGammaToneFilter4, U"Sound: Filter (gammatone)", U"Sound: Filter (gammatone)...") {
6040 POSITIVE (centreFrequency, U"Centre frequency (Hz)", U"1000.0")
6041 POSITIVE (bandwidth, U"Bandwidth (Hz)", U"150.0")
6042 OK
6043 DO
6044 CONVERT_EACH_TO_ONE (Sound)
6045 autoSound result = Sound_filterByGammaToneFilter4 (me, centreFrequency, bandwidth);
6046 CONVERT_EACH_TO_ONE_END (my name.get(), U"_filtered")
6047 }
6048
6049 FORM (CONVERT_EACH_TO_ONE__Sound_reduceNoise, U"Sound: Reduce noise", U"Sound: Reduce noise...") {
6050 REAL (fromTime, U"left Noise time range (s)", U"0.0")
6051 REAL (toTime, U"right Noise time range (s)", U"0.0")
6052 POSITIVE (windowLength, U"Window length (s)", U"0.025")
6053 COMMENT (U"Filter")
6054 REAL (fromFrequency, U"left Filter frequency range (Hz)", U"80.0")
6055 REAL (toFrequency, U"right Filter frequency range (Hz)", U"10000.0")
6056 POSITIVE (smoothingBandwidth, U"Smoothing bandwidth, (Hz)", U"40.0")
6057 REAL (noiseReduction_dB, U"Noise reduction (dB)", U"-20.0")
6058 OPTIONMENU_ENUM (kSoundNoiseReductionMethod, noiseReductionMethod, U"Noise reduction method", kSoundNoiseReductionMethod::DEFAULT)
6059 OK
6060 DO
6061 CONVERT_EACH_TO_ONE (Sound)
6062 autoSound result = Sound_reduceNoise (me, fromTime, toTime, windowLength, fromFrequency, toFrequency,
6063 smoothingBandwidth, noiseReduction_dB, noiseReductionMethod
6064 );
6065 CONVERT_EACH_TO_ONE_END (my name.get(), U"_denoised")
6066 }
6067
6068 FORM (CONVERT_EACH_TO_ONE__Sound_to_Sound_derivative, U"Sound: To Sound (derivative)", U"Sound: To Sound (derivative)...") {
6069 POSITIVE (lowPassFrequency, U"Low-pass frequency (Hz)", U"5000.0")
6070 POSITIVE (smoothing, U"Smoothing (Hz)", U"100.0")
6071 REAL (newAbsolutePeak, U"New absolute peak", U"0 (= don't scale)")
6072 OK
6073 DO
6074 CONVERT_EACH_TO_ONE (Sound)
6075 autoSound result = Sound_derivative (me, lowPassFrequency, smoothing, newAbsolutePeak);
6076 CONVERT_EACH_TO_ONE_END (my name.get(), U"_derivative")
6077 }
6078
6079 FORM (CONVERT_EACH_TO_ONE__Sound_removeNoise, U"Sound: Remove noise", U"Sound: Reduce noise...") {
6080 REAL (fromTime, U"left Noise time range (s)", U"0.0")
6081 REAL (toTime, U"right Noise time range (s)", U"0.0")
6082 POSITIVE (windowLength, U"Window length (s)", U"0.025")
6083 COMMENT (U"Filter")
6084 REAL (fromFrequency, U"left Filter frequency range (Hz)", U"80.0")
6085 REAL (toFrequency, U"right Filter frequency range (Hz)", U"10000.0")
6086 POSITIVE (smoothingBandwidth, U"Smoothing bandwidth, (Hz)", U"40.0")
6087 OPTIONMENU_ENUM (kSoundNoiseReductionMethod, noiseReductionMethod, U"Noise reduction method", kSoundNoiseReductionMethod::DEFAULT)
6088 OK
6089 DO
6090 CONVERT_EACH_TO_ONE (Sound)
6091 autoSound result = Sound_removeNoise (me, fromTime, toTime, windowLength, fromFrequency, toFrequency,
6092 smoothingBandwidth, noiseReductionMethod
6093 );
6094 CONVERT_EACH_TO_ONE_END (my name.get(), U"_denoised")
6095 }
6096
6097 FORM (CONVERT_EACH_TO_ONE__Sound_changeSpeaker, U"Sound: Change speaker", U"Sound: Change speaker...") {
6098 COMMENT (U"Pitch measurement parameters")
6099 POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"75.0")
6100 POSITIVE (pitchCeiling, U"Pitch ceiling (Hz)", U"600.0")
6101 COMMENT (U"Modification parameters")
6102 POSITIVE (formantMultiplicationFactor, U"Multiply formants by", U"1.2")
6103 POSITIVE (pitchMultiplicationFactor, U"Multiply pitch by", U"1.0")
6104 REAL (pitchRangeMultiplicationFactor, U"Multiply pitch range by", U"1.0 (= no change)")
6105 POSITIVE (durationMultiplicationFactor, U"Multiply duration by", U"1.0")
6106 OK
6107 DO
6108 Melder_require (pitchFloor < pitchCeiling,
6109 U"The \"Pitch floor\" should be smaller than the \"Pitch ceiling\".");
6110 CONVERT_EACH_TO_ONE (Sound)
6111 autoSound result = Sound_changeSpeaker (me, pitchFloor, pitchCeiling, formantMultiplicationFactor,
6112 pitchMultiplicationFactor, pitchRangeMultiplicationFactor, durationMultiplicationFactor
6113 );
6114 CONVERT_EACH_TO_ONE_END (my name.get(), U"_changeSpeaker")
6115 }
6116
6117 FORM (CONVERT_EACH_TO_ONE__Sound_changeGender, U"Sound: Change gender", U"Sound: Change gender...") {
6118 COMMENT (U"Pitch measurement parameters")
6119 POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"75.0")
6120 POSITIVE (pitchCeiling, U"Pitch ceiling (Hz)", U"600.0")
6121 COMMENT (U"Modification parameters")
6122 POSITIVE (formantShiftRatio, U"Formant shift ratio", U"1.2")
6123 REAL (pitchMedian, U"New pitch median (Hz)", U"0.0 (= no change)")
6124 REAL (pitchRangeMultiplicationFactor, U"Pitch range factor", U"1.0 (= no change)")
6125 POSITIVE (durationMultiplicationFactor, U"Duration factor", U"1.0")
6126 OK
6127 DO
6128 Melder_require (pitchFloor < pitchCeiling,
6129 U"The \"Pitch floor\" should be smaller than the \"Pitch ceiling\".");
6130 CONVERT_EACH_TO_ONE (Sound)
6131 autoSound result = Sound_changeGender_old (me, pitchFloor, pitchCeiling, formantShiftRatio, pitchMedian,
6132 pitchRangeMultiplicationFactor, durationMultiplicationFactor
6133 );
6134 CONVERT_EACH_TO_ONE_END (my name.get(), U"_changeGender");
6135 }
6136
6137 FORM (GRAPHICS_EACH__Sound_paintWhere, U"Sound paint where", U"Sound: Paint where...") {
6138 COLOUR (colour, U"Colour (0-1, name, or {r,g,b})", U"0.5")
6139 praat_TimeFunction_RANGE (fromTime, toTime)
6140 REAL (ymin, U"left Vertical range", U"0.0")
6141 REAL (ymax, U"right Vertical range", U"0.0")
6142 REAL (level, U"Fill from level", U"0.0")
6143 BOOLEAN (garnish, U"Garnish", true)
6144 FORMULA (formula, U"Paint only those parts where the following condition holds", U"1; always")
6145 OK
6146 DO
6147 const integer numberOfBisections = 10;
6148 GRAPHICS_EACH (Sound)
6149 Sound_paintWhere (me, GRAPHICS, colour, fromTime, toTime, ymin, ymax, level, garnish,
6150 numberOfBisections, formula, interpreter
6151 );
6152 GRAPHICS_EACH_END
6153 }
6154
6155 FORM (GRAPHICS_TWO__Sounds_paintEnclosed, U"Sounds paint enclosed", U"Sounds: Paint enclosed...") {
6156 COLOUR (colour, U"Colour (0-1, name, or {r,g,b})", U"0.5")
6157 REAL (xFromTime, U"left Horizontal time range (s)", U"0.0")
6158 REAL (xToTime, U"right Horizontal time range (s)", U"0.0")
6159 REAL (yFromTime, U"left Vertical range", U"0.0")
6160 REAL (yToTime, U"right Vertical range", U"0.0")
6161 BOOLEAN (garnish, U"Garnish", true)
6162 OK
6163 DO
6164 GRAPHICS_TWO (Sound)
6165 Sounds_paintEnclosed (me, you, GRAPHICS, colour, xFromTime, xToTime, yFromTime, yToTime, garnish);
6166 GRAPHICS_TWO_END
6167 }
6168
6169 FORM_READ (READ_ONE__Sound_readFromRawFileLE, U"Read Sound from raw Little Endian file", nullptr, true) {
6170 READ_ONE
6171 autoSound result = Sound_readFromRawFile (file, nullptr, 16, 1, 0, 0, 16000.0);
6172 READ_ONE_END
6173 }
6174
6175 FORM_READ (READ_ONE__Sound_readFromRawFileBE, U"Read Sound from raw 16-bit Little Endian file", nullptr, true) {
6176 READ_ONE
6177 autoSound result = Sound_readFromRawFile (file, nullptr, 16, 0, 0, 0, 16000.0);
6178 READ_ONE_END
6179 }
6180
6181 FORM_READ (READ_ONE__KlattTable_readFromRawTextFile, U"KlattTable_readFromRawTextFile", nullptr, true) {
6182 READ_ONE
6183 autoKlattTable result = KlattTable_readFromRawTextFile (file);
6184 READ_ONE_END
6185 }
6186
6187 /************ Spectrograms *********************************************/
6188
6189 FORM (CONVERT_TWO_TO_ONE__Spectrograms_to_DTW, U"Spectrograms: To DTW", nullptr) {
6190 DTW_constraints_addCommonFields (matchStart, matchEnd, slopeConstraint)
6191 OK
6192 DO
6193 CONVERT_TWO_TO_ONE (Spectrogram)
6194 autoDTW result = Spectrograms_to_DTW (me, you, matchStart, matchEnd, slopeConstraint, 1.0);
6195 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
6196 }
6197
6198 FORM (GRAPHICS_EACH__Spectrogram_drawLongtermSpectralFlatness, U"Spectrogram: Draw long-term spectral flatness", U"") {
6199 //double tmin, double tmax, double minimumFlatness_db,
6200 // double longtermWindow, double shorttermWindow, double fmin, double fmax, bool garnish
6201 REAL (fromTime, U"left Time range (s)", U"0.0")
6202 REAL (toTime, U"right Time range", U"0.0 (= all)")
6203 REAL (minimumFlatness_db, U"Minimum flatness (dB)", U"-30.0")
6204 POSITIVE (longtimeWindow, U"Long time window", U"0.3")
6205 POSITIVE (shorttimeWindow, U"Short time window", U"0.1")
6206 POSITIVE (fmin, U"left Frequency range_(Hz)", U"400.0")
6207 POSITIVE (fmax, U"right Frequency range_(Hz)", U"4000.0")
6208 BOOLEAN (garnish, U"Garnish", true)
6209 OK
6210 DO
6211 GRAPHICS_EACH (Spectrogram)
6212 Spectrogram_drawLongTermFlatness (me, GRAPHICS, fromTime, toTime, minimumFlatness_db,
6213 longtimeWindow, shorttimeWindow, fmin, fmax, garnish);
6214 GRAPHICS_EACH_END
6215 }
6216
6217 FORM (CONVERT_EACH_TO_ONE__Spectrogram_getLongtermSpectralFlatness, U"Spectrogram: Get long-term spectral flatness", nullptr) {
6218 POSITIVE (longtimeWindow, U"Long time window", U"0.3")
6219 POSITIVE (shorttimeWindow, U"Short time window", U"0.1")
6220 POSITIVE (fmin, U"left Frequency range_(Hz)", U"400.0")
6221 POSITIVE (fmax, U"right Frequency range_(Hz)", U"6000.0")
6222 OK
6223 DO
6224 CONVERT_EACH_TO_ONE (Spectrogram)
6225 autoMatrix result = Spectrogram_getLongtermSpectralFlatness (me, longtimeWindow, shorttimeWindow, fmin, fmax);
6226 CONVERT_EACH_TO_ONE_END (my name.get())
6227 }
6228 /**************** Spectrum *******************************************/
6229
6230 FORM (CONVERT_EACH_TO_ONE__Spectrum_to_Sound_resampled, U"Spectrum: To Sound (resampled)", U"Spectrum: To Sound (resampled)...") {
6231 INTEGER (interpolationDepth, U"Precision (samples)", U"50")
6232 OK
6233 DO
6234 CONVERT_EACH_TO_ONE (Spectrum)
6235 autoSound result = Spectrum_to_Sound_resampled (me, interpolationDepth);
6236 CONVERT_EACH_TO_ONE_END (my name.get())
6237 }
6238
6239 FORM (GRAPHICS_EACH__Spectrum_drawPhases, U"Spectrum: Draw phases", U"Spectrum: Draw phases...") {
6240 REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
6241 REAL (toFrequency, U"right Frequency range (Hz)", U"0.0")
6242 REAL (fromPhase, U"Minimum phase (dB/Hz)", U"0.0 (= auto)")
6243 REAL (toPhase, U"Maximum phase (dB/Hz)", U"0.0 (= auto)")
6244 BOOLEAN (unwrap, U"Unwrap", true)
6245 BOOLEAN (garnish, U"Garnish", true)
6246 OK
6247 DO
6248 GRAPHICS_EACH (Spectrum)
6249 Spectrum_drawPhases (me, GRAPHICS, fromFrequency, toFrequency, fromPhase, toPhase, unwrap, garnish);
6250 GRAPHICS_EACH_END
6251 }
6252
6253 FORM (MODIFY_EACH__Spectrum_setRealValueInBin, U"Spectrum: Set real value in bin", nullptr) {
6254 NATURAL (binNumber, U"Bin number", U"100")
6255 REAL (value, U"Value", U"0.0")
6256 OK
6257 DO
6258 MODIFY_EACH (Spectrum)
6259 Melder_require (binNumber <= my nx,
6260 U"Your bin number should not exceed the number of bins (", my nx, U").");
6261 my z [1] [binNumber] = value;
6262 MODIFY_EACH_END
6263 }
6264
6265 FORM (MODIFY_EACH__Spectrum_setImaginaryValueInBin, U"Spectrum: Set imaginary value in bin", nullptr) {
6266 NATURAL (binNumber, U"Bin number", U"100")
6267 REAL (value, U"Value", U"0.0")
6268 OK
6269 DO
6270 MODIFY_EACH (Spectrum)
6271 Melder_require (binNumber <= my nx,
6272 U"Your bin number should not exceed the number of bins (", my nx, U").");
6273 my z [2] [binNumber] = value;
6274 MODIFY_EACH_END
6275 }
6276
6277 DIRECT (MODIFY_EACH__Spectrum_conjugate) {
6278 MODIFY_EACH (Spectrum)
6279 Spectrum_conjugate (me);
6280 MODIFY_EACH_END
6281 }
6282
6283 FORM (CONVERT_EACH_TO_ONE__Spectrum_shiftFrequencies, U"Spectrum: Shift frequencies", U"Spectrum: Shift frequencies...") {
6284 REAL (frequencyShift, U"Shift by (Hz)", U"1000.0")
6285 POSITIVE (maximumFrequency, U"New maximum frequency (Hz)", U"22050")
6286 NATURAL (interpolationDepth, U"Interpolation depth", U"50")
6287 OK
6288 DO
6289 CONVERT_EACH_TO_ONE (Spectrum)
6290 autoSpectrum result = Spectrum_shiftFrequencies (me, frequencyShift, maximumFrequency, interpolationDepth);
6291 CONVERT_EACH_TO_ONE_END (my name.get(), ( frequencyShift < 0.0 ? U"_m" : U"_" ), Melder_ifloor (fabs (frequencyShift)))
6292 }
6293
6294 DIRECT (CONVERT_TWO_TO_ONE__Spectra_multiply) {
6295 CONVERT_TWO_TO_ONE (Spectrum)
6296 autoSpectrum result = Spectra_multiply (me, you);
6297 CONVERT_TWO_TO_ONE_END (my name.get(), U"_x_", your name.get())
6298 }
6299
6300 FORM (CONVERT_EACH_TO_ONE__Spectrum_resample, U"Spectrum: Resample", nullptr) {
6301 NATURAL (numberOfFrequencies, U"New number of frequencies", U"256")
6302 OK
6303 DO
6304 CONVERT_EACH_TO_ONE (Spectrum)
6305 autoSpectrum result = Spectrum_resample (me, numberOfFrequencies);
6306 CONVERT_EACH_TO_ONE_END (my name.get(), U"_", numberOfFrequencies)
6307 }
6308
6309 FORM (CONVERT_EACH_TO_ONE__Spectrum_compressFrequencyDomain, U"Spectrum: Compress frequency domain", nullptr) {
6310 POSITIVE (maximumFrequency, U"Maximum frequency (Hz)", U"5000.0")
6311 INTEGER (interpolationDepth, U"Interpolation depth", U"50")
6312 CHOICE (scale, U"Interpolation scale", 1)
6313 OPTION (U"linear")
6314 OPTION (U"logarithmic")
6315 OK
6316 DO
6317 CONVERT_EACH_TO_ONE (Spectrum)
6318 autoSpectrum result = Spectrum_compressFrequencyDomain (me, maximumFrequency, interpolationDepth, scale, 1);
6319 CONVERT_EACH_TO_ONE_END (my name.get(), U"_", Melder_ifloor (maximumFrequency))
6320 }
6321
6322 DIRECT (CONVERT_EACH_TO_ONE__Spectrum_unwrap) {
6323 CONVERT_EACH_TO_ONE (Spectrum)
6324 autoMatrix result = Spectrum_unwrap (me);
6325 CONVERT_EACH_TO_ONE_END (my name.get())
6326 }
6327
6328 DIRECT (CONVERT_EACH_TO_ONE__Spectrum_to_PowerCepstrum) {
6329 CONVERT_EACH_TO_ONE (Spectrum)
6330 autoPowerCepstrum result = Spectrum_to_PowerCepstrum (me);
6331 CONVERT_EACH_TO_ONE_END (my name.get())
6332 }
6333
6334 DIRECT (CONVERT_EACH_TO_ONE__Spectrum_to_Cepstrum) {
6335 CONVERT_EACH_TO_ONE (Spectrum)
6336 autoCepstrum result = Spectrum_to_Cepstrum (me);
6337 CONVERT_EACH_TO_ONE_END (my name.get())
6338 }
6339
6340 /************* SpeechSynthesizer *************************************************/
6341
6342 DIRECT (HELP__SpeechSynthesizer_help) {
6343 HELP (U"SpeechSynthesizer")
6344 }
6345
6346 DIRECT (CREATE_ONE__TabulateSpeechSynthesizerLanguageProperties) {
6347 CREATE_ONE
6348 autoTable result = Data_copy (theSpeechSynthesizerLanguagePropertiesTable);
6349 CREATE_ONE_END (U"theSpeechSynthesizerLanguageProperties")
6350 }
6351
6352 DIRECT (CREATE_ONE__TabulateSpeechSynthesizerVoiceProperties) {
6353 CREATE_ONE
6354 autoTable result = Data_copy (theSpeechSynthesizerVoicePropertiesTable);
6355 CREATE_ONE_END (U"theSpeechSynthesizerVoiceProperties")
6356 }
6357
6358 FORM (CREATE_ONE__SpeechSynthesizer_create, U"Create SpeechSynthesizer", U"Create SpeechSynthesizer...") {
6359 LISTNUMSTR (languageIndex, languageName, U"Language", theSpeechSynthesizerLanguageNames, NUMfindFirst (theSpeechSynthesizerLanguageNames, U"English (Great Britain)"))
6360 LISTNUMSTR (voiceIndex, voiceName, U"Voice", theSpeechSynthesizerVoiceNames, (int) NUMfindFirst (theSpeechSynthesizerVoiceNames, U"Female1"))
6361 OK
6362 DO
6363 CREATE_ONE
6364 autoSpeechSynthesizer result = SpeechSynthesizer_create (languageName, voiceName);
6365 languageName = result -> d_languageName.get(); // save before moving
6366 voiceName = result -> d_voiceName.get(); // save before moving
6367 CREATE_ONE_END (languageName, U"_", voiceName) // the names may have been "repaired"
6368 }
6369
6370 FORM (WINDOW_SpeechSynthesizer_viewAndEdit, U"View & Edit SpeechSynthesizer", nullptr) {
6371 LIST (languageIndex, U"Language", theSpeechSynthesizerLanguageNames, NUMfindFirst (theSpeechSynthesizerLanguageNames, U"English (Great Britain)"))
6372 LIST (voiceIndex, U"Voice", theSpeechSynthesizerVoiceNames, NUMfindFirst (theSpeechSynthesizerVoiceNames, U"Female1"))
6373 LIST (phonemeSetIndex, U"Phoneme set", theSpeechSynthesizerLanguageNames, (int) NUMfindFirst (theSpeechSynthesizerLanguageNames, U"English (Great Britain)"))
6374 OK
6375 FIND_ONE (SpeechSynthesizer)
6376 SET_INTEGER (languageIndex, (int) NUMfindFirst (theSpeechSynthesizerLanguageNames, my d_languageName.get()))
6377 SET_INTEGER (voiceIndex, (int) NUMfindFirst (theSpeechSynthesizerVoiceNames, my d_voiceName.get()))
6378 SET_INTEGER (phonemeSetIndex, (int) NUMfindFirst (theSpeechSynthesizerLanguageNames, my d_phonemeSetName.get()))
6379 DO
6380 FIND_ONE (SpeechSynthesizer)
6381 my d_languageName = Melder_dup (theSpeechSynthesizerLanguageNames [languageIndex]);
6382 my d_voiceName = Melder_dup (theSpeechSynthesizerVoiceNames [voiceIndex]);
6383 my d_phonemeSetName = Melder_dup (theSpeechSynthesizerLanguageNames [phonemeSetIndex]);
6384 SpeechSynthesizer_checkAndRepairLanguageAndVoiceNames (me);
6385 END_NO_NEW_DATA
6386 }
6387
6388 FORM (PLAY_EACH__SpeechSynthesizer_playText, U"SpeechSynthesizer: Play text", U"SpeechSynthesizer: Play text...") {
6389 TEXTFIELD (text, U"Text", U"This is some text.", 10)
6390 OK
6391 DO
6392 PLAY_EACH (SpeechSynthesizer)
6393 SpeechSynthesizer_playText (me, text);
6394 PLAY_EACH_END
6395 }
6396
6397 FORM (CONVERT_EACH_TO_ONE__SpeechSynthesizer_to_Sound, U"SpeechSynthesizer: To Sound", U"SpeechSynthesizer: To Sound...") {
6398 TEXTFIELD (text, U"Text", U"This is some text.", 10)
6399 BOOLEAN (wantTextGrid, U"Create TextGrid with annotations", false);
6400 OK
6401 DO
6402 CONVERT_EACH_TO_MULTIPLE (SpeechSynthesizer)
6403 autoTextGrid tg;
6404 autoTable t;
6405 autoSound result = SpeechSynthesizer_to_Sound (
6406 me, text, (wantTextGrid ? & tg : nullptr), (Melder_debug == -2 ? & t : nullptr )
6407 );
6408 if (wantTextGrid)
6409 praat_new (tg.move(), my name.get());
6410 if (Melder_debug == -2)
6411 praat_new (t.move(), my name.get());
6412 praat_new (result.move(), my name.get());
6413 CONVERT_EACH_TO_MULTIPLE_END
6414 }
6415
6416 DIRECT (QUERY_ONE_FOR_STRING__SpeechSynthesizer_getLanguageName) {
6417 QUERY_ONE_FOR_STRING (SpeechSynthesizer)
6418 conststring32 result = my d_languageName.get();
6419 QUERY_ONE_FOR_STRING_END
6420 }
6421
6422 DIRECT (QUERY_ONE_FOR_STRING__SpeechSynthesizer_getVoiceName) {
6423 QUERY_ONE_FOR_STRING (SpeechSynthesizer)
6424 conststring32 result = my d_voiceName.get();
6425 QUERY_ONE_FOR_STRING_END
6426 }
6427
6428 DIRECT (QUERY_ONE_FOR_STRING__SpeechSynthesizer_getPhonemeSetName) {
6429 QUERY_ONE_FOR_STRING (SpeechSynthesizer)
6430 conststring32 result = my d_phonemeSetName.get();
6431 QUERY_ONE_FOR_STRING_END
6432 }
6433
6434 FORM (QUERY_ONE_FOR_AUTOSTRING__SpeechSynthesizer_getPhonemesFromText, U"SpeechSynthesizer: Get phonemes from text", nullptr) {
6435 TEXTFIELD (text, U"Text", U"This is some text.", 10)
6436 OK
6437 DO
6438 QUERY_ONE_FOR_AUTOSTRING (SpeechSynthesizer)
6439 autostring32 result = SpeechSynthesizer_getPhonemesFromText (me, text, false);
6440 QUERY_ONE_FOR_AUTOSTRING_END
6441 }
6442
6443 FORM (QUERY_ONE_FOR_AUTOSTRING__SpeechSynthesizer_getPhonemesFromTextSpaceSeparated, U"SpeechSynthesizer: Get phonemes from text", nullptr) {
6444 TEXTFIELD (text, U"Text", U"This is some text.", 10)
6445 OK
6446 DO
6447 QUERY_ONE_FOR_AUTOSTRING (SpeechSynthesizer)
6448 autostring32 result = SpeechSynthesizer_getPhonemesFromText (me, text, true);
6449 QUERY_ONE_FOR_AUTOSTRING_END
6450 }
6451
6452 FORM (MODIFY_EACH__SpeechSynthesizer_setTextInputSettings, U"SpeechSynthesizer: Set text input settings", U"SpeechSynthesizer: Set text input settings...") {
6453 OPTIONMENU (inputTextFormat, U"Input text format is", 3)
6454 OPTION (U"text only")
6455 OPTION (U"phoneme codes only")
6456 OPTION (U"mixed with tags")
6457 OPTIONMENU (inputPhonemeCoding, U"Input phoneme codes are", 1)
6458 OPTION (U"Kirshenbaum_espeak")
6459 OK
6460 DO
6461 const int inputPhonemeCoding_always = SpeechSynthesizer_PHONEMECODINGS_KIRSHENBAUM;
6462 MODIFY_EACH (SpeechSynthesizer)
6463 SpeechSynthesizer_setTextInputSettings (me, inputTextFormat, inputPhonemeCoding_always);
6464 MODIFY_EACH_END
6465 }
6466
6467 FORM (MODIFY_EACH__SpeechSynthesizer_estimateSpeechRateFromSpeech, U"SpeechSynthesizer: Estimate speech rate from speech", U"SpeechSynthesizer: Estimate speech rate from speech...") {
6468 BOOLEAN (estimate, U"Estimate speech rate from speech", true);
6469 OK
6470 DO
6471 MODIFY_EACH (SpeechSynthesizer)
6472 SpeechSynthesizer_setEstimateSpeechRateFromSpeech (me, estimate);
6473 MODIFY_EACH_END
6474 }
6475
6476 FORM (MODIFY_EACH__SpeechSynthesizer_speechOutputSettings, U"SpeechSynthesizer: Speech output settings", U"SpeechSynthesizer: Speech output settings...") {
6477 POSITIVE (samplingFrequency, U"Sampling frequency (Hz)", U"44100.0")
6478 REAL (wordGap, U"Gap between words (s)", U"0.01")
6479 POSITIVE (pitchMultiplier, U"Pitch multiplier (0.5-2.0)", U"1.0")
6480 REAL (pitchRangeMultiplier, U"Pitch range multiplier (0-2.0)", U"1.0");
6481 POSITIVE (wordsPerMinute, U"Words per minute (80-450)", U"175.0");
6482 OPTIONMENU (outputPhonemeCodes, U"Output phoneme codes are", 2)
6483 OPTION (U"Kirshenbaum_espeak")
6484 OPTION (U"IPA")
6485 OK
6486 DO
6487 Melder_clipLeft (0.0, & wordGap);
6488 Melder_require (pitchMultiplier >= 0.5 && pitchMultiplier <= 2.0,
6489 U"The pitch multiplier should be between 0.5 and 2.0.");
6490 Melder_require (pitchRangeMultiplier >= 0.0 && pitchRangeMultiplier <= 2.0,
6491 U"The pitch range multiplier should be between 0.0 and 2.0.");
6492 MODIFY_EACH (SpeechSynthesizer)
6493 SpeechSynthesizer_setSpeechOutputSettings (
6494 me, samplingFrequency, wordGap, pitchMultiplier, pitchRangeMultiplier, wordsPerMinute, outputPhonemeCodes
6495 );
6496 MODIFY_EACH_END
6497 }
6498
6499 FORM (MODIFY_EACH__SpeechSynthesizer_setSpeechOutputSettings, U"SpeechSynthesizer: Set speech output settings", U"SpeechSynthesizer: Speech output settings...") {
6500 POSITIVE (samplingFrequency, U"Sampling frequency (Hz)", U"44100.0")
6501 REAL (wordGap, U"Gap between words (s)", U"0.01")
6502 INTEGER (pitchAdjustment_0_99, U"Pitch adjustment (0-99)", U"50")
6503 INTEGER (pitchRange_0_99, U"Pitch range (0-99)", U"50");
6504 NATURAL (wordsPerMinute, U"Words per minute (80-450)", U"175");
6505 BOOLEAN (estimateWordsPerMinute, U"Estimate rate from data", true);
6506 OPTIONMENU (outputPhonemeCodes, U"Output phoneme codes are", 2)
6507 OPTION (U"Kirshenbaum_espeak")
6508 OPTION (U"IPA")
6509 OK
6510 DO
6511 Melder_clipLeft (0.0, & wordGap);
6512 Melder_clip (0_integer, & pitchAdjustment_0_99, 99_integer);
6513 Melder_clip (0_integer, & pitchRange_0_99, 99_integer);
6514 const double pitchAdjustment = (1.5 / 99.0 * pitchAdjustment_0_99 + 0.5);
6515 const double pitchRange = pitchRange_0_99 / 49.5;
6516 MODIFY_EACH (SpeechSynthesizer)
6517 SpeechSynthesizer_setSpeechOutputSettings (
6518 me, samplingFrequency, wordGap, pitchAdjustment, pitchRange, wordsPerMinute, outputPhonemeCodes
6519 );
6520 SpeechSynthesizer_setEstimateSpeechRateFromSpeech (me, estimateWordsPerMinute);
6521 MODIFY_EACH_END
6522 }
6523
6524 /************* SpeechSynthesizer and TextGrid ************************/
6525
6526 FORM (CONVERT_ONE_AND_ONE_TO_ONE__SpeechSynthesizer_TextGrid_to_Sound, U"SpeechSynthesizer & TextGrid: To Sound", nullptr) {
6527 NATURAL (tierNumber, U"Tier number", U"1")
6528 NATURAL (intervalNumber, U"Interval number", U"1")
6529 BOOLEAN (createAnnotations, U"Create TextGrid with annotations", false);
6530 OK
6531 DO
6532 CONVERT_ONE_AND_ONE_TO_ONE (SpeechSynthesizer, TextGrid)
6533 autoTextGrid annotations;
6534 autoSound result = SpeechSynthesizer_TextGrid_to_Sound (
6535 me, you, tierNumber, intervalNumber, (createAnnotations ? & annotations : nullptr)
6536 );
6537 if (createAnnotations)
6538 praat_new (annotations.move(), my name.get());
6539 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get())
6540 }
6541
6542 FORM (CONVERT_ONE_AND_ONE_AND_ONE_TO_ONE__SpeechSynthesizer_Sound_TextGrid_align, U"SpeechSynthesizer & Sound & TextGrid: To TextGrid (align)", nullptr) {
6543 NATURAL (tierNumber, U"Tier number", U"1")
6544 NATURAL (fromInterval, U"From interval number", U"1")
6545 NATURAL (toInterval, U"To interval number", U"1")
6546 REAL (silenceThreshold_dB, U"Silence threshold (dB)", U"-35.0")
6547 POSITIVE (minimumSilenceDuration, U"Minimum silent interval duration (s)", U"0.1")
6548 POSITIVE (minimumSoundingDuration, U"Minimum sounding interval duration (s)", U"0.1")
6549 OK
6550 DO
6551 CONVERT_ONE_AND_ONE_AND_ONE_TO_ONE (SpeechSynthesizer, Sound, TextGrid)
6552 autoTextGrid result = SpeechSynthesizer_Sound_TextGrid_align (
6553 me, you, him, tierNumber, fromInterval, toInterval, silenceThreshold_dB,
6554 minimumSilenceDuration, minimumSoundingDuration
6555 );
6556 CONVERT_ONE_AND_ONE_AND_ONE_TO_ONE_END (your name.get(), U"_aligned")
6557 }
6558
6559 FORM (CONVERT_ONE_AND_ONE_AND_ONE_TO_ONE__SpeechSynthesizer_Sound_TextGrid_align2, U"SpeechSynthesizer & Sound & TextGrid: To TextGrid (align, trim)", nullptr) {
6560 NATURAL (tierNumber, U"Tier number", U"1")
6561 NATURAL (fromInterval, U"From interval number", U"1")
6562 NATURAL (toInterval, U"To interval number", U"1")
6563 REAL (silenceThreshold_dB, U"Silence threshold (dB)", U"-35.0")
6564 POSITIVE (minimumSilenceDuration, U"Minimum silent interval duration (s)", U"0.1")
6565 POSITIVE (minimumSoundingDuration, U"Minimum sounding interval duration (s)", U"0.1")
6566 REAL (trimDuration, U"Silence trim duration (s)", U"0.08")
6567 OK
6568 DO
6569 Melder_require (trimDuration >= 0.0,
6570 U"The \"Silence trim duration\" should not be negative.");
6571 CONVERT_ONE_AND_ONE_AND_ONE_TO_ONE (SpeechSynthesizer, Sound, TextGrid)
6572 autoTextGrid result = SpeechSynthesizer_Sound_TextGrid_align2 (
6573 me, you, him, tierNumber, fromInterval, toInterval, silenceThreshold_dB, minimumSilenceDuration,
6574 minimumSoundingDuration, trimDuration
6575 );
6576 CONVERT_ONE_AND_ONE_AND_ONE_TO_ONE_END (his name.get(), U"_aligned")
6577 }
6578
6579 /************* Spline *************************************************/
6580
6581 FORM (GRAPHICS_EACH__Spline_drawKnots, U"Spline: Draw knots", nullptr) {
6582 REAL (xmin, U"Xmin", U"0.0")
6583 REAL (xmax, U"Xmax", U"0.0")
6584 REAL (ymin, U"left Vertical range", U"0.0")
6585 REAL (ymax, U"right Vertical range", U"0.0")
6586 BOOLEAN (garnish, U"Garnish", true)
6587 OK
6588 DO
6589 GRAPHICS_EACH (Spline)
6590 Spline_drawKnots (me, GRAPHICS, xmin, xmax, ymin, ymax, garnish);
6591 GRAPHICS_EACH_END
6592 }
6593
6594 DIRECT (QUERY_ONE_FOR_INTEGER__Spline_getOrder) {
6595 QUERY_ONE_FOR_INTEGER (Spline)
6596 const integer result = Spline_getOrder (me);
6597 QUERY_ONE_FOR_INTEGER_END (U" (order)")
6598 }
6599
6600 FORM (CONVERT_EACH_TO_ONE__Spline_scaleX, U"Spline: Scale x", U"Spline: Scale x...") {
6601 COMMENT (U"New domain")
6602 REAL (xmin, U"Xmin", U"-1.0")
6603 REAL (xmax, U"Xmax", U"1.0")
6604 OK
6605 DO
6606 Melder_require (xmin < xmax,
6607 U"\"Xmin\" should be smaller than \"Xmax\".");
6608 CONVERT_EACH_TO_ONE (Spline)
6609 autoSpline result = Spline_scaleX (me, xmin, xmax);
6610 CONVERT_EACH_TO_ONE_END (my name.get(), U"_scaleX")
6611 }
6612
6613 /************ SSCP ***************************************************/
6614
6615 DIRECT (HELP__SSCP_help) {
6616 HELP (U"SSCP")
6617 }
6618
6619 FORM (GRAPHICS_EACH__SSCP_drawConfidenceEllipse, U"SSCP: Draw confidence ellipse", nullptr) {
6620 POSITIVE (confidenceLevel, U"Confidence level", U"0.95")
6621 NATURAL (xIndex, U"Index for X-axis", U"1")
6622 NATURAL (yIndex, U"Index for Y-axis", U"2")
6623 REAL (xmin, U"left Horizontal range", U"0.0")
6624 REAL (xmax, U"right Horizontal range", U"0.0")
6625 REAL (ymin, U"left Vertical range", U"0.0")
6626 REAL (ymax, U"right Vertical range", U"0.0")
6627 BOOLEAN (garnish, U"Garnish", true)
6628 OK
6629 DO
6630 GRAPHICS_EACH (SSCP)
6631 SSCP_drawConcentrationEllipse (me, GRAPHICS, confidenceLevel, 1, xIndex, yIndex, xmin, xmax, ymin, ymax, garnish);
6632 GRAPHICS_EACH_END
6633 }
6634
6635 FORM (GRAPHICS_EACH__SSCP_drawSigmaEllipse, U"SSCP: Draw sigma ellipse", U"SSCP: Draw sigma ellipse...") {
6636 POSITIVE (numberOfSigmas, U"Number of sigmas", U"1.0")
6637 NATURAL (xIndex, U"Index for X-axis", U"1")
6638 NATURAL (yIndex, U"Index for Y-axis", U"2")
6639 REAL (xmin, U"left Horizontal range", U"0.0")
6640 REAL (xmax, U"right Horizontal range", U"0.0")
6641 REAL (ymin, U"left Vertical range", U"0.0")
6642 REAL (ymax, U"right Vertical range", U"0.0")
6643 BOOLEAN (garnish, U"Garnish", true)
6644 OK
6645 DO
6646 GRAPHICS_EACH (SSCP)
6647 SSCP_drawConcentrationEllipse (me, GRAPHICS, numberOfSigmas, 0, xIndex, yIndex, xmin, xmax, ymin, ymax, garnish);
6648 GRAPHICS_EACH_END
6649 }
6650
6651 DIRECT (CONVERT_EACH_TO_ONE__SSCP_extractCentroid) {
6652 CONVERT_EACH_TO_ONE (SSCP)
6653 autoTableOfReal result = SSCP_extractCentroid (me);
6654 CONVERT_EACH_TO_ONE_END (my name.get(), U"_centroid")
6655 }
6656
6657 FORM (QUERY_ONE_FOR_REAL__SSCP_getConfidenceEllipseArea, U"SSCP: Get confidence ellipse area", U"SSCP: Get confidence ellipse area...") {
6658 POSITIVE (confidenceLevel, U"Confidence level", U"0.95")
6659 NATURAL (xIndex, U"Index for X-axis", U"1")
6660 NATURAL (yIndex, U"Index for Y-axis", U"2")
6661 OK
6662 DO
6663 QUERY_ONE_FOR_REAL (SSCP)
6664 const double result = SSCP_getConcentrationEllipseArea (me, confidenceLevel, 1, xIndex, yIndex);
6665 QUERY_ONE_FOR_REAL_END (U" (confidence ellipse area)")
6666 }
6667
6668 FORM (QUERY_ONE_FOR_REAL__SSCP_getFractionVariation, U"SSCP: Get fraction variation", U"SSCP: Get fraction variation...") {
6669 NATURAL (fromDimension, U"From dimension", U"1")
6670 NATURAL (toDimension, U"To dimension", U"1")
6671 OK
6672 DO
6673 QUERY_ONE_FOR_REAL (SSCP)
6674 const double result = SSCP_getFractionVariation (me, fromDimension, toDimension);
6675 QUERY_ONE_FOR_REAL_END (U" (fraction)")
6676 }
6677
6678
6679 FORM (QUERY_ONE_FOR_REAL__SSCP_getConcentrationEllipseArea, U"SSCP: Get sigma ellipse area", U"SSCP: Get sigma ellipse area...") {
6680 POSITIVE (numberOfSigmas, U"Number of sigmas", U"1.0")
6681 NATURAL (xIndex, U"Index for X-axis", U"1")
6682 NATURAL (yIndex, U"Index for Y-axis", U"2")
6683 OK
6684 DO
6685 QUERY_ONE_FOR_REAL (SSCP)
6686 const double result = SSCP_getConcentrationEllipseArea (me, numberOfSigmas, 0, xIndex, yIndex);
6687 QUERY_ONE_FOR_REAL_END (U" (concentration ellipse area)")
6688 }
6689
6690 DIRECT (QUERY_ONE_FOR_REAL__SSCP_getDegreesOfFreedom) {
6691 QUERY_ONE_FOR_REAL (SSCP)
6692 const double result = SSCP_getDegreesOfFreedom (me);
6693 QUERY_ONE_FOR_REAL_END (U" (degrees of freedom)")
6694 }
6695
6696 DIRECT (QUERY_ONE_FOR_INTEGER__SSCP_getNumberOfObservations) {
6697 QUERY_ONE_FOR_INTEGER (SSCP)
6698 const integer result = Melder_ifloor (my numberOfObservations); // ppgb: blijf ik raar vinden
6699 QUERY_ONE_FOR_INTEGER_END (U" (number of observations)")
6700 }
6701
6702 DIRECT (QUERY_ONE_FOR_REAL__SSCP_getTotalVariance) {
6703 QUERY_ONE_FOR_REAL (SSCP)
6704 const double result = SSCP_getTotalVariance (me);
6705 QUERY_ONE_FOR_REAL_END (U" (total variance)")
6706 }
6707
6708 FORM (QUERY_ONE_FOR_REAL__SSCP_getCentroidElement, U"SSCP: Get centroid element", U"SSCP: Get centroid element") {
6709 NATURAL (number, U"Number", U"1")
6710 OK
6711 DO
6712 QUERY_ONE_FOR_REAL (SSCP)
6713 double result = undefined;
6714 if (number > 0 && number <= my numberOfColumns) {
6715 result = my centroid [number];
6716 }
6717 QUERY_ONE_FOR_REAL_END (U" (centroid [", number, U"])")
6718 }
6719
6720 DIRECT (QUERY_ONE_FOR_REAL__SSCP_getLnDeterminant) {
6721 QUERY_ONE_FOR_REAL (SSCP)
6722 const double result = SSCP_getLnDeterminant (me);
6723 QUERY_ONE_FOR_REAL_END (U" (ln (determinant))")
6724 }
6725
6726 FORM (QUERY_ONE_FOR_REAL__SSCP_getDiagonality_bartlett, U"SSCP: Get diagonality (bartlett)", U"SSCP: Get diagonality (bartlett)...") {
6727 NATURAL (numberOfConstraints, U"Number of constraints", U"1")
6728 OK
6729 DO
6730 QUERY_ONE_FOR_REAL (SSCP)
6731 double chisq, result, ndof;
6732 SSCP_getDiagonality_bartlett (me, numberOfConstraints, & chisq, & result, & ndof);
6733 QUERY_ONE_FOR_REAL_END (U" (probability for chisq = ", chisq, U" and ndf = ", ndof, U")")
6734 }
6735
6736 DIRECT (CONVERT_EACH_TO_ONE__SSCP_to_Correlation) {
6737 CONVERT_EACH_TO_ONE (SSCP)
6738 autoCorrelation result = SSCP_to_Correlation (me);
6739 CONVERT_EACH_TO_ONE_END (my name.get())
6740 }
6741
6742 FORM (CONVERT_EACH_TO_ONE__SSCP_to_Covariance, U"SSCP: To Covariance", U"SSCP: To Covariance...") {
6743 NATURAL (numberOfConstraints, U"Number of constraints", U"1")
6744 OK
6745 DO
6746 CONVERT_EACH_TO_ONE (SSCP)
6747 autoCovariance result = SSCP_to_Covariance (me, numberOfConstraints);
6748 CONVERT_EACH_TO_ONE_END (my name.get())
6749 }
6750
6751 DIRECT (CONVERT_EACH_TO_ONE__SSCP_to_PCA) {
6752 CONVERT_EACH_TO_ONE (SSCP)
6753 autoPCA result = SSCP_to_PCA (me);
6754 CONVERT_EACH_TO_ONE_END (my name.get())
6755 }
6756
6757 /******************* Strings ****************************/
6758
6759 FORM (CREATE_ONE__Strings_createAsCharacters, U"Strings: Create as characters", nullptr) {
6760 SENTENCE (text, U"Text", U"intention")
6761 OK
6762 DO
6763 CREATE_ONE
6764 autoStrings result = Strings_createAsCharacters (text);
6765 CREATE_ONE_END (U"chars")
6766 }
6767
6768 FORM (CREATE_ONE__old_Strings_createAsTokens, U"Strings: Create as tokens", nullptr) {
6769 TEXTFIELD (text, U"Text", U"There are seven tokens in this text", 10)
6770 OK
6771 DO
6772 CREATE_ONE
6773 autoStrings result = Strings_createAsTokens (text, U" ");
6774 CREATE_ONE_END (U"tokens")
6775 }
6776
6777 FORM (CREATE_ONE__Strings_createFromTokens, U"Create Strings from tokens", U"Create Strings from tokens...") {
6778 WORD (name, U"Name", U"tokens")
6779 TEXTFIELD (text, U"Text", U"There are seven tokens in this text", 10)
6780 SENTENCE (separators, U"Separators", U" ,")
6781 OK
6782 DO
6783 CREATE_ONE
6784 autoStrings result = Strings_createAsTokens (text, separators);
6785 CREATE_ONE_END (name)
6786 }
6787
6788 FORM (CREATE_ONE__Strings_createAsTokens, U"Strings: Create as tokens", U"Create Strings as tokens...") {
6789 TEXTFIELD (text, U"Text", U"There are seven tokens in this text", 10)
6790 SENTENCE (separators, U"Separators", U" ,")
6791 OK
6792 DO_ALTERNATIVE (CREATE_ONE__old_Strings_createAsTokens)
6793 CREATE_ONE
6794 autoStrings result = Strings_createAsTokens (text, separators);
6795 CREATE_ONE_END (U"tokens")
6796 }
6797
6798 DIRECT (COMBINE_ALL_TO_ONE__Strings_append) {
6799 COMBINE_ALL_TO_ONE (Strings)
6800 autoStrings result = Strings_append (& list);
6801 COMBINE_ALL_TO_ONE_END (U"appended")
6802 }
6803
6804 DIRECT (CONVERT_EACH_TO_ONE__Strings_to_Categories) {
6805 CONVERT_EACH_TO_ONE (Strings)
6806 autoCategories result = Strings_to_Categories (me);
6807 CONVERT_EACH_TO_ONE_END (my name.get())
6808 }
6809
6810 FORM (CONVERT_EACH_TO_ONE__Strings_change, U"Strings: Change", U"Strings: Change") {
6811 SENTENCE (search_string, U"Search", U"a")
6812 SENTENCE (replace_string, U"Replace", U"a")
6813 INTEGER (replaceLimit, U"Replace limit", U"0 (= unlimited)")
6814 CHOICE (stringType, U"Search and replace are:", 1)
6815 OPTION (U"literals")
6816 OPTION (U"Regular Expressions")
6817 OK
6818 DO
6819 CONVERT_EACH_TO_ONE (Strings)
6820 integer nmatches, nstringmatches;
6821 autoStrings result = Strings_change (
6822 me, search_string, replace_string, replaceLimit, &nmatches, &nstringmatches, stringType - 1
6823 );
6824 CONVERT_EACH_TO_ONE_END (my name.get())
6825 }
6826
6827 FORM (CONVERT_EACH_TO_ONE__Strings_extractPart, U"Strings: Extract part", nullptr) {
6828 NATURAL (fromIndex, U"From index", U"1")
6829 NATURAL (toIndex, U"To index", U"1")
6830 OK
6831 DO
6832 CONVERT_EACH_TO_ONE (Strings)
6833 autoStrings result = Strings_extractPart (me, fromIndex, toIndex);
6834 CONVERT_EACH_TO_ONE_END (my name.get(), U"_part");
6835 }
6836
6837 DIRECT (CONVERT_TWO_TO_ONE__Strings_to_EditDistanceTable) {
6838 CONVERT_TWO_TO_ONE (Strings)
6839 autoEditDistanceTable result = EditDistanceTable_create (me, you);
6840 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
6841 }
6842
6843 FORM (CONVERT_EACH_TO_ONE__Strings_to_StringsIndex, U"Strings: To StringsIndex", nullptr) {
6844 OPTIONMENU_ENUM (kStrings_sorting, sorting, U"Sorting method", kStrings_sorting::DEFAULT)
6845 OK
6846 DO
6847 CONVERT_EACH_TO_ONE (Strings)
6848 autoStringsIndex result = Strings_to_StringsIndex (me, sorting);
6849 CONVERT_EACH_TO_ONE_END (my name.get())
6850 }
6851
6852 FORM (CONVERT_EACH_TO_ONE__Strings_to_Permutation_old, U"Strings: To Permutation", U"Strings: To Permutation...") {
6853 BOOLEAN (sort, U"Sort", true)
6854 OK
6855 DO
6856 CONVERT_EACH_TO_ONE (Strings)
6857 autoPermutation result = Strings_to_Permutation (me, (sort ? kStrings_sorting::ALPHABETICAL : kStrings_sorting::NONE));
6858 CONVERT_EACH_TO_ONE_END (my name.get())
6859 }
6860
6861 FORM (CONVERT_EACH_TO_ONE__Strings_to_Permutation, U"Strings: To Permutation", U"Strings: To Permutation...") {
6862 OPTIONMENU_ENUM (kStrings_sorting, sortingMethod, U"Sorting", kStrings_sorting::DEFAULT)
6863 OK
6864 DO_ALTERNATIVE (CONVERT_EACH_TO_ONE__Strings_to_Permutation_old)
6865 CONVERT_EACH_TO_ONE (Strings)
6866 autoPermutation result = Strings_to_Permutation (me, sortingMethod);
6867 CONVERT_EACH_TO_ONE_END (my name.get())
6868 }
6869
6870 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__Strings_Permutation_permuteStrings) {
6871 CONVERT_ONE_AND_ONE_TO_ONE (Strings, Permutation)
6872 autoStrings result = Strings_Permutation_permuteStrings (me, you);
6873 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
6874 }
6875
6876 /****************************** SVD *****************************************/
6877
6878 DIRECT (HELP__SVD_help) {
6879 HELP (U"singular value decomposition")
6880 }
6881
6882 DIRECT (QUERY_ONE_FOR_INTEGER__SVD_getNumberOfRows) {
6883 QUERY_ONE_FOR_INTEGER (SVD)
6884 const integer result = ( my isTransposed ? my numberOfColumns : my numberOfRows );
6885 QUERY_ONE_FOR_INTEGER_END (U" (number of rows)")
6886 }
6887
6888 DIRECT (QUERY_ONE_FOR_INTEGER__SVD_getNumberOfColumns) {
6889 QUERY_ONE_FOR_INTEGER (SVD)
6890 const integer result = ( my isTransposed ? my numberOfRows : my numberOfColumns );
6891 QUERY_ONE_FOR_INTEGER_END (U" (number of columns)")
6892 }
6893
6894 DIRECT (QUERY_ONE_FOR_REAL__SVD_getRank) {
6895 QUERY_ONE_FOR_REAL (SVD)
6896 const double result = SVD_getRank (me);
6897 QUERY_ONE_FOR_REAL_END (U" (rank)")
6898 }
6899
6900 DIRECT (QUERY_ONE_FOR_REAL__SVD_getConditionNumber) {
6901 QUERY_ONE_FOR_REAL (SVD)
6902 const double result = SVD_getConditionNumber (me);
6903 QUERY_ONE_FOR_REAL_END (U" (condition number)")
6904 }
6905
6906 FORM (QUERY_ONE_FOR_REAL__SVD_getSingularValue, U"SVD: Get singular values", nullptr) {
6907 NATURAL (index, U"Index", U"1")
6908 OK
6909 DO
6910 QUERY_ONE_FOR_REAL (SVD)
6911 Melder_require (index <= my numberOfColumns,
6912 U"Index must be in the range [1,", my numberOfColumns, U"].");
6913 const double result = my d [index];
6914 QUERY_ONE_FOR_REAL_END (U" (singular value ", index, U")")
6915 }
6916
6917 FORM (QUERY_ONE_FOR_REAL__SVD_getSumOfSingularValues, U"SVD: Get sum of singular values", nullptr) {
6918 NATURAL (from, U"From", U"1")
6919 INTEGER (to, U"To", U"0 (= last)")
6920 OK
6921 DO
6922 QUERY_ONE_FOR_REAL (SVD)
6923 const double result = SVD_getSumOfSingularValues (me, from, to);
6924 QUERY_ONE_FOR_REAL_END (U" (sum of singular values)")
6925 }
6926
6927 FORM (QUERY_ONE_FOR_REAL__SVD_getSumOfSingularValuesAsFractionOfTotal, U"SVD: Get sum of singular values as fraction of total", nullptr) {
6928 NATURAL (from, U"From", U"1")
6929 INTEGER (to, U"To", U"0 (= last)")
6930 OK
6931 DO
6932 QUERY_ONE_FOR_REAL (SVD)
6933 const double result = SVD_getSumOfSingularValuesAsFractionOfTotal (me, from, to);
6934 QUERY_ONE_FOR_REAL_END (U" (fraction of total sum of singular values)")
6935 }
6936
6937 FORM (QUERY_ONE_FOR_INTEGER__SVD_getMinimumNumberOfSingularValues, U"SVD: Get minimum number of singular values", U"SVD: Get minimum number of singular values...") {
6938 POSITIVE (fraction, U"Fraction of total sum", U"0.95")
6939 OK
6940 DO
6941 Melder_require (fraction <= 1.0,
6942 U"Fraction must be a number in (0,1).");
6943 QUERY_ONE_FOR_INTEGER (SVD)
6944 const integer result = SVD_getMinimumNumberOfSingularValues (me, fraction);
6945 QUERY_ONE_FOR_INTEGER_END (U" (number of singular values needed)")
6946 }
6947
6948 FORM (QUERY_ONE_FOR_REAL__SVD_getShrinkageParameter, U"SVD: Get shrinkage parameter", nullptr) {
6949 POSITIVE (edf, U"Effective degrees of freedom", U"3.0")
6950 OK
6951 DO
6952 QUERY_ONE_FOR_REAL (SVD)
6953 const double result = SVD_getShrinkageParameter (me, edf);
6954 QUERY_ONE_FOR_REAL_END (U" (shrinkage parameter for ridge regression with ", edf, U" effective degrees of freedom)")
6955 }
6956
6957 FORM (QUERY_ONE_FOR_REAL__SVD_getEffectiveDegreesOfFreedom, U"SVD: Get effective degrees of freedom", nullptr) {
6958 POSITIVE (lambda, U"Shrinkage parameter", U"0.0")
6959 OK
6960 DO
6961 QUERY_ONE_FOR_REAL (SVD)
6962 const double result = SVD_getEffectiveDegreesOfFreedom (me, lambda);
6963 QUERY_ONE_FOR_REAL_END (U" (effective degrees of freedom for ridge regression with ", lambda, U" shrinkage factor)")
6964 }
6965
6966 FORM (CONVERT_EACH_TO_ONE__SVD_to_Matrix, U"SVD: To Matrix", U"SVD: To Matrix...") {
6967 NATURAL (fromComponent, U"First component", U"1")
6968 INTEGER (toComponent, U"Last component", U"0 (= all)")
6969 OK
6970 DO
6971 CONVERT_EACH_TO_ONE (SVD)
6972 autoMatrix result = SVD_to_Matrix (me, fromComponent, toComponent);
6973 CONVERT_EACH_TO_ONE_END (my name.get())
6974 }
6975
6976 FORM (CONVERT_EACH_TO_ONE__SVD_to_TableOfReal, U"SVD: To TableOfReal", U"SVD: To TableOfReal...") {
6977 NATURAL (fromComponent, U"First component", U"1")
6978 INTEGER (toComponent, U"Last component", U"0 (= all)")
6979 OK
6980 DO
6981 CONVERT_EACH_TO_ONE (SVD)
6982 autoTableOfReal result = SVD_to_TableOfReal (me, fromComponent, toComponent);
6983 CONVERT_EACH_TO_ONE_END (my name.get())
6984 }
6985
6986 DIRECT (CONVERT_EACH_TO_ONE__SVD_extractLeftSingularVectors) {
6987 CONVERT_EACH_TO_ONE (SVD)
6988 autoTableOfReal result = SVD_extractLeftSingularVectors (me);
6989 CONVERT_EACH_TO_ONE_END (my name.get(), U"_lsv")
6990 }
6991
6992 DIRECT (CONVERT_EACH_TO_ONE__SVD_extractRightSingularVectors) {
6993 CONVERT_EACH_TO_ONE (SVD)
6994 autoTableOfReal result = SVD_extractRightSingularVectors (me);
6995 CONVERT_EACH_TO_ONE_END (my name.get(), U"_rsv")
6996 }
6997
6998 DIRECT (CONVERT_EACH_TO_ONE__SVD_extractSingularValues) {
6999 CONVERT_EACH_TO_ONE (SVD)
7000 autoTableOfReal result = SVD_extractSingularValues (me);
7001 CONVERT_EACH_TO_ONE_END (my name.get(), U"_sv");
7002 }
7003
7004 /******************* Table ****************************/
7005
7006 DIRECT (CREATE_ONE__Table_create_petersonBarney1952) {
7007 CREATE_ONE
7008 autoTable result = Table_create_petersonBarney1952 ();
7009 CREATE_ONE_END (U"pb")
7010 }
7011
7012 DIRECT (CREATE_ONE__Table_create_hillenbrandEtAl1995) {
7013 CREATE_ONE
7014 autoTable result = Table_create_hillenbrandEtAl1995 ();
7015 CREATE_ONE_END (U"h95")
7016 }
7017
7018 DIRECT (CREATE_ONE__Table_create_polsVanNierop1973) {
7019 CREATE_ONE
7020 autoTable result = Table_create_polsVanNierop1973 ();
7021 CREATE_ONE_END (U"pvn")
7022 }
7023
7024 DIRECT (CREATE_ONE__Table_create_weenink1983) {
7025 CREATE_ONE
7026 autoTable result = Table_create_weenink1983 ();
7027 CREATE_ONE_END (U"m10w10c10")
7028 }
7029
7030 // deprecated 2023
7031 FORM (GRAPHICS_EACH__Table_scatterPlotWhere, U"Table: Scatter plot where", nullptr) {
7032 WORD (xColumnName, U"Horizontal column", U"")
7033 REAL (xmin, U"left Horizontal range", U"0.0")
7034 REAL (xmax, U"right Horizontal range", U"0.0 (= auto)")
7035 WORD (yColumnName, U"Vertical column", U"")
7036 REAL (ymin, U"left Vertical range", U"0.0")
7037 REAL (ymax, U"right Vertical range", U"0.0 (= auto)")
7038 WORD (markColumnName, U"Column with marks", U"")
7039 POSITIVE (fontSize, U"Font size", U"12")
7040 BOOLEAN (garnish, U"Garnish", true)
7041 COMMENT (U"Use data only from rows where the following condition holds.")
7042 FORMULA (condition, U"Condition", U"1; self$[\"gender\"]=\"male\"")
7043 OK
7044 DO
7045 GRAPHICS_EACH (Table)
7046 const integer xColumnNumber = Table_columnNameToNumber_e (me, xColumnName);
7047 const integer yColumnNumber = Table_columnNameToNumber_e (me, yColumnName);
7048 const integer markColumnNumber = Table_columnNameToNumber_e (me, markColumnName);
7049 autoTable part = Table_extractRowsWhere (me, condition, interpreter);
7050 Table_scatterPlot (part.get(), GRAPHICS, xColumnNumber, yColumnNumber,
7051 xmin, xmax, ymin, ymax, markColumnNumber, fontSize, garnish);
7052 GRAPHICS_EACH_END
7053 }
7054
7055 // deprecated 2023
7056 FORM (GRAPHICS_EACH__Table_scatterPlotMarkWhere, U"Scatter plot where (marks)", nullptr) {
7057 WORD (xColumnName, U"Horizontal column", U"")
7058 REAL (xmin, U"left Horizontal range", U"0.0")
7059 REAL (xmax, U"right Horizontal range", U"0.0 (= auto)")
7060 WORD (yColumnName, U"Vertical column", U"")
7061 REAL (ymin, U"left Vertical range", U"0.0")
7062 REAL (ymax, U"right Vertical range", U"0.0 (= auto)")
7063 POSITIVE (markSize_mm, U"Mark size (mm)", U"1.0")
7064 BOOLEAN (garnish, U"Garnish", true)
7065 SENTENCE (mark_string, U"Mark string (+xo.)", U"+")
7066 COMMENT (U"Use data only from rows where the following condition holds.")
7067 FORMULA (condition, U"Condition", U"1; self$[\"gender\"]=\"male\"")
7068 OK
7069 DO
7070 GRAPHICS_EACH (Table)
7071 const integer xColumnNumber = Table_columnNameToNumber_e (me, xColumnName);
7072 const integer yColumnNumber = Table_columnNameToNumber_e (me, yColumnName);
7073 autoTable part = Table_extractRowsWhere_e (me, condition, interpreter);
7074 Table_scatterPlot_mark (part.get(), GRAPHICS, xColumnNumber, yColumnNumber,
7075 xmin, xmax, ymin, ymax, markSize_mm, mark_string, garnish);
7076 GRAPHICS_EACH_END
7077 }
7078
7079 FORM (GRAPHICS_EACH__Table_barPlotWhere, U"Table: Bar plot where", U"Table: Bar plot...") { // deprecated 2023
7080 STRINGARRAY_LINES (2, columnNames, U"Vertical column(s)", { U"speaker", U"age" })
7081 ///SENTENCE (yColumns_string, U"Vertical column(s)", U"")
7082 REAL (ymin, U"left Vertical range", U"0.0")
7083 REAL (ymax, U"right Vertical range", U"0.0 (= auto)")
7084 SENTENCE (labelColumnName, U"Column with labels", U"")
7085 COMMENT (U"Distances are in units of 'bar width'")
7086 REAL (distanceFromBorder, U"Distance of first bar from border", U"1.0")
7087 REAL (distanceBetweenGroups, U"Distance between bar groups", U"1.0")
7088 REAL (distanceWithinGroup, U"Distance between bars within group", U"0.0")
7089 STRINGARRAY_LINES (2, colours, U"Colours", { U"Grey", U"Black" })
7090 REAL (angle, U"Label text angle (degrees)", U"0.0");
7091 BOOLEAN (garnish, U"Garnish", true)
7092 COMMENT (U"Use data only from rows where the following condition holds.")
7093 FORMULA (condition, U"Condition", U"row >= 1 and row <= 8")
7094 OK
7095 DO
7096 GRAPHICS_EACH (Table)
7097 autoINTVEC columnNumbers = Table_columnNamesToNumbers (me, columnNames);
7098 const integer labelColumnNumber = Table_columnNameToNumber_0 (me, labelColumnName); // can be empty
7099 autoTable part = Table_extractRowsWhere_e (me, condition, interpreter);
7100 Table_barPlot (part.get(), GRAPHICS, columnNumbers.get(), ymin, ymax, labelColumnNumber, distanceFromBorder,
7101 distanceWithinGroup, distanceBetweenGroups, colours, angle, garnish);
7102 GRAPHICS_EACH_END
7103 }
7104
7105 FORM (GRAPHICS_EACH__Table_barPlot, U"Table: Bar plot", U"Table: Bar plot...") {
7106 STRINGARRAY_LINES (2, columnNames, U"Vertical column(s)", { U"speaker", U"age" })
7107 ///SENTENCE (yColumns_string, U"Vertical column(s)", U"")
7108 REAL (ymin, U"left Vertical range", U"0.0")
7109 REAL (ymax, U"right Vertical range", U"0.0 (= auto)")
7110 SENTENCE (labelColumnName, U"Column with labels", U"")
7111 COMMENT (U"Distances are in units of 'bar width'")
7112 REAL (distanceFromBorder, U"Distance of first bar from border", U"1.0")
7113 REAL (distanceBetweenGroups, U"Distance between bar groups", U"1.0")
7114 REAL (distanceWithinGroup, U"Distance between bars within group", U"0.0")
7115 STRINGARRAY_LINES (2, colours, U"Colours", { U"Grey", U"Black" })
7116 REAL (angle, U"Label text angle (degrees)", U"0.0");
7117 BOOLEAN (garnish, U"Garnish", true)
7118 OK
7119 DO
7120 GRAPHICS_EACH (Table)
7121 autoINTVEC columnNumbers = Table_columnNamesToNumbers (me, columnNames);
7122 const integer labelColumnNumber = Table_columnNameToNumber_0 (me, labelColumnName); // can be empty
7123 Table_barPlot (me, GRAPHICS, columnNumbers.get(), ymin, ymax, labelColumnNumber, distanceFromBorder,
7124 distanceWithinGroup, distanceBetweenGroups, colours, angle, garnish);
7125 GRAPHICS_EACH_END
7126 }
7127
7128 FORM (GRAPHICS_EACH__Table_LineGraphWhere, U"Table: Line graph where", U"Table: Line graph...") {
7129 SENTENCE (yColumnName, U"Vertical column", U"")
7130 REAL (ymin, U"left Vertical range", U"0.0")
7131 REAL (ymax, U"right Vertical range", U"0.0 (= auto)")
7132 SENTENCE (xColumnName, U"Horizontal column (optional)", U"")
7133 REAL (xmin, U"left Horizontal range", U"0.0")
7134 REAL (xmax, U"right Horizontal range", U"0.0 (= auto)")
7135 WORD (text, U"Text", U"+")
7136 REAL (angle, U"Label text angle (degrees)", U"0.0");
7137 BOOLEAN (garnish, U"Garnish", true)
7138 COMMENT (U"Use data only from rows where the following condition holds.")
7139 FORMULA (condition, U"Condition", U"1; (= everything)")
7140 OK
7141 DO
7142 GRAPHICS_EACH (Table)
7143 const integer yColumnNumber = Table_columnNameToNumber_e (me, yColumnName);
7144 const integer xColumnNumber = str32equ (xColumnName, U"") ? 0 : Table_columnNameToNumber_e (me, xColumnName);
7145 autoTable part = Table_extractRowsWhere_e (me, condition, interpreter);
7146 Table_lineGraph_old (part.get(), GRAPHICS, xColumnNumber, xmin, xmax, yColumnNumber, ymin, ymax, text,
7147 angle, garnish);
7148 GRAPHICS_EACH_END
7149 }
7150
7151 FORM (GRAPHICS_EACH__Table_LineGraph_old, U"Table: Line graph", U"Table: Line graph...") {
7152 SENTENCE (yColumnName, U"Vertical column", U"")
7153 REAL (ymin, U"left Vertical range", U"0.0")
7154 REAL (ymax, U"right Vertical range", U"0.0 (= auto)")
7155 SENTENCE (xColumnName, U"Horizontal column (optional)", U"")
7156 REAL (xmin, U"left Horizontal range", U"0.0")
7157 REAL (xmax, U"right Horizontal range", U"0.0 (= auto)")
7158 WORD (text, U"Text", U"+")
7159 REAL (angle, U"Label text angle (degrees)", U"0.0");
7160 BOOLEAN (garnish, U"Garnish", true)
7161 OK
7162 DO
7163 GRAPHICS_EACH (Table)
7164 const integer yColumnNumber = Table_columnNameToNumber_e (me, yColumnName);
7165 const integer xColumnNumber = str32equ (xColumnName, U"") ? 0 : Table_columnNameToNumber_e (me, xColumnName);
7166 Table_lineGraph_old (me, GRAPHICS, xColumnNumber, xmin, xmax, yColumnNumber, ymin, ymax, text,
7167 angle, garnish);
7168 GRAPHICS_EACH_END
7169 }
7170
7171 FORM (GRAPHICS_EACH__Table_LineGraph, U"Table: Line graph", U"Table: Line graph...") {
7172 SENTENCE (yColumnName, U"Vertical column", U"")
7173 REAL (ymin, U"left Vertical range", U"0.0")
7174 REAL (ymax, U"right Vertical range", U"0.0 (= auto)")
7175 SENTENCE (xColumnName, U"Horizontal column (optional)", U"")
7176 REAL (xmin, U"left Horizontal range", U"0.0")
7177 REAL (xmax, U"right Horizontal range", U"0.0 (= auto)")
7178 WORD (text, U"Text", U"+")
7179 REAL (textFontSize, U"Text font size", U"12")
7180 REAL (angle, U"Label text angle (degrees)", U"0.0");
7181 BOOLEAN (garnish, U"Garnish", true)
7182 OK
7183 DO_ALTERNATIVE (GRAPHICS_EACH__Table_LineGraph_old)
7184 GRAPHICS_EACH (Table)
7185 const integer yColumnNumber = Table_columnNameToNumber_e (me, yColumnName);
7186 const integer xColumnNumber = str32equ (xColumnName, U"") ? 0 : Table_columnNameToNumber_e (me, xColumnName);
7187 Table_lineGraph (me, GRAPHICS, xColumnNumber, xmin, xmax, yColumnNumber, ymin, ymax, text,
7188 textFontSize, angle, garnish);
7189 GRAPHICS_EACH_END
7190 }
7191
7192 FORM (GRAPHICS_EACH__Table_boxPlots, U"Table: Box plots", U"Table: Box plots...") {
7193 STRINGARRAY_LINES (2, dataColumnNames, U"Data columns", { U"F1", U"F2" })
7194 WORD (factorColumnName, U"Factor column", U"Sex")
7195 REAL (ymin, U"left Vertical range", U"0.0")
7196 REAL (ymax, U"right Vertical range", U"0.0")
7197 BOOLEAN (garnish, U"Garnish", true);
7198 OK
7199 DO
7200 GRAPHICS_EACH (Table)
7201 const integer factorColumnNumber = Table_columnNameToNumber_e (me, factorColumnName);
7202 autoINTVEC dataColumnNumbers = Table_columnNamesToNumbers (me, dataColumnNames);
7203 Table_boxPlots (me, GRAPHICS, dataColumnNumbers.get(), factorColumnNumber, ymin, ymax, garnish);
7204 GRAPHICS_EACH_END
7205 }
7206
7207 FORM (GRAPHICS_EACH__Table_boxPlotsWhere, U"Table: Box plots where", U"Table: Box plots...") { // deprecated 2023
7208 STRINGARRAY_LINES (2, dataColumnNames, U"Data columns", { U"F1", U"F2" })
7209 WORD (factorColumnName, U"Factor column", U"")
7210 REAL (ymin, U"left Vertical range", U"0.0")
7211 REAL (ymax, U"right Vertical range", U"0.0")
7212 BOOLEAN (garnish, U"Garnish", true);
7213 COMMENT (U"Use data only in rows where the following condition holds.")
7214 FORMULA (condition, U"Condition", U"1; self$[\"gender\"]=\"male\"")
7215 OK
7216 DO
7217 GRAPHICS_EACH (Table)
7218 const integer factorColumnNumber = Table_columnNameToNumber_e (me, factorColumnName);
7219 autoINTVEC dataColumnNumbers = Table_columnNamesToNumbers (me, dataColumnNames);
7220 autoTable part = Table_extractRowsWhere_e (me, condition, interpreter);
7221 Table_boxPlots (part.get(), GRAPHICS, dataColumnNumbers.get(), factorColumnNumber, ymin, ymax, garnish);
7222 GRAPHICS_EACH_END
7223 }
7224
7225 FORM (GRAPHICS_EACH__Table_drawEllipseWhere, U"Draw ellipse (standard deviation)", nullptr) { // deprecated 2023
7226 SENTENCE (xColumnName, U"Horizontal column", U"")
7227 REAL (xmin, U"left Horizontal range", U"0.0")
7228 REAL (xmax, U"right Horizontal range", U"0.0 (= auto)")
7229 SENTENCE (yColumnName, U"Vertical column", U"")
7230 REAL (ymin, U"left Vertical range", U"0.0")
7231 REAL (ymax, U"right Vertical range", U"0.0 (= auto)")
7232 POSITIVE (numberOfSigmas, U"Number of sigmas", U"2.0")
7233 BOOLEAN (garnish, U"Garnish", true)
7234 COMMENT (U"Use data only in rows where the following condition holds.")
7235 FORMULA (condition, U"Condition", U"1; self$[\"gender\"]=\"male\"")
7236 OK
7237 DO
7238 GRAPHICS_EACH (Table)
7239 const integer xColumnNumber = Table_columnNameToNumber_e (me, xColumnName);
7240 const integer yColumnNumber = Table_columnNameToNumber_e (me, yColumnName);
7241 autoTable thee = Table_extractRowsWhere_e (me, condition, interpreter);
7242 Table_drawEllipse_e (thee.get(), GRAPHICS, xColumnNumber, yColumnNumber,
7243 xmin, xmax, ymin, ymax, numberOfSigmas, garnish);
7244 GRAPHICS_EACH_END
7245 }
7246
7247 FORM (GRAPHICS_EACH__Table_drawEllipses, U"Table: Draw ellipses", nullptr) {
7248 SENTENCE (xColumnName, U"Horizontal column", U"F2")
7249 REAL (xmin, U"left Horizontal range", U"0.0")
7250 REAL (xmax, U"right Horizontal range", U"0.0 (= auto)")
7251 SENTENCE (yColumnName, U"Vertical column", U"F1")
7252 REAL (ymin, U"left Vertical range", U"0.0")
7253 REAL (ymax, U"right Vertical range", U"0.0 (= auto)")
7254 SENTENCE (factorColumnName, U"Factor column", U"Vowel")
7255 POSITIVE (numberOfSigmas, U"Number of sigmas", U"1.0")
7256 REAL (fontSize, U"Label font size", U"12.0 ; (0 = no label)")
7257 BOOLEAN (garnish, U"Garnish", true)
7258 OK
7259 DO
7260 GRAPHICS_EACH (Table)
7261 const integer xColumnNumber = Table_columnNameToNumber_e (me, xColumnName);
7262 const integer yColumnNumber = Table_columnNameToNumber_e (me, yColumnName);
7263 const integer factorColumnNumber = Table_columnNameToNumber_e (me, factorColumnName);
7264 Table_drawEllipses (me, GRAPHICS, xColumnNumber, yColumnNumber, factorColumnNumber,
7265 xmin, xmax, ymin, ymax, numberOfSigmas, fontSize, garnish);
7266 GRAPHICS_EACH_END
7267 }
7268
7269 FORM (GRAPHICS_EACH__Table_drawEllipsesWhere, U"Table: Draw ellipses where", nullptr) { // deprecated 2023
7270 SENTENCE (xColumnName, U"Horizontal column", U"F2")
7271 REAL (xmin, U"left Horizontal range", U"0.0")
7272 REAL (xmax, U"right Horizontal range", U"0.0 (= auto)")
7273 SENTENCE (yColumnName, U"Vertical column", U"F1")
7274 REAL (ymin, U"left Vertical range", U"0.0")
7275 REAL (ymax, U"right Vertical range", U"0.0 (= auto)")
7276 SENTENCE (factorColumnName, U"Factor column", U"Vowel")
7277 POSITIVE (numberOfSigmas, U"Number of sigmas", U"1.0")
7278 REAL (fontSize, U"Label font size", U"12.0 ; (0 = no label)")
7279 BOOLEAN (garnish, U"Garnish", true)
7280 COMMENT (U"Use data only in rows where the following condition holds.")
7281 FORMULA (condition, U"Condition", U"1; self$[\"gender\"]=\"male\"")
7282 OK
7283 DO
7284 GRAPHICS_EACH (Table)
7285 const integer xColumnNumber = Table_columnNameToNumber_e (me, xColumnName);
7286 const integer yColumnNumber = Table_columnNameToNumber_e (me, yColumnName);
7287 const integer factorColumnNumber = Table_columnNameToNumber_e (me, factorColumnName);
7288 Table_extractRowsWhere_e (me, condition, interpreter);
7289 Table_drawEllipses (me, GRAPHICS, xColumnNumber, yColumnNumber, factorColumnNumber,
7290 xmin, xmax, ymin, ymax, numberOfSigmas, fontSize, garnish);
7291 GRAPHICS_EACH_END
7292 }
7293
7294 FORM (GRAPHICS_EACH__Table_normalProbabilityPlot, U"Table: Normal probability plot", U"Table: Normal probability plot...") {
7295 SENTENCE (columnName, U"Column", U"F1")
7296 NATURAL (numberOfQuantiles, U"Number of quantiles", U"100")
7297 REAL (numberOfSigmas, U"Number of sigmas", U"0.0")
7298 NATURAL (labelSize, U"Label size", U"12")
7299 SENTENCE (label, U"Label", U"+")
7300 BOOLEAN (garnish, U"Garnish", true);
7301 OK
7302 DO
7303 GRAPHICS_EACH (Table)
7304 const integer columnNumber = Table_columnNameToNumber_e (me, columnName);
7305 Table_normalProbabilityPlot (me, GRAPHICS, columnNumber, numberOfQuantiles, numberOfSigmas, labelSize, label, garnish);
7306 GRAPHICS_EACH_END
7307 }
7308
7309 // deprecated 2023
7310 FORM (GRAPHICS_EACH__Table_normalProbabilityPlotWhere, U"Table: Normal probability plot where", U"Table: Normal probability plot...") {
7311 SENTENCE (columnName, U"Column", U"F0")
7312 NATURAL (numberOfQuantiles, U"Number of quantiles", U"100")
7313 REAL (numberOfSigmas, U"Number of sigmas", U"0.0")
7314 NATURAL (labelSize, U"Label size", U"12")
7315 SENTENCE (label, U"Label", U"+")
7316 BOOLEAN (garnish, U"Garnish", true);
7317 COMMENT (U"Use data only in rows where the following condition holds.")
7318 FORMULA (condition, U"Condition", U"1; self$[\"gender\"]=\"male\"")
7319 OK
7320 DO
7321 GRAPHICS_EACH (Table)
7322 const integer columnNumber = Table_columnNameToNumber_e (me, columnName);
7323 const autoTable thee = Table_extractRowsWhere (me, condition, interpreter);
7324 Table_normalProbabilityPlot (thee.get(), GRAPHICS, columnNumber, numberOfQuantiles, numberOfSigmas, labelSize, label, garnish);
7325 GRAPHICS_EACH_END
7326 }
7327
7328 FORM (GRAPHICS_EACH__Table_quantileQuantilePlot, U"Table: Quantile-quantile plot", U"Table: Quantile-quantile plot...") {
7329 SENTENCE (xColumnName, U"Horizontal axis column", U"")
7330 SENTENCE (yColumnName, U"Vertical axis column", U"")
7331 NATURAL (numberOfQuantiles, U"Number of quantiles", U"100")
7332 REAL (xmin, U"left Horizontal range", U"0.0")
7333 REAL (xmax, U"right Horizontal range", U"0.0")
7334 REAL (ymin, U"left Vertical range", U"0.0")
7335 REAL (ymax, U"right Vertical range", U"0.0")
7336 NATURAL (labelSize, U"Label size", U"12")
7337 SENTENCE (label, U"Label", U"+")
7338 BOOLEAN (garnish, U"Garnish", true);
7339 OK
7340 DO
7341 GRAPHICS_EACH (Table)
7342 const integer xColumnNumber = Table_columnNameToNumber_e (me, xColumnName);
7343 const integer yColumnNumber = Table_columnNameToNumber_e (me, yColumnName);
7344 Table_quantileQuantilePlot (me, GRAPHICS, xColumnNumber, yColumnNumber,
7345 numberOfQuantiles, xmin, xmax, ymin, ymax, labelSize, label, garnish);
7346 GRAPHICS_EACH_END
7347 }
7348
7349 FORM (GRAPHICS_EACH__Table_quantileQuantilePlot_betweenLevels, U"Table: Quantile-quantile plot (between levels)", U"Table: Quantile-quantile plot...") {
7350 SENTENCE (dataColumnName, U"Data column", U"F0")
7351 SENTENCE (factorColumnName, U"Factor column", U"Sex")
7352 SENTENCE (xLevel_string, U"Horizontal factor level", U"")
7353 SENTENCE (yLevelString, U"Vertical factor level", U"")
7354 NATURAL (numberOfQuantiles, U"Number of quantiles", U"100")
7355 REAL (xmin, U"left Horizontal range", U"0.0")
7356 REAL (xmax, U"right Horizontal range", U"0.0")
7357 REAL (ymin, U"left Vertical range", U"0.0")
7358 REAL (ymax, U"right Vertical range", U"0.0")
7359 NATURAL (labelSize, U"Label size", U"12")
7360 SENTENCE (label, U"Label", U"+")
7361 BOOLEAN (garnish, U"Garnish", true);
7362 OK
7363 DO
7364 GRAPHICS_EACH (Table)
7365 const integer dataColumnNumber = Table_columnNameToNumber_e (me, dataColumnName);
7366 const integer factorColumnNumber = Table_columnNameToNumber_e (me, factorColumnName);
7367 Table_quantileQuantilePlot_betweenLevels (me, GRAPHICS, dataColumnNumber, factorColumnNumber, xLevel_string, yLevelString,
7368 numberOfQuantiles, xmin, xmax, ymin, ymax, labelSize, label, garnish);
7369 GRAPHICS_EACH_END
7370 }
7371
7372 FORM (GRAPHICS_EACH__Table_lagPlot, U"Table: lag plot", nullptr) {
7373 SENTENCE (dataColumnName, U"Data column", U"errors")
7374 NATURAL (lag, U"Lag", U"1")
7375 REAL (fromXY, U"left Horizontal and vertical range", U"0.0")
7376 REAL (toXY, U"right Horizontal and vertical range", U"0.0")
7377 NATURAL (labelSize, U"Label size", U"12")
7378 SENTENCE (label, U"Label", U"+")
7379 BOOLEAN (garnish, U"Garnish", true);
7380 OK
7381 DO
7382 GRAPHICS_EACH (Table)
7383 const integer dataColumnNumber = Table_columnNameToNumber_e (me, dataColumnName);
7384 Table_lagPlot (me, GRAPHICS, dataColumnNumber, lag, fromXY, toXY, label, labelSize, garnish);
7385 GRAPHICS_EACH_END
7386 }
7387
7388 // deprecated 2023
7389 FORM (GRAPHICS_EACH__Table_lagPlotWhere, U"Table: lag plot where", nullptr) {
7390 SENTENCE (dataColumnName, U"Data column", U"errors")
7391 NATURAL (lag, U"Lag", U"1")
7392 REAL (fromXY, U"left Horizontal and vertical range", U"0.0")
7393 REAL (toXY, U"right Horizontal and vertical range", U"0.0")
7394 NATURAL (labelSize, U"Label size", U"12")
7395 SENTENCE (label, U"Label", U"+")
7396 BOOLEAN (garnish, U"Garnish", true);
7397 COMMENT (U"Use data only in rows where the following condition holds.")
7398 FORMULA (condition, U"Condition", U"1; self$[\"gender\"]=\"male\"")
7399 OK
7400 DO
7401 GRAPHICS_EACH (Table)
7402 const integer dataColumnNumber = Table_columnNameToNumber_e (me, dataColumnName);
7403 autoTable thee = Table_extractRowsWhere_e (me, condition, interpreter);
7404 Table_lagPlot (me, GRAPHICS, dataColumnNumber, lag, fromXY, toXY, label, labelSize, garnish);
7405 GRAPHICS_EACH_END
7406 }
7407
7408 FORM (GRAPHICS_EACH__Table_distributionPlot, U"Table: Distribution plot", nullptr) {
7409 SENTENCE (dataColumnName, U"Data column", U"data")
7410 REAL (minimumValue, U"Minimum value", U"0.0")
7411 REAL (maximumValue, U"Maximum value", U"0.0")
7412 COMMENT (U"Display of the distribution")
7413 NATURAL (numberOfBins, U"Number of bins", U"10")
7414 REAL (minimumFrequency, U"Minimum frequency", U"0.0")
7415 REAL (maximumFrequency, U"Maximum frequency", U"0.0")
7416 BOOLEAN (garnish, U"Garnish", true)
7417 OK
7418 DO
7419 GRAPHICS_EACH (Table)
7420 const integer dataColumnNumber = Table_columnNameToNumber_e (me, dataColumnName);
7421 Table_distributionPlot (me, GRAPHICS, dataColumnNumber, minimumValue, maximumValue,
7422 numberOfBins, minimumFrequency, maximumFrequency, garnish
7423 );
7424 GRAPHICS_EACH_END
7425 }
7426
7427 // deprecated 2023
7428 FORM (GRAPHICS_EACH__Table_distributionPlotWhere, U"Table: Distribution plot where", nullptr) {
7429 SENTENCE (dataColumnName, U"Data column", U"data")
7430 REAL (minimumValue, U"Minimum value", U"0.0")
7431 REAL (maximumValue, U"Maximum value", U"0.0")
7432 COMMENT (U"Display of the distribution")
7433 NATURAL (numberOfBins, U"Number of bins", U"10")
7434 REAL (minimumFrequency, U"Minimum frequency", U"0.0")
7435 REAL (maximumFrequency, U"Maximum frequency", U"0.0")
7436 BOOLEAN (garnish, U"Garnish", true)
7437 COMMENT (U"Use data only in rows where the following condition holds.")
7438 FORMULA (condition, U"Condition", U"1; self$[\"gender\"]=\"male\"")
7439 OK
7440 DO
7441 GRAPHICS_EACH (Table)
7442 const integer dataColumnNumber = Table_columnNameToNumber_e (me, dataColumnName);
7443 autoTable thee = Table_extractRowsWhere_e (me, condition, interpreter);
7444 Table_distributionPlot (thee.get(), GRAPHICS, dataColumnNumber, minimumValue, maximumValue, numberOfBins,
7445 minimumFrequency, maximumFrequency, garnish
7446 );
7447 GRAPHICS_EACH_END
7448 }
7449
7450 FORM (GRAPHICS_EACH__Table_horizontalErrorBarsPlot, U"Table: Horizontal error bars plot", U"Table: Horizontal error bars plot...") {
7451 SENTENCE (xColumnName, U"Horizontal column", U"x")
7452 REAL (xmin, U"left Horizontal range", U"0.0")
7453 REAL (xmax, U"right Horizontal range", U"0.0")
7454 SENTENCE (yColumnName, U"Vertical column", U"y")
7455 REAL (ymin, U"left Vertical range", U"0.0")
7456 REAL (ymax, U"right Vertical range", U"0.0")
7457 SENTENCE (lowerErrorColumnName, U"Lower error value column", U"error1")
7458 SENTENCE (upperErrorColumnName, U"Upper error value column", U"error2")
7459 REAL (barSize_mm, U"Bar size (mm)", U"1.0")
7460 BOOLEAN (garnish, U"Garnish", true);
7461 OK
7462 DO
7463 GRAPHICS_EACH (Table)
7464 const integer xColumnNumber = Table_columnNameToNumber_e (me, xColumnName);
7465 const integer yColumnNumber = Table_columnNameToNumber_e (me, yColumnName);
7466 const integer xlColumnNumber = Table_columnNameToNumber_0 (me, lowerErrorColumnName);
7467 const integer xuColumnNumber = Table_columnNameToNumber_0 (me, upperErrorColumnName);
7468 Table_horizontalErrorBarsPlot (me, GRAPHICS, xColumnNumber, yColumnNumber,
7469 xmin, xmax, ymin, ymax, xlColumnNumber, xuColumnNumber, barSize_mm, garnish);
7470 GRAPHICS_EACH_END
7471 }
7472
7473 // deprecated 2023
7474 FORM (GRAPHICS_EACH__Table_horizontalErrorBarsPlotWhere, U"Table: Horizontal error bars plot where", U"Table: Horizontal error bars plot where...") {
7475 SENTENCE (xColumnName, U"Horizontal column", U"")
7476 REAL (xmin, U"left Horizontal range", U"0.0")
7477 REAL (xmax, U"right Horizontal range", U"0.0")
7478 SENTENCE (yColumnName, U"Vertical column", U"")
7479 REAL (ymin, U"left Vertical range", U"0.0")
7480 REAL (ymax, U"right Vertical range", U"0.0")
7481 SENTENCE (lowerErrorColumnName, U"Lower error value column", U"error1")
7482 SENTENCE (upperErrorColumnName, U"Upper error value column", U"error2")
7483 REAL (barSize_mm, U"Bar size (mm)", U"1.0")
7484 BOOLEAN (garnish, U"Garnish", true);
7485 COMMENT (U"Use data only in rows where the following condition holds.")
7486 FORMULA (condition, U"Condition", U"1; self$[\"gender\"]=\"male\"")
7487 OK
7488 DO
7489 GRAPHICS_EACH (Table)
7490 const integer xColumnNumber = Table_columnNameToNumber_e (me, xColumnName);
7491 const integer yColumnNumber = Table_columnNameToNumber_e (me, yColumnName);
7492 const integer xlColumnNumber = Table_columnNameToNumber_0 (me, lowerErrorColumnName);
7493 const integer xuColumnNumber = Table_columnNameToNumber_0 (me, upperErrorColumnName);
7494 autoTable thee = Table_extractRowsWhere_e (me, condition, interpreter);
7495 Table_horizontalErrorBarsPlot (me, GRAPHICS, xColumnNumber, yColumnNumber,
7496 xmin, xmax, ymin, ymax, xlColumnNumber, xuColumnNumber, barSize_mm, garnish);
7497 GRAPHICS_EACH_END
7498 }
7499
7500 FORM (GRAPHICS_EACH__Table_verticalErrorBarsPlot, U"Table: Vertical error bars plot", U"Table: Vertical error bars plot...") {
7501 SENTENCE (xColumnName, U"Horizontal column", U"")
7502 REAL (xmin, U"left Horizontal range", U"0.0")
7503 REAL (xmax, U"right Horizontal range", U"0.0")
7504 SENTENCE (yColumnName, U"Vertical column", U"")
7505 REAL (ymin, U"left Vertical range", U"0.0")
7506 REAL (ymax, U"right Vertical range", U"0.0")
7507 SENTENCE (lowerErrorColumnName, U"Lower error value column", U"error1")
7508 SENTENCE (upperErrorColumnName, U"Upper error value column", U"error2")
7509 REAL (barSize_mm, U"Bar size (mm)", U"1.0")
7510 BOOLEAN (garnish, U"Garnish", true);
7511 OK
7512 DO
7513 GRAPHICS_EACH (Table)
7514 const integer xColumnNumber = Table_columnNameToNumber_e (me, xColumnName);
7515 const integer yColumnNumber = Table_columnNameToNumber_e (me, yColumnName);
7516 const integer ylColumnNumber = Table_columnNameToNumber_0 (me, lowerErrorColumnName);
7517 const integer yuColumnNumber = Table_columnNameToNumber_0 (me, upperErrorColumnName);
7518 Table_verticalErrorBarsPlot (me, GRAPHICS, xColumnNumber, yColumnNumber,
7519 xmin, xmax, ymin, ymax, ylColumnNumber, yuColumnNumber, barSize_mm, garnish);
7520 GRAPHICS_EACH_END
7521 }
7522
7523 // deprecated 2023
7524 FORM (GRAPHICS_EACH__Table_verticalErrorBarsPlotWhere, U"Table: Vertical error bars plot where", U"Table: Vertical error bars plot where...") {
7525 SENTENCE (xColumnName, U"Horizontal column", U"")
7526 REAL (xmin, U"left Horizontal range", U"0.0")
7527 REAL (xmax, U"right Horizontal range", U"0.0")
7528 SENTENCE (yColumnName, U"Vertical column", U"")
7529 REAL (ymin, U"left Vertical range", U"0.0")
7530 REAL (ymax, U"right Vertical range", U"0.0")
7531 SENTENCE (lowerErrorColumnName, U"Lower error value column", U"error1")
7532 SENTENCE (upperErrorColumnName, U"Upper error value column", U"error2")
7533 REAL (barSize_mm, U"Bar size (mm)", U"1.0")
7534 BOOLEAN (garnish, U"Garnish", true);
7535 COMMENT (U"Use data only in rows where the following condition holds.")
7536 FORMULA (condition, U"Condition", U"1; self$[\"gender\"]=\"male\"")
7537 OK
7538 DO
7539 GRAPHICS_EACH (Table)
7540 const integer xColumnNumber = Table_columnNameToNumber_e (me, xColumnName);
7541 const integer yColumnNumber = Table_columnNameToNumber_e (me, yColumnName);
7542 const integer ylColumnNumber = Table_columnNameToNumber_0 (me, lowerErrorColumnName);
7543 const integer yuColumnNumber = Table_columnNameToNumber_0 (me, upperErrorColumnName);
7544 autoTable thee = Table_extractRowsWhere_e (me, condition, interpreter);
7545 Table_verticalErrorBarsPlot (thee.get(), GRAPHICS, xColumnNumber, yColumnNumber,
7546 xmin, xmax, ymin, ymax, ylColumnNumber, yuColumnNumber, barSize_mm, garnish);
7547 GRAPHICS_EACH_END
7548 }
7549
7550 FORM (CONVERT_EACH_TO_ONE__Table_extractRowsWhere, U"Table: Extract rows where", nullptr) {
7551 COMMENT (U"Extract rows where the following condition holds.")
7552 FORMULA (condition, U"Condition", U"1; self$[\"gender\"]=\"male\"")
7553 OK
7554 DO
7555 CONVERT_EACH_TO_ONE (Table)
7556 autoTable result = Table_extractRowsWhere (me, condition, interpreter);
7557 CONVERT_EACH_TO_ONE_END (my name.get(), U"_formula")
7558 }
7559
7560 // deprecated 2023
7561 FORM (CONVERT_EACH_TO_ONE__Table_extractRowsMahalanobisWhere, U"Table: Extract rows where (mahalanobis)", nullptr) {
7562 STRINGARRAY_LINES (2, dataColumnNames, U"Extract all rows where columns...", { U"F1", U"F2", U"F3" })
7563 CHOICE_ENUM (kMelder_number, which,
7564 U"...have a mahalanobis distance...", kMelder_number::GREATER_THAN)
7565 REAL (numberOfSigmas, U"...the number", U"2.0")
7566 SENTENCE (factorColumnName, U"Factor column", U"")
7567 COMMENT (U"Process only rows where the following condition holds.")
7568 FORMULA (condition, U"Condition", U"1; self$[\"gender\"]=\"male\"")
7569 OK
7570 DO
7571 CONVERT_EACH_TO_ONE (Table)
7572 autoINTVEC columnNumbers = Table_columnNamesToNumbers (me, dataColumnNames);
7573 const integer factorColumnNumber = Table_columnNameToNumber_0 (me, factorColumnName);
7574 autoTable thee = Table_extractRowsWhere_e (me, condition, interpreter);
7575 autoTable result = Table_extractMahalanobis (thee.get(), columnNumbers.get(), which, numberOfSigmas, factorColumnNumber);
7576 CONVERT_EACH_TO_ONE_END (my name.get(), U"_mahalanobis")
7577 }
7578
7579 FORM (CONVERT_EACH_TO_ONE__Table_extractRowsWhereMahalanobis, U"Table: Extract rows where (mahalanobis)", nullptr) {
7580 STRINGARRAY_LINES (2, dataColumnNames, U"Extract all rows where columns...", { U"F1", U"F2", U"F3" })
7581 CHOICE_ENUM (kMelder_number, which,
7582 U"...have a mahalanobis distance...", kMelder_number::GREATER_THAN)
7583 REAL (numberOfSigmas, U"...the number", U"2.0")
7584 SENTENCE (factorColumnName, U"Factor column", U"")
7585 OK
7586 DO_ALTERNATIVE (CONVERT_EACH_TO_ONE__Table_extractRowsMahalanobisWhere)
7587 CONVERT_EACH_TO_ONE (Table)
7588 autoINTVEC columnNumbers = Table_columnNamesToNumbers (me, dataColumnNames);
7589 const integer factorColumnNumber = Table_columnNameToNumber_0 (me, factorColumnName);
7590 autoTable result = Table_extractMahalanobis (me, columnNumbers.get(), which, numberOfSigmas, factorColumnNumber);
7591 CONVERT_EACH_TO_ONE_END (my name.get(), U"_mahalanobis")
7592 }
7593
7594 FORM (CONVERT_EACH_TO_ONE__Table_extractColumnsByNumber, U"Table: Extract columns by number", nullptr) {
7595 COMMENT (U"Create a new Table from the columns with the following numbers.")
7596 NATURALVECTOR (columnNumbers, U"Column numbers", RANGES_, U"1 2")
7597 OK
7598 DO
7599 CONVERT_EACH_TO_ONE (Table)
7600 autoTable result = Table_extractColumnsByNumber (me, columnNumbers);
7601 CONVERT_EACH_TO_ONE_END (my name.get(), U"_columns")
7602 }
7603
7604 FORM (QUERY_ONE_FOR_REAL_VECTOR__Table_listRowNumbersWhere, U"Table: List rows where", U"") {
7605 COMMENT (U"List rows where the following condition holds true.")
7606 FORMULA (condition, U"Condition", U"self [row, \"F1\"] > 800.0")
7607 OK
7608 DO
7609 QUERY_ONE_FOR_REAL_VECTOR (Table)
7610 autoVEC result = cast_VEC (Table_listRowNumbersWhere (me, condition, interpreter).get());
7611 QUERY_ONE_FOR_REAL_VECTOR_END
7612 }
7613
7614 /******************* TableOfReal ****************************/
7615
7616 DIRECT (CREATE_ONE__CreateIrisDataset) {
7617 CREATE_ONE
7618 autoTableOfReal result = TableOfReal_createIrisDataset ();
7619 CREATE_ONE_END (U"iris")
7620 }
7621
7622 FORM (INFO_ONE__TableOfReal_reportMultivariateNormality, U"TableOfReal: Report multivariate normality (BHEP)", U"TableOfReal: Report multivariate normality (BHEP)...") {
7623 REAL (smoothing, U"Smoothing parameter", U"0.0")
7624 OK
7625 DO
7626 INFO_ONE (TableOfReal)
7627 bool singular;
7628 double tnb, lnmu, lnvar;
7629 const double prob = TableOfReal_normalityTest_BHEP (me, & smoothing, & tnb, & lnmu, & lnvar, & singular);
7630 MelderInfo_open ();
7631 MelderInfo_writeLine (U"Baringhaus–Henze–Epps–Pulley normality test:");
7632 MelderInfo_writeLine (U"Significance of normality: ", prob);
7633 MelderInfo_writeLine (U"BHEP statistic: ", tnb);
7634 MelderInfo_writeLine (U"Lognormal mean: ", lnmu);
7635 MelderInfo_writeLine (U"Lognormal variance: ", lnvar);
7636 MelderInfo_writeLine (U"Smoothing: ", smoothing);
7637 MelderInfo_writeLine (U"Sample size: ", my numberOfRows);
7638 MelderInfo_writeLine (U"Number of variables: ", my numberOfColumns);
7639 if (singular)
7640 MelderInfo_writeLine (U"(Attention: the covariance matrix was singular!)");
7641 MelderInfo_close ();
7642 INFO_ONE_END
7643 }
7644
7645 FORM (INFO_ONE__TableOfReal_reportSphericityOfCovariance, U"TableOfReal: Report covariance sphericity", nullptr) {
7646 NATURAL (numberOfPermutations, U"Number of permutations", U"100");
7647 BOOLEAN (useCorrelation, U"Use correlation instead", false);
7648 OK
7649 DO
7650 INFO_ONE (TableOfReal)
7651 const double p = TableOfReal_testSphericityOfCovariance (me, numberOfPermutations, useCorrelation);
7652 MelderInfo_open ();
7653 MelderInfo_writeLine (p, U" (probability from ", numberOfPermutations, U" permutations).");
7654 MelderInfo_close ();
7655 INFO_ONE_END
7656 }
7657
7658 FORM (INFO_ONE__TableOfReal_reportCompoundSymmetryOfCovariance, U"TableOfReal: Report covariance compound symmetry", nullptr) {
7659 NATURAL (numberOfPermutations, U"Number of permutations", U"100");
7660 BOOLEAN (useCorrelation, U"Use correlation instead", false);
7661 OK
7662 DO
7663 INFO_ONE (TableOfReal)
7664 const double p = TableOfReal_testCovarianceCompoundSymmetry (me, numberOfPermutations, useCorrelation);
7665 MelderInfo_open ();
7666 MelderInfo_writeLine (p, U" (probability from ", numberOfPermutations, U" permutations).");
7667 MelderInfo_close ();
7668 INFO_ONE_END
7669 }
7670
7671 FORM (INFO_ONE__TableOfReal_reportCovarianceIdentity, U"", nullptr) {
7672 NATURAL (numberOfPermutations, U"Number of permutations", U"100");
7673 BOOLEAN (useCorrelation, U"Use correlation instead", false);
7674 OK
7675 DO
7676 INFO_ONE (TableOfReal)
7677 const double p = TableOfReal_testCovarianceEqualsIdentityMatrix (me, numberOfPermutations, useCorrelation);
7678 MelderInfo_open ();
7679 MelderInfo_writeLine (p, U" (probability from ", numberOfPermutations, U" permutations).");
7680 MelderInfo_close ();
7681 INFO_ONE_END
7682 }
7683
7684 FORM (INFO_TWO__TableOfReal_reportEqualityOfCovariances, U"TableOfReal: Report equality of covariances", nullptr) {
7685 NATURAL (numberOfPermutations, U"Number of permutations", U"100");
7686 BOOLEAN (useCorrelation, U"Use correlation instead", false);
7687 OK
7688 DO
7689 INFO_TWO (TableOfReal)
7690 const double p = TableOfReal_testEqualityOfCovariances (me, you, numberOfPermutations, useCorrelation);
7691 MelderInfo_open ();
7692 MelderInfo_writeLine (p, U" (probability from ", numberOfPermutations, U" permutations).");
7693 MelderInfo_close ();
7694 INFO_ONE_END
7695 }
7696
7697 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__TableOfReal_Permutation_permuteRows) {
7698 CONVERT_ONE_AND_ONE_TO_ONE (TableOfReal, Permutation)
7699 autoTableOfReal result = TableOfReal_Permutation_permuteRows (me, you);
7700 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
7701 }
7702
7703 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__TableOfReal_Permutation_permuteColumns) {
7704 CONVERT_ONE_AND_ONE_TO_ONE (TableOfReal, Permutation)
7705 autoTableOfReal result = TableOfReal_Permutation_permuteColumns (me, you);
7706 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
7707 }
7708
7709 DIRECT (CONVERT_EACH_TO_ONE__TableOfReal_to_Permutation_sortRowlabels) {
7710 CONVERT_EACH_TO_ONE (TableOfReal)
7711 autoPermutation result = TableOfReal_to_Permutation_sortRowLabels (me);
7712 CONVERT_EACH_TO_ONE_END (my name.get())
7713 }
7714
7715 DIRECT (COMBINE_ALL_LISTED_TO_ONE__TableOfReal_appendColumns) {
7716 COMBINE_ALL_LISTED_TO_ONE (TableOfReal, TableOfRealList)
7717 autoTableOfReal result = TableOfRealList_appendColumnsMany (list.get());
7718 COMBINE_ALL_LISTED_TO_ONE_END (U"columns_appended");
7719 }
7720
7721 FORM (CREATE_ONE__TableOfReal_create_pols1973, U"Create TableOfReal (Pols 1973)", U"Create TableOfReal (Pols 1973)...") {
7722 BOOLEAN (includeFormantAmplitudeLevels, U"Include formant levels", false)
7723 OK
7724 DO
7725 CREATE_ONE
7726 autoTableOfReal result = TableOfReal_create_pols1973 (includeFormantAmplitudeLevels);
7727 CREATE_ONE_END (U"pols1973")
7728 }
7729
7730 DIRECT (CREATE_ONE__Table_create_keatingEsposito2006) {
7731 CREATE_ONE
7732 autoTable result = Table_create_keatingEsposito2006 ();
7733 CREATE_ONE_END (U"keatingEsposito2006")
7734 }
7735
7736 DIRECT (CREATE_ONE__Table_create_ganong1980) {
7737 CREATE_ONE
7738 autoTable result = Table_create_ganong1980 ();
7739 CREATE_ONE_END (U"ganong")
7740 }
7741
7742 FORM (CREATE_ONE__TableOfReal_create_vanNierop1973, U"Create TableOfReal (Van Nierop 1973)...", U"Create TableOfReal (Van Nierop 1973)...") {
7743 BOOLEAN (includeFormantAmplitudeLevels, U"Include formant levels", false)
7744 OK
7745 DO
7746 CREATE_ONE
7747 autoTableOfReal result = TableOfReal_create_vanNierop1973 (includeFormantAmplitudeLevels);
7748 CREATE_ONE_END (U"vanNierop1973")
7749 }
7750
7751 FORM (CREATE_ONE__TableOfReal_create_weenink1983, U"Create TableOfReal (Weenink 1985)...", U"Create TableOfReal (Weenink 1985)...") {
7752 CHOICE (speakerGroup, U"Speakers group", 1)
7753 OPTION (U"men")
7754 OPTION (U"women")
7755 OPTION (U"children")
7756 OK
7757 DO
7758 CREATE_ONE
7759 autoTableOfReal result = TableOfReal_create_weenink1983 (speakerGroup);
7760 CREATE_ONE_END ((speakerGroup == 1 ? U"m10" : speakerGroup == 2 ? U"w10" : U"c10"));
7761 }
7762
7763 DIRECT (CREATE_ONE__Table_create_sandwell1987) {
7764 CREATE_ONE
7765 autoTableOfReal result = TableOfReal_create_sandwell1987 ();
7766 CREATE_ONE_END (U"Sandwell1987");
7767 }
7768
7769 FORM (GRAPHICS_EACH__TableOfReal_drawAsScalableSquares, U"TableOfReal: Draw as scalable squares", U"TableOfReal: Draw as scalable squares...") {
7770 NATURAL (rowmin, U"From row", U"1");
7771 INTEGER (rowmax, U"To row", U"0 (= all)");
7772 NATURAL (colmin, U"From column", U"1");
7773 INTEGER (colmax, U"To column", U"0 (= all)");
7774 OPTIONMENU_ENUM (kGraphicsMatrixOrigin, origin,
7775 U"Origin", kGraphicsMatrixOrigin::DEFAULT)
7776 POSITIVE (scaleFactor, U"Cell area scale factor", U"0.95")
7777 OPTIONMENU_ENUM (kGraphicsMatrixCellDrawingOrder, drawingOrder,
7778 U"Filling order", kGraphicsMatrixCellDrawingOrder::DEFAULT)
7779 BOOLEAN (garnish, U"Garnish", true)
7780 OK
7781 DO
7782 GRAPHICS_EACH (TableOfReal)
7783 TableOfReal_drawAsScalableSquares (me, GRAPHICS, rowmin, rowmax, colmin, colmax,
7784 origin, scaleFactor, drawingOrder, garnish
7785 );
7786 GRAPHICS_EACH_END
7787 }
7788
7789 FORM (GRAPHICS_EACH__TableOfReal_drawScatterPlot, U"TableOfReal: Draw scatter plot", U"TableOfReal: Draw scatter plot...") {
7790 COMMENT (U"Select the part of the table")
7791 NATURAL (xColumn, U"Horizontal axis column number", U"1")
7792 NATURAL (yColumn, U"Vertical axis column number", U"2")
7793 INTEGER (fromRow, U"left Row number range", U"0")
7794 INTEGER (toRow, U"right Row number range", U"0")
7795 COMMENT (U"Select the drawing area limits")
7796 REAL (xmin, U"left Horizontal range", U"0.0")
7797 REAL (xmax, U"right Horizontal range", U"0.0")
7798 REAL (ymin, U"left Vertical range", U"0.0")
7799 REAL (ymax, U"right Vertical range", U"0.0")
7800 NATURAL (labelSize, U"Label size", U"12")
7801 BOOLEAN (useRowLabels, U"Use row labels", false)
7802 WORD (label, U"Label", U"+")
7803 BOOLEAN (garnish, U"Garnish", true)
7804 OK
7805 DO
7806 GRAPHICS_EACH (TableOfReal)
7807 TableOfReal_drawScatterPlot (me, GRAPHICS, xColumn, yColumn, fromRow, toRow, xmin, xmax,
7808 ymin, ymax, labelSize, useRowLabels, label, garnish
7809 );
7810 GRAPHICS_EACH_END
7811 }
7812
7813 FORM (GRAPHICS_EACH__TableOfReal_drawScatterPlotMatrix, U"TableOfReal: Draw scatter plots matrix", nullptr) {
7814 INTEGER (fromColumn, U"From column", U"0")
7815 INTEGER (toColumn, U"To column", U"0")
7816 POSITIVE (fractionWhite, U"Fraction white", U"0.1")
7817 OK
7818 DO
7819 GRAPHICS_EACH (TableOfReal)
7820 TableOfReal_drawScatterPlotMatrix (me, GRAPHICS, fromColumn, toColumn, fractionWhite);
7821 GRAPHICS_EACH_END
7822 }
7823
7824 FORM (GRAPHICS_EACH__TableOfReal_drawBiplot, U"TableOfReal: Draw biplot", U"TableOfReal: Draw biplot...") {
7825 COMMENT (U"")
7826 REAL (xmin, U"left Horizontal range", U"0.0")
7827 REAL (xmax, U"right Horizontal range", U"0.0")
7828 REAL (ymin, U"left Vertical range", U"0.0")
7829 REAL (ymax, U"right Vertical range", U"0.0")
7830 REAL (splitFactor, U"Split factor", U"0.5")
7831 INTEGER (labelSize, U"Label size", U"10")
7832 BOOLEAN (garnish, U"Garnish", true)
7833 OK
7834 DO
7835 GRAPHICS_EACH (TableOfReal)
7836 TableOfReal_drawBiplot (me, GRAPHICS, xmin, xmax, ymin, ymax, splitFactor, labelSize, garnish);
7837 GRAPHICS_EACH_END
7838 }
7839
7840 FORM (GRAPHICS_EACH__TableOfReal_drawVectors, U"Draw vectors", U"TableOfReal: Draw vectors...") {
7841 COMMENT (U"From (x1, y1) to (x2, y2)")
7842 NATURAL (x1Column, U"X1 column", U"1")
7843 NATURAL (y1Column, U"Y1 column", U"2")
7844 NATURAL (x2Column, U"X2 column", U"3")
7845 NATURAL (y2Column, U"Y2 column", U"4")
7846 COMMENT (U"Select the drawing area")
7847 REAL (xmin, U"left Horizontal range", U"0.0")
7848 REAL (xmax, U"right Horizontal range", U"0.0")
7849 REAL (ymin, U"left Vertical range", U"0.0")
7850 REAL (ymax, U"right Vertical range", U"0.0")
7851 CHOICE (vectorType, U"Vector type", 1)
7852 OPTION (U"arrow")
7853 OPTION (U"double arrow")
7854 OPTION (U"line")
7855 INTEGER (labelSize, U"Label size", U"10")
7856 BOOLEAN (garnish, U"Garnish", true)
7857 OK
7858 DO
7859 GRAPHICS_EACH (TableOfReal)
7860 TableOfReal_drawVectors (me, GRAPHICS, x1Column, y1Column, x2Column, y2Column, xmin, xmax,
7861 ymin, ymax, vectorType, labelSize, garnish
7862 );
7863 GRAPHICS_EACH_END
7864 }
7865
7866 FORM (GRAPHICS_EACH__TableOfReal_drawRowAsHistogram, U"Draw row as histogram", U"TableOfReal: Draw rows as histogram...") {
7867 COMMENT (U"Select from the table")
7868 NATURAL (rowNumber, U"Row number", U"1")
7869 INTEGER (fromColumn, U"left Column range", U"0")
7870 INTEGER (toColumn, U"right Column range", U"0")
7871 COMMENT (U"Vertical drawing range")
7872 REAL (ymin, U"left Vertical range", U"0.0")
7873 REAL (ymax, U"right Vertical range", U"0.0")
7874 COMMENT (U"Offset and distance in units of 'bar width'")
7875 REAL (xOffset, U"Horizontal offset", U"0.5")
7876 REAL (distanceBetweenBars, U"Distance between bars", U"1.0")
7877 REAL (greyValue, U"Grey value (1.0=white)", U"0.7")
7878 BOOLEAN (garnish, U"Garnish", true)
7879 OK
7880 DO
7881 GRAPHICS_EACH (TableOfReal)
7882 TableOfReal_drawRowsAsHistogram (me, GRAPHICS, autoINTVEC ({ rowNumber }).get(), fromColumn, toColumn, ymin, ymax,
7883 xOffset, 0, distanceBetweenBars, autoVEC ({ greyValue }).get(), garnish
7884 );
7885 GRAPHICS_EACH_END
7886 }
7887
7888 FORM (GRAPHICS_EACH__TableOfReal_drawRowsAsHistogram, U"Draw rows as histogram", U"TableOfReal: Draw rows as histogram...") {
7889 COMMENT (U"Select from the table")
7890 NATURALVECTOR (rowNumbers, U"Row numbers", WHITESPACE_SEPARATED_, U"1 2")
7891 INTEGER (fromColumn, U"left Column range", U"0 (= all)")
7892 INTEGER (toColumn, U"right Column range", U"0 (= all)")
7893 COMMENT (U"Vertical drawing range")
7894 REAL (ymin, U"left Vertical range", U"0.0")
7895 REAL (ymax, U"right Vertical range", U"0.0")
7896 COMMENT (U"Offset and distance in units of 'bar width'")
7897 REAL (xOffset, U"Horizontal offset", U"1.0")
7898 REAL (distanceBetweenBarGroups, U"Distance between bar groups", U"1.0")
7899 REAL (distanceBetweenBars, U"Distance between bars", U"0.0")
7900 REALVECTOR (greys, U"Grey values (1.0=white)", WHITESPACE_SEPARATED_, U"1.0 1.0")
7901 BOOLEAN (garnish, U"Garnish", true)
7902 OK
7903 DO
7904 GRAPHICS_EACH (TableOfReal)
7905 TableOfReal_drawRowsAsHistogram (me, GRAPHICS, rowNumbers, fromColumn, toColumn, ymin, ymax,
7906 xOffset, distanceBetweenBars, distanceBetweenBarGroups, greys, garnish
7907 );
7908 GRAPHICS_EACH_END
7909 }
7910
7911 FORM (GRAPHICS_EACH__TableOfReal_drawBoxPlots, U"TableOfReal: Draw box plots", U"TableOfReal: Draw box plots...") {
7912 INTEGER (fromRow, U"From row", U"0")
7913 INTEGER (toRow, U"To row", U"0")
7914 INTEGER (fromColumn, U"From column", U"0")
7915 INTEGER (toColumn, U"To column", U"0")
7916 REAL (ymin, U"left Vertical range", U"0.0")
7917 REAL (ymax, U"right Vertical range", U"0.0")
7918 BOOLEAN (garnish, U"Garnish", true)
7919 OK
7920 DO
7921 GRAPHICS_EACH (TableOfReal)
7922 TableOfReal_drawBoxPlots (me, GRAPHICS, fromRow, toRow, fromColumn, toColumn, ymin, ymax, garnish);
7923 GRAPHICS_EACH_END
7924 }
7925
7926 FORM (GRAPHICS_EACH__TableOfReal_drawColumnAsDistribution, U"TableOfReal: Draw column as distribution", U"TableOfReal: Draw column as distribution...") {
7927 NATURAL (columnNumber, U"Column number", U"1")
7928 REAL (fromValue, U"left Value range", U"0.0")
7929 REAL (toValue, U"right Value range", U"0.0")
7930 REAL (fromFrequency, U"left Frequency range", U"0.0")
7931 REAL (toFrequency, U"right frequency range", U"0.0")
7932 NATURAL (numberOfBins, U"Number of bins", U"10")
7933 BOOLEAN (garnish, U"Garnish", true)
7934 OK
7935 DO
7936 GRAPHICS_EACH (TableOfReal)
7937 TableOfReal_drawColumnAsDistribution (me, GRAPHICS, columnNumber, fromValue, toValue, numberOfBins,
7938 fromFrequency, toFrequency, false, garnish
7939 );
7940 GRAPHICS_EACH_END
7941 }
7942
7943 FORM (CONVERT_EACH_TO_ONE__TableOfReal_to_Configuration_lda, U"TableOfReal: To Configuration (lda)", U"TableOfReal: To Configuration (lda)...") {
7944 INTEGER (numberOfDimensions, U"Number of dimensions", U"0 (= all)")
7945 OK
7946 DO
7947 Melder_require (numberOfDimensions >= 0,
7948 U"The number of dimensions should be at least zero.");
7949 CONVERT_EACH_TO_ONE (TableOfReal)
7950 autoConfiguration result = TableOfReal_to_Configuration_lda (me, numberOfDimensions);
7951 CONVERT_EACH_TO_ONE_END (my name.get(), U"_lda")
7952 }
7953
7954 FORM (CONVERT_EACH_TO_ONE__TableOfReal_to_CCA, U"TableOfReal: To CCA", U"TableOfReal: To CCA...") {
7955 NATURAL (dimensionOfDependentVariate, U"Dimension of dependent variate", U"2")
7956 OK
7957 DO
7958 CONVERT_EACH_TO_ONE (TableOfReal)
7959 autoCCA result = TableOfReal_to_CCA (me, dimensionOfDependentVariate);
7960 CONVERT_EACH_TO_ONE_END (my name.get())
7961 }
7962
7963 FORM (CONVERT_EACH_TO_ONE__TableOfReal_to_Configuration_pca, U"TableOfReal: To Configuration (pca)", U"TableOfReal: To Configuration (pca)...") {
7964 NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
7965 OK
7966 DO
7967 CONVERT_EACH_TO_ONE (TableOfReal)
7968 autoConfiguration result = TableOfReal_to_Configuration_pca (me, numberOfDimensions);
7969 CONVERT_EACH_TO_ONE_END (my name.get(), U"_pca")
7970 }
7971
7972 DIRECT (CONVERT_EACH_TO_ONE__TableOfReal_to_Discriminant) {
7973 CONVERT_EACH_TO_ONE (TableOfReal)
7974 autoDiscriminant result = TableOfReal_to_Discriminant (me);
7975 CONVERT_EACH_TO_ONE_END (my name.get())
7976 }
7977
7978 DIRECT (CONVERT_EACH_TO_ONE__TableOfReal_to_PCA_byRows) {
7979 CONVERT_EACH_TO_ONE (TableOfReal)
7980 autoPCA result = TableOfReal_to_PCA_byRows (me);
7981 CONVERT_EACH_TO_ONE_END (my name.get())
7982 }
7983
7984 FORM (CONVERT_EACH_TO_ONE__TableOfReal_to_SSCP, U"TableOfReal: To SSCP", U"TableOfReal: To SSCP...") {
7985 INTEGER (fromRow, U"Begin row", U"0")
7986 INTEGER (toRow, U"End row", U"0")
7987 INTEGER (fromColumn, U"Begin column", U"0")
7988 INTEGER (toColumn, U"End column", U"0")
7989 OK
7990 DO
7991 CONVERT_EACH_TO_ONE (TableOfReal)
7992 autoSSCP result = TableOfReal_to_SSCP (me, fromRow, toRow, fromColumn, toColumn);
7993 CONVERT_EACH_TO_ONE_END (my name.get())
7994 }
7995
7996 FORM (CONVERT_EACH_TO_ONE__TableOfReal_to_SSCP_rowWeights, U"TableOfReal: To SSCP (row weights)", U"TableOfReal: To SSCP (row weights)...") {
7997 INTEGER (fromRow, U"Begin row", U"0")
7998 INTEGER (toRow, U"End row", U"0")
7999 INTEGER (fromColumn, U"Begin column", U"0")
8000 INTEGER (toColumn, U"End column", U"0")
8001 INTEGER (rowWeights, U"Weights column number", U"0")
8002 OK
8003 DO
8004 CONVERT_EACH_TO_ONE (TableOfReal)
8005 autoSSCP result = TableOfReal_to_SSCP_rowWeights (me, fromRow, toRow, fromColumn, toColumn, rowWeights);
8006 CONVERT_EACH_TO_ONE_END (my name.get())
8007 }
8008
8009 /* For the inheritors */
8010 DIRECT (CONVERT_EACH_TO_ONE__TableOfReal_to_TableOfReal) {
8011 CONVERT_EACH_TO_ONE (TableOfReal)
8012 autoTableOfReal result = TableOfReal_to_TableOfReal (me);
8013 CONVERT_EACH_TO_ONE_END (my name.get())
8014 }
8015
8016 DIRECT (CONVERT_EACH_TO_ONE__TableOfReal_to_Correlation) {
8017 CONVERT_EACH_TO_ONE (TableOfReal)
8018 autoCorrelation result = TableOfReal_to_Correlation (me);
8019 CONVERT_EACH_TO_ONE_END (my name.get())
8020 }
8021
8022 DIRECT (CONVERT_EACH_TO_ONE__TableOfReal_to_Correlation_rank) {
8023 CONVERT_EACH_TO_ONE (TableOfReal)
8024 autoCorrelation result = TableOfReal_to_Correlation_rank (me);
8025 CONVERT_EACH_TO_ONE_END (my name.get())
8026 }
8027
8028 DIRECT (CONVERT_EACH_TO_ONE__TableOfReal_to_Covariance) {
8029 CONVERT_EACH_TO_ONE (TableOfReal)
8030 autoCovariance result = TableOfReal_to_Covariance (me);
8031 CONVERT_EACH_TO_ONE_END (my name.get())
8032 }
8033
8034 DIRECT (CONVERT_EACH_TO_ONE__TableOfReal_to_SVD) {
8035 CONVERT_EACH_TO_ONE (TableOfReal)
8036 autoSVD result = TableOfReal_to_SVD (me);
8037 CONVERT_EACH_TO_ONE_END (my name.get())
8038 }
8039
8040 DIRECT (CONVERT_TWO_TO_ONE__TablesOfReal_to_Eigen_gsvd) {
8041 CONVERT_TWO_TO_ONE (TableOfReal)
8042 autoEigen result = TablesOfReal_to_Eigen_gsvd (me, you);
8043 CONVERT_TWO_TO_ONE_END (U"gsvd");
8044 }
8045
8046 FORM (CONVERT_TWO_TO_ONE__TableOfReal_TableOfReal_crossCorrelations, U"TableOfReal & TableOfReal: Cross-correlations", nullptr) {
8047 OPTIONMENU (between, U"Correlations between", 1)
8048 OPTION (U"rows")
8049 OPTION (U"columns")
8050 BOOLEAN (center, U"Center", false)
8051 BOOLEAN (normalize, U"Normalize", false)
8052 OK
8053 DO
8054 const bool by_columns = ( between == 2 );
8055 CONVERT_TWO_TO_ONE (TableOfReal)
8056 autoTableOfReal result = TableOfReal_TableOfReal_crossCorrelations (me, you, by_columns, center, normalize);
8057 CONVERT_TWO_TO_ONE_END (U"cc_", by_columns ? U"by_cols" : U"by_rows")
8058 }
8059
8060 void praat_TableOfReal_init3 (ClassInfo klas);
8061 void praat_TableOfReal_init3 (ClassInfo klas) {
8062 praat_TableOfReal_init (klas);
8063 praat_addAction1 (klas, 2, U"To TableOfReal (cross-correlations)...", 0, 0,
8064 CONVERT_TWO_TO_ONE__TableOfReal_TableOfReal_crossCorrelations);
8065 }
8066
8067 DIRECT (CONVERT_TWO_TO_ONE__TablesOfReal_to_GSVD) {
8068 CONVERT_TWO_TO_ONE (TableOfReal)
8069 autoGSVD result = TablesOfReal_to_GSVD (me, you);
8070 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
8071 }
8072
8073 FORM (CONVERT_EACH_TO_ONE__TableOfReal_choleskyDecomposition, U"TableOfReal: Cholesky decomposition", nullptr) {
8074 BOOLEAN (wantUpper, U"Upper (else L)", false)
8075 BOOLEAN (wantInverse, U"Inverse", false)
8076 OK
8077 DO
8078 CONVERT_EACH_TO_ONE (TableOfReal)
8079 autoTableOfReal result = TableOfReal_choleskyDecomposition (me, wantUpper, wantInverse);
8080 CONVERT_EACH_TO_ONE_END (my name.get())
8081 }
8082
8083 FORM (CONVERT_EACH_TO_ONE__TableOfReal_to_PatternList_and_Categories, U"TableOfReal: To PatternList and Categories", U"TableOfReal: To PatternList and Categories...") {
8084 INTEGER (fromRow, U"left Row range", U"0")
8085 INTEGER (toRow, U"right Row range", U"0 (= all)")
8086 INTEGER (fromColumn, U"left Column range", U"0")
8087 INTEGER (toColumn, U"right Column range", U"0 (= all)")
8088 OK
8089 DO
8090 CONVERT_EACH_TO_ONE (TableOfReal)
8091 autoPatternList ap;
8092 autoCategories result;
8093 TableOfReal_to_PatternList_and_Categories (me, fromRow, toRow, fromColumn, toColumn, & ap, & result);
8094 praat_new (ap.move(), my name.get());
8095 CONVERT_EACH_TO_ONE_END (my name.get())
8096 }
8097
8098 FORM (QUERY_ONE_FOR_REAL__TableOfReal_getColumnSum, U"TableOfReal: Get column sum", U"") {
8099 INTEGER (columnNumber, U"Column", U"1")
8100 OK
8101 DO
8102 QUERY_ONE_FOR_REAL (TableOfReal)
8103 const double result = TableOfReal_getColumnSum (me, columnNumber);
8104 QUERY_ONE_FOR_REAL_END (U"(column sum)")
8105 }
8106
8107 FORM (QUERY_ONE_FOR_REAL__TableOfReal_getRowSum, U"TableOfReal: Get row sum", U"") {
8108 INTEGER (rowNumber, U"Row", U"1")
8109 OK
8110 DO
8111 QUERY_ONE_FOR_REAL (TableOfReal)
8112 const double result = TableOfReal_getRowSum (me, rowNumber);
8113 QUERY_ONE_FOR_REAL_END (U"(row sum)")
8114 }
8115
8116 DIRECT (QUERY_ONE_FOR_REAL__TableOfReal_getGrandSum) {
8117 QUERY_ONE_FOR_REAL (TableOfReal)
8118 const double result = TableOfReal_getGrandSum (me);
8119 QUERY_ONE_FOR_REAL_END (U"(grand sum)")
8120 }
8121
8122 FORM (CONVERT_EACH_TO_ONE__TableOfReal_meansByRowLabels, U"TableOfReal: Means by row labels", U"TableOfReal: To TableOfReal (means by row labels)...") {
8123 BOOLEAN (expand, U"Expand", false)
8124 OK
8125 DO
8126 CONVERT_EACH_TO_ONE (TableOfReal)
8127 autoTableOfReal result = TableOfReal_meansByRowLabels (me, expand, 0);
8128 CONVERT_EACH_TO_ONE_END (my name.get(), U"_byrowlabels")
8129 }
8130
8131 FORM (CONVERT_EACH_TO_ONE__TableOfReal_mediansByRowLabels, U"TableOfReal: Medians by row labels", U"TableOfReal: To TableOfReal (medians by row labels)...") {
8132 BOOLEAN (expand, U"Expand", false)
8133 OK
8134 DO
8135 CONVERT_EACH_TO_ONE (TableOfReal)
8136 autoTableOfReal result = TableOfReal_meansByRowLabels (me, expand, 1);
8137 CONVERT_EACH_TO_ONE_END (my name.get(), U"_byrowlabels")
8138 }
8139
8140 FORM (CONVERT_EACH_TO_ONE__TableOfReal_to_TableOfReal_rankColumns, U"TableOfReal: Rank columns", U"TableOfReal: To TableOfReal (rank columns)...") {
8141 INTEGER (fromColumn, U"left Column range", U"0")
8142 INTEGER (toColumn, U"right Column range", U"0 (=all)")
8143 OK
8144 DO
8145 CONVERT_EACH_TO_ONE (TableOfReal)
8146 autoTableOfReal result = TableOfReal_rankColumns (me, fromColumn, toColumn);
8147 CONVERT_EACH_TO_ONE_END (my name.get(), U"_byrowlabels")
8148 }
8149
8150 /***** TableOfReal and FilterBank *****/
8151
8152 FORM (QUERY_ONE_FOR_REAL__TextGrid_getTotalDurationOfIntervalsWhere, U"Total duration of intervals where", nullptr) {
8153 INTEGER (tierNumber, U"Tier number", U"1")
8154 OPTIONMENU_ENUM (kMelder_string, countIntervalsWhoseLabel___,
8155 U"Intervals whose label...", kMelder_string::DEFAULT)
8156 SENTENCE (___theText, U"...the text", U"hi")
8157 OK
8158 DO
8159 QUERY_ONE_FOR_REAL (TextGrid)
8160 const double result = TextGrid_getTotalDurationOfIntervalsWhere (me, tierNumber, countIntervalsWhoseLabel___, ___theText);
8161 QUERY_ONE_FOR_REAL_END (U" s (duration of intervals containing \"", ___theText, U"\")");
8162 }
8163
8164 FORM (MODIFY_TextGrid_extendTime, U"TextGrid: Extend time", U"TextGrid: Extend time...") {
8165 POSITIVE (extendDomainBy, U"Extend domain by (s)", U"1.0")
8166 CHOICE (position, U"At", 1)
8167 OPTION (U"end")
8168 OPTION (U"start")
8169 OK
8170 DO
8171 MODIFY_EACH (TextGrid)
8172 TextGrid_extendTime (me, extendDomainBy, position - 1);
8173 MODIFY_EACH_END
8174 }
8175
8176 FORM (MODIFY_TextGrid_replaceIntervalTexts, U"TextGrid: Replace interval texts", U"TextGrid: Replace interval texts...") {
8177 NATURAL (tierNumber, U"Tier number", U"1")
8178 INTEGER (fromInterval, U"left Interval range", U"1")
8179 INTEGER (toInterval, U"right Interval range", U"0 (= all)")
8180 SENTENCE (search_string, U"Search", U"a")
8181 SENTENCE (replace_string, U"Replace", U"b")
8182 CHOICE (searchType, U"Search and replace strings are", 1)
8183 OPTION (U"literals")
8184 OPTION (U"Regular Expressions")
8185 OK
8186 DO
8187 MODIFY_EACH (TextGrid)
8188 integer nmatches, nstringmatches;
8189 TextGrid_changeLabels (me, tierNumber, fromInterval, toInterval, search_string, replace_string,
8190 searchType - 1, &nmatches, &nstringmatches
8191 );
8192 MODIFY_EACH_END
8193 }
8194
8195 FORM (MODIFY_TextGrid_replacePointTexts, U"TextGrid: Replace point texts", U"TextGrid: Replace point texts...") {
8196 NATURAL (tierNumber, U"Tier number", U"1")
8197 INTEGER (fromInterval, U"left Interval range", U"1")
8198 INTEGER (toInterval, U"right Interval range", U"0 (= all)")
8199 SENTENCE (search_string, U"Search", U"a")
8200 SENTENCE (replace_string, U"Replace", U"b")
8201 CHOICE (searchType, U"Search and replace strings are", 1)
8202 OPTION (U"literals")
8203 OPTION (U"Regular Expressions")
8204 OK
8205 DO
8206 MODIFY_EACH (TextGrid)
8207 integer nmatches, nstringmatches;
8208 TextGrid_changeLabels (me, tierNumber, fromInterval, toInterval, search_string, replace_string,
8209 searchType - 1, &nmatches, &nstringmatches
8210 );
8211 MODIFY_EACH_END
8212 }
8213
8214 FORM (CONVERT_TWO_TO_ONE__TextGrids_to_Table_textAlignment, U"TextGrids: To Table (text alignment)", nullptr) {
8215 NATURAL (targetTierNumber, U"Target tier", U"1")
8216 NATURAL (sourceTierNumber, U"Source tier", U"1")
8217 OK
8218 DO
8219 CONVERT_TWO_TO_ONE (TextGrid)
8220 autoTable result = TextGrids_to_Table_textAlignment (me, targetTierNumber, you, sourceTierNumber, nullptr);
8221 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get());
8222 }
8223
8224 FORM (CONVERT_EACH_TO_ONE__TextGrid_to_DurationTier, U"TextGrid: To DurationTier", U"TextGrid: To DurationTier...") {
8225 NATURAL (tierNumber, U"Tier number", U"1")
8226 POSITIVE (timeScaleFactor, U"Time scale factor", U"2.0")
8227 POSITIVE (leftTransitionDuration, U"Left transition duration (s)", U"1e-10")
8228 POSITIVE (rightTransitionDuration, U"Right transition duration (s)", U"1e-10")
8229 OPTIONMENU_ENUM (kMelder_string, scaleIntervalsWhoseLabel___,
8230 U"Scale intervals whose label... ", kMelder_string::DEFAULT)
8231 SENTENCE (___theText, U"...the text", U"hi")
8232 OK
8233 DO
8234 CONVERT_EACH_TO_ONE (TextGrid)
8235 autoDurationTier result = TextGrid_to_DurationTier (me,tierNumber, timeScaleFactor,
8236 leftTransitionDuration, rightTransitionDuration, scaleIntervalsWhoseLabel___, ___theText
8237 );
8238 CONVERT_EACH_TO_ONE_END (my name.get())
8239 }
8240
8241 FORM (CONVERT_EACH_TO_ONE__TextGrid_to_TextGridNavigator_topicSearch, U"TextGrid: To TextGridNavigator (topic only)", nullptr) {
8242 NATURAL (tierNumber, U"Tier number", U"1")
8243 STRINGARRAY_LINES (4, topicLabels, U"Topic labels", { U"i", U"u", U"e", U"o", U"\\as" })
8244 OPTIONMENU_ENUM (kMelder_string, topicCriterion, U"Topic match criterion", kMelder_string::DEFAULT)
8245 OPTIONMENU_ENUM (kMatchBoolean, topicMatchBoolean, U"Combine topic matches with", kMatchBoolean::OR_)
8246 OPTIONMENU_ENUM (kMatchDomain, matchDomain, U"Match domain", kMatchDomain::DEFAULT)
8247 OK
8248 DO
8249 CONVERT_EACH_TO_ONE (TextGrid)
8250 autoTextGridNavigator result = TextGrid_to_TextGridNavigator_topicSearch (me, tierNumber,
8251 topicLabels, topicCriterion, topicMatchBoolean, matchDomain
8252 );
8253 CONVERT_EACH_TO_ONE_END (my name.get())
8254 }
8255
8256 FORM (CONVERT_EACH_TO_ONE__TextGrid_to_TextGridNavigator, U"TextGrid: To TextGridNavigator", U"TextGrid: To TextGridNavigator...") {
8257 NATURAL (tierNumber, U"Tier number", U"1")
8258 STRINGARRAY_LINES (4, topicLabels, U"Topic labels", { U"i", U"u", U"e", U"o", U"\\as" })
8259 OPTIONMENU_ENUM (kMelder_string, topicCriterion, U"Topic match criterion", kMelder_string::EQUAL_TO)
8260 OPTIONMENU_ENUM (kMatchBoolean, topicMatchBoolean, U"Combine topic matches with", kMatchBoolean::OR_)
8261 COMMENT (U"")
8262 STRINGARRAY_LINES (4, beforeLabels, U"Before labels", { U"p", U"b", U"t", U"d", U"k", U"g" })
8263 OPTIONMENU_ENUM (kMelder_string, beforeCriterion, U"Before match criterion", kMelder_string::EQUAL_TO)
8264 OPTIONMENU_ENUM (kMatchBoolean, beforeMatchBoolean, U"Combine before matches with", kMatchBoolean::OR_)
8265 COMMENT (U"")
8266 STRINGARRAY_LINES (4, afterLabels, U"After labels", { U"m", U"n" })
8267 OPTIONMENU_ENUM (kMelder_string, afterCriterion, U"After match criterion", kMelder_string::EQUAL_TO)
8268 OPTIONMENU_ENUM (kMatchBoolean, afterMatchBoolean, U"Combine after matches with", kMatchBoolean::OR_)
8269 COMMENT (U"")
8270 OPTIONMENU_ENUM (kContext_combination, combinationCriterion, U"Combination criterion", kContext_combination::BEFORE_AND_AFTER)
8271 BOOLEAN (excludeTopic, U"Exclude topic labels", false)
8272 COMMENT (U"")
8273 OPTIONMENU_ENUM (kMatchDomain, matchDomain, U"Match domain", kMatchDomain::DEFAULT)
8274 OK
8275 DO
8276 CONVERT_EACH_TO_ONE (TextGrid)
8277 autoTextGridNavigator result = TextGrid_to_TextGridNavigator (me, tierNumber,
8278 topicLabels, topicCriterion, topicMatchBoolean,
8279 beforeLabels, beforeCriterion, beforeMatchBoolean,
8280 afterLabels, afterCriterion, afterMatchBoolean,
8281 combinationCriterion, excludeTopic, matchDomain
8282 );
8283 CONVERT_EACH_TO_ONE_END (my name.get())
8284 }
8285
8286 DIRECT (CONVERT_ONE_AND_ONE_TO_ONE__TextGrid_DurationTier_to_TextGrid) {
8287 CONVERT_ONE_AND_ONE_TO_ONE (TextGrid, DurationTier)
8288 autoTextGrid result = TextGrid_DurationTier_scaleTimes (me, you);
8289 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
8290 }
8291
8292 FORM (CONVERT_TWO_AND_ONE_TO_ONE__TextGrids_EditCostsTable_to_Table_textAlignment, U"TextGrids & EditCostsTable: To Table (text alignment)", nullptr) {
8293 NATURAL (targetTierNumber, U"Target tier", U"1")
8294 NATURAL (sourceTierNumber, U"Source tier", U"1")
8295 OK
8296 DO
8297 CONVERT_TWO_AND_ONE_TO_ONE (TextGrid, EditCostsTable)
8298 autoTable result = TextGrids_to_Table_textAlignment (me, targetTierNumber, you, sourceTierNumber, him);
8299 CONVERT_TWO_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
8300 }
8301
8302
8303 DIRECT (HELP__TextGridNavigator_help) {
8304 HELP (U"TextGridNavigator")
8305 }
8306
8307 FORM (CREATE_ONE__TextGridNavigator_createSimple, U"TextGridNavigator: Create simple", U"") {
8308 WORD (name, U"Name", U"navigator")
8309 COMMENT (U"Domain")
8310 REAL (xmin, U"Xmin", U"0.0")
8311 REAL (xmax, U"Xmax", U"5.0")
8312 NATURAL (tierNumber, U"Tier number", U"1")
8313 STRINGARRAY_LINES (4, topicLabels, U"Topic labels", { U"i", U"u", U"e", U"o", U"\\as" })
8314 OK
8315 DO
8316 CREATE_ONE
8317 autoTextGridNavigator result = TextGridNavigator_createSimple (xmin, xmax, tierNumber, topicLabels);
8318 CREATE_ONE_END (name)
8319 }
8320
8321 FORM (MODIFY_EACH__TextGridNavigator_findNextAfterTime, U"TextGridNavigator: Find next after time", nullptr) {
8322 REAL (time, U"Time (s)", U"-1.0")
8323 OK
8324 DO
8325 MODIFY_EACH (TextGridNavigator)
8326 (void) TextGridNavigator_findNextAfterTime (me, time);
8327 MODIFY_EACH_END
8328 }
8329
8330 FORM (MODIFY_EACH__TextGridNavigator_findPreviousBeforeTime, U"TextGridNavigator: Find previous before time", nullptr) {
8331 REAL (time, U"Time (s)", U"10.0")
8332 OK
8333 DO
8334 MODIFY_EACH (TextGridNavigator)
8335 (void) TextGridNavigator_findPreviousBeforeTime (me, time);
8336 MODIFY_EACH_END
8337 }
8338
8339 DIRECT (MODIFY_EACH__TextGridNavigator_findFirst) {
8340 MODIFY_EACH (TextGridNavigator)
8341 (void) TextGridNavigator_findFirst (me);
8342 MODIFY_EACH_END
8343 }
8344
8345 DIRECT (MODIFY_EACH__TextGridNavigator_findLast) {
8346 MODIFY_EACH (TextGridNavigator)
8347 (void) TextGridNavigator_findLast (me);
8348 MODIFY_EACH_END
8349 }
8350
8351 DIRECT (MODIFY_EACH__TextGridNavigator_findNext) {
8352 MODIFY_EACH (TextGridNavigator)
8353 (void) TextGridNavigator_findNext (me);
8354 MODIFY_EACH_END
8355 }
8356
8357 DIRECT (MODIFY_EACH__TextGridNavigator_findPrevious) {
8358 MODIFY_EACH (TextGridNavigator)
8359 (void) TextGridNavigator_findPrevious (me);
8360 MODIFY_EACH_END
8361 }
8362
8363 FORM (QUERY_ONE_FOR_REAL__TextGridNavigator_getStartTime, U"TextGridNavigator: Get start time", nullptr) {
8364 NATURAL (tierNumber, U"Tier number", U"1")
8365 OPTIONMENU_ENUM (kContext_where, where, U"Where", kContext_where::DEFAULT)
8366 OK
8367 DO
8368 QUERY_ONE_FOR_REAL (TextGridNavigator)
8369 const double result = TextGridNavigator_getStartTime (me, tierNumber, where);
8370 QUERY_ONE_FOR_REAL_END (U" s (start time)")
8371 }
8372
8373 FORM (QUERY_ONE_FOR_REAL__TextGridNavigator_getEndTime, U"TextGridNavigator: Get end time", nullptr) {
8374 NATURAL (tierNumber, U"Tier number", U"1")
8375 OPTIONMENU_ENUM (kContext_where, where, U"Where", kContext_where::DEFAULT)
8376 OK
8377 DO
8378 QUERY_ONE_FOR_REAL (TextGridNavigator)
8379 const double result = TextGridNavigator_getEndTime (me, tierNumber, where);
8380 QUERY_ONE_FOR_REAL_END (U" s (end time)")
8381 }
8382
8383 FORM (QUERY_ONE_FOR_INTEGER__TextGridNavigator_getIndex, U"TextGridNavigator: Get index", nullptr) {
8384 NATURAL (tierNumber, U"Tier number", U"1")
8385 OPTIONMENU_ENUM (kContext_where, where, U"Where", kContext_where::DEFAULT)
8386 OK
8387 DO
8388 QUERY_ONE_FOR_INTEGER (TextGridNavigator)
8389 const integer result = TextGridNavigator_getIndex (me, tierNumber, where);
8390 QUERY_ONE_FOR_INTEGER_END (U"")
8391 }
8392
8393 FORM (QUERY_ONE_FOR_REAL_VECTOR__TextGridNavigator_listIndices, U"TextGridNavigator: List indices", nullptr) {
8394 OPTIONMENU_ENUM (kContext_where, where, U"Where", kContext_where::DEFAULT)
8395 OK
8396 DO
8397 QUERY_ONE_FOR_REAL_VECTOR (TextGridNavigator)
8398 autoINTVEC resulti = TextGridNavigator_listIndices (me, where);
8399 autoVEC result = raw_VEC (resulti.size);
8400 for (integer i = 1; i <= result.size; i++)
8401 result [i] = resulti [i];
8402 QUERY_ONE_FOR_REAL_VECTOR_END
8403 }
8404
8405 FORM (QUERY_ONE_FOR_REAL_VECTOR__TextGridNavigator_listStartTimes, U"TextGridNavigator: List start times", nullptr) {
8406 OPTIONMENU_ENUM (kContext_where, where, U"Where", kContext_where::DEFAULT)
8407 OK
8408 DO
8409 QUERY_ONE_FOR_REAL_VECTOR (TextGridNavigator)
8410 autoVEC result = TextGridNavigator_listStartTimes (me, where);
8411 QUERY_ONE_FOR_REAL_VECTOR_END
8412 }
8413
8414 FORM (QUERY_ONE_FOR_REAL_VECTOR__TextGridNavigator_listEndTimes, U"TextGridNavigator: List end times", nullptr) {
8415 OPTIONMENU_ENUM (kContext_where, where, U"Where", kContext_where::DEFAULT)
8416 OK
8417 DO
8418 QUERY_ONE_FOR_REAL_VECTOR (TextGridNavigator)
8419 autoVEC result = TextGridNavigator_listEndTimes (me, where);
8420 QUERY_ONE_FOR_REAL_VECTOR_END
8421 }
8422
8423 FORM (QUERY_ONE_FOR_STRING_ARRAY__TextGridNavigator_listLabels, U"TextGridNavigator: List labels", nullptr) {
8424 OPTIONMENU_ENUM (kContext_where, where, U"Where", kContext_where::DEFAULT)
8425 OK
8426 DO
8427 QUERY_ONE_FOR_STRING_ARRAY (TextGridNavigator)
8428 autoSTRVEC result = TextGridNavigator_listLabels (me, where);
8429 QUERY_ONE_FOR_STRING_ARRAY_END
8430 }
8431
8432 FORM (QUERY_ONE_FOR_MATRIX__TextGridNavigator_listDomains, U"", nullptr) {
8433 OPTIONMENU_ENUM (kMatchDomain, matchDomain, U"Match domain", kMatchDomain::DEFAULT)
8434 OK
8435 DO
8436 QUERY_ONE_FOR_MATRIX (TextGridNavigator)
8437 autoMAT result = TextGridNavigator_listDomains (me, matchDomain);
8438 QUERY_ONE_FOR_MATRIX_END
8439 }
8440
8441 FORM (QUERY_ONE_FOR_STRING__TextGridNavigator_getLabel, U"TextGridNavigator: Get label", nullptr) {
8442 NATURAL (tierNumber, U"Tier number", U"1")
8443 OPTIONMENU_ENUM (kContext_where, where, U"Where", kContext_where::DEFAULT)
8444 OK
8445 DO
8446 QUERY_ONE_FOR_STRING (TextGridNavigator)
8447 conststring32 result = TextGridNavigator_getLabel (me, tierNumber, where);
8448 QUERY_ONE_FOR_STRING_END
8449 }
8450
8451 DIRECT (QUERY_ONE_FOR_INTEGER__TextGridNavigator_getNumberOfMatches) {
8452 QUERY_ONE_FOR_INTEGER (TextGridNavigator)
8453 const integer result = TextGridNavigator_getNumberOfMatches (me);
8454 QUERY_ONE_FOR_INTEGER_END (U" (number of matches)")
8455 }
8456
8457 FORM (QUERY_ONE_FOR_INTEGER__TextGridNavigator_getNumberOfTopicMatches, U"TextGridNavigator: Get number of Topic only matches", nullptr) {
8458 NATURAL (tierNumber, U"Tier number", U"1")
8459 OK
8460 DO
8461 QUERY_ONE_FOR_INTEGER (TextGridNavigator)
8462 const integer result = TextGridNavigator_getNumberOfTopicMatches (me, tierNumber);
8463 QUERY_ONE_FOR_INTEGER_END (U" (number of Topic only matches in tier number ", tierNumber, U")")
8464 }
8465
8466 FORM (QUERY_ONE_FOR_INTEGER__TextGridNavigator_getNumberOfBeforeMatches, U"TextGridNavigator: Get number of Before only matches", nullptr) {
8467 NATURAL (tierNumber, U"Tier number", U"1")
8468 OK
8469 DO
8470 QUERY_ONE_FOR_INTEGER (TextGridNavigator)
8471 const integer result = TextGridNavigator_getNumberOfBeforeMatches (me, tierNumber);
8472 QUERY_ONE_FOR_INTEGER_END (U" (number of Before only matches in tier number ", tierNumber, U")")
8473 }
8474
8475 FORM (QUERY_ONE_FOR_INTEGER__TextGridNavigator_getNumberOfAfterMatches, U"TextGridNavigator: Get number of After only matches", nullptr) {
8476 NATURAL (tierNumber, U"Tier number", U"1")
8477 OK
8478 DO
8479 QUERY_ONE_FOR_INTEGER (TextGridNavigator)
8480 const integer result = TextGridNavigator_getNumberOfAfterMatches (me, tierNumber);
8481 QUERY_ONE_FOR_INTEGER_END (U" (number of After only matches in tier number ", tierNumber, U")")
8482 }
8483
8484 FORM (MODIFY_EACH__TextGridNavigator_modifyCombinationCriterion, U"TextGridNavigator: Modify combination criterion", nullptr) {
8485 NATURAL (tierNumber, U"Tier number", U"1")
8486 OPTIONMENU_ENUM (kContext_combination, combinationCriterion, U"Use criterion", kContext_combination::DEFAULT)
8487 BOOLEAN (excludeTopic, U"Exclude topic", false)
8488 OK
8489 DO
8490 MODIFY_EACH (TextGridNavigator)
8491 TextGridNavigator_modifyCombinationCriterion (me, tierNumber, combinationCriterion, excludeTopic);
8492 MODIFY_EACH_END
8493 }
8494
8495 FORM (MODIFY_EACH__TextGridNavigator_modifyTopicCriterion, U"TextGridNavigator: Modify Topic match criterion", nullptr) {
8496 NATURAL (tierNumber, U"Tier number", U"1")
8497 OPTIONMENU_ENUM (kMelder_string, topicCriterion, U"Topic match criterion", kMelder_string::DEFAULT)
8498 OPTIONMENU_ENUM (kMatchBoolean, topicMatchBoolean, U"Combine topic matches with", kMatchBoolean::OR_)
8499 OK
8500 DO
8501 MODIFY_EACH (TextGridNavigator)
8502 TextGridNavigator_modifyTopicCriterion (me, tierNumber, topicCriterion, topicMatchBoolean);
8503 MODIFY_EACH_END
8504 }
8505
8506 FORM (MODIFY_EACH__TextGridNavigator_modifyBeforeCriterion, U"TextGridNavigator: Modify Before match criterion", nullptr) {
8507 NATURAL (tierNumber, U"Tier number", U"1")
8508 OPTIONMENU_ENUM (kMelder_string, beforeCriterion, U"Before match criterion", kMelder_string::DEFAULT)
8509 OPTIONMENU_ENUM (kMatchBoolean, beforeMatchBoolean, U"Combine before matches with", kMatchBoolean::OR_)
8510 OK
8511 DO
8512 MODIFY_EACH (TextGridNavigator)
8513 TextGridNavigator_modifyBeforeCriterion (me, tierNumber, beforeCriterion, beforeMatchBoolean);
8514 MODIFY_EACH_END
8515 }
8516
8517 FORM (MODIFY_EACH__TextGridNavigator_modifyAfterCriterion, U"TextGridNavigator: Modify After match criterion", nullptr) {
8518 NATURAL (tierNumber, U"Tier number", U"1")
8519 OPTIONMENU_ENUM (kMelder_string, afterCriterion, U"After match criterion", kMelder_string::DEFAULT)
8520 OPTIONMENU_ENUM (kMatchBoolean, afterMatchBoolean, U"Combine after matches with", kMatchBoolean::OR_)
8521 OK
8522 DO
8523 MODIFY_EACH (TextGridNavigator)
8524 TextGridNavigator_modifyAfterCriterion (me, tierNumber, afterCriterion, afterMatchBoolean);
8525 MODIFY_EACH_END
8526 }
8527
8528 FORM (MODIFY_EACH__TextGridNavigator_modifyMatchDomainAlignment, U"TextGridNavigator: Modify match domain alignment", nullptr) {
8529 NATURAL (tierNumber, U"Tier number", U"1")
8530 OPTIONMENU_ENUM (kMatchDomainAlignment, matchDomainAlignment, U"Match domain alignment", kMatchDomainAlignment::DEFAULT)
8531 OK
8532 DO
8533 MODIFY_EACH (TextGridNavigator)
8534 TextGridNavigator_modifyMatchDomainAlignment (me, tierNumber, matchDomainAlignment);
8535 MODIFY_EACH_END
8536 }
8537
8538 FORM (MODIFY_EACH__TextGridNavigator_modifyMatchDomain, U"TextGridNavigator: Modify match domain", nullptr) {
8539 NATURAL (tierNumber, U"Tier number", U"1")
8540 OPTIONMENU_ENUM (kMatchDomain, matchDomain, U"Match domain", kMatchDomain::DEFAULT)
8541 OK
8542 DO
8543 MODIFY_EACH (TextGridNavigator)
8544 TextGridNavigator_modifyMatchDomain (me, tierNumber, matchDomain);
8545 MODIFY_EACH_END
8546 }
8547
8548 FORM (MODIFY_EACH__TextGridNavigator_modifyBeforeRange, U"TextGridNavigator: Modify Before range", nullptr) {
8549 NATURAL (tierNumber, U"Tier number", U"1")
8550 NATURAL (from, U"From", U"1")
8551 NATURAL (to, U"To", U"1")
8552 OK
8553 DO
8554 MODIFY_EACH (TextGridNavigator)
8555 TextGridNavigator_modifyBeforeRange (me, tierNumber, from, to);
8556 MODIFY_EACH_END
8557 }
8558
8559 FORM (MODIFY_EACH__TextGridNavigator_modifyAfterRange, U"TextGridNavigator: Modify After range", nullptr) {
8560 NATURAL (tierNumber, U"Tier number", U"1")
8561 NATURAL (from, U"From", U"1")
8562 NATURAL (to, U"To", U"1")
8563 OK
8564 DO
8565 MODIFY_EACH (TextGridNavigator)
8566 TextGridNavigator_modifyAfterRange (me, tierNumber, from, to);
8567 MODIFY_EACH_END
8568 }
8569
8570 FORM (MODIFY_FIRST_OF_ONE_AND_ONE__TextGridNavigator_replaceNavigationContext, U"TextGridNavigator: Replace NavigationContext", nullptr) {
8571 NATURAL (tierNumber, U"Tier number", U"1")
8572 OK
8573 DO
8574 MODIFY_FIRST_OF_ONE_AND_ONE (TextGridNavigator, NavigationContext)
8575 TextGridNavigator_replaceNavigationContext (me, you, tierNumber);
8576 MODIFY_FIRST_OF_ONE_AND_ONE_END
8577 }
8578
8579 FORM (MODIFY_FIRST_OF_ONE_AND_ONE__TextGridNavigator_addTextGridTierNavigator, U"TextGridNavigator: Add TextGridTierNavigator", nullptr) {
8580 OPTIONMENU_ENUM (kMatchDomainAlignment, matchDomainAlignment, U"Match domain alignment", kMatchDomainAlignment::DEFAULT)
8581 OK
8582 DO
8583 MODIFY_FIRST_OF_ONE_AND_ONE (TextGridNavigator, TextGridTierNavigator)
8584 TextGridNavigator_addTextGridTierNavigator (me, you, matchDomainAlignment);
8585 MODIFY_FIRST_OF_ONE_AND_ONE_END
8586 }
8587
8588 DIRECT (MODIFY_FIRST_OF_ONE_AND_ONE__TextGridNavigator_replaceSearchTiers) {
8589 MODIFY_FIRST_OF_ONE_AND_ONE (TextGridNavigator, TextGrid)
8590 TextGridNavigator_replaceTiers (me, you);
8591 MODIFY_FIRST_OF_ONE_AND_ONE_END
8592 }
8593
8594 FORM (MODIFY_FIRST_OF_ONE_AND_ONE__TextGridNavigator_addSearchTier_topicOnly,
8595 U"TextGridNavigator & TextGrid: Add search tier (topic only)", U"TextGridNavigator & TextGrid: Add search tier...")
8596 {
8597 NATURAL (tierNumber, U"Tier number", U"1")
8598 STRINGARRAY_LINES (4, topicLabels, U"Topic labels", { U"i", U"u", U"e", U"o", U"\\as" })
8599 OPTIONMENU_ENUM (kMelder_string, topicCriterion, U"Topic match criterion", kMelder_string::EQUAL_TO)
8600 OPTIONMENU_ENUM (kMatchBoolean, topicMatchBoolean, U"Combine topic matches with", kMatchBoolean::OR_)
8601 COMMENT (U"")
8602 OPTIONMENU_ENUM (kMatchDomain, matchDomain, U"Match domain", kMatchDomain::DEFAULT)
8603 OPTIONMENU_ENUM (kMatchDomainAlignment, matchDomainAlignment, U"Match domain alignment", kMatchDomainAlignment::DEFAULT)
8604 OK
8605 DO
8606 MODIFY_FIRST_OF_ONE_AND_ONE (TextGridNavigator, TextGrid)
8607 TextGridNavigator_and_TextGrid_addSearchTier_topicOnly (
8608 me, you, tierNumber, topicLabels, topicCriterion, topicMatchBoolean, matchDomain, matchDomainAlignment
8609 );
8610 MODIFY_FIRST_OF_ONE_AND_ONE_END
8611 }
8612
8613 FORM (MODIFY_FIRST_OF_ONE_AND_ONE__TextGridNavigator_addSearchTier, U"TextGridNavigator & TextGrid: Add search tier",
8614 U"TextGridNavigator & TextGrid: Add search tier...")
8615 {
8616 NATURAL (tierNumber, U"Tier number", U"1")
8617 STRINGARRAY_LINES (4, topicLabels, U"Topic labels", { U"i", U"u", U"e", U"o", U"\\as" })
8618 OPTIONMENU_ENUM (kMelder_string, topicCriterion, U"Topic match criterion", kMelder_string::EQUAL_TO)
8619 OPTIONMENU_ENUM (kMatchBoolean, topicMatchBoolean, U"Combine topic matches with", kMatchBoolean::OR_)
8620 COMMENT (U"")
8621 STRINGARRAY_LINES (4, beforeLabels, U"Before labels", { U"p", U"b", U"t", U"d", U"k", U"g" })
8622 OPTIONMENU_ENUM (kMelder_string, beforeCriterion, U"Before match criterion", kMelder_string::EQUAL_TO)
8623 OPTIONMENU_ENUM (kMatchBoolean, beforeMatchBoolean, U"Combine before matches with", kMatchBoolean::OR_)
8624 COMMENT (U"")
8625 STRINGARRAY_LINES (4, afterLabels, U"After labels", { U"m", U"n" })
8626 OPTIONMENU_ENUM (kMelder_string, afterCriterion, U"After match criterion", kMelder_string::EQUAL_TO)
8627 OPTIONMENU_ENUM (kMatchBoolean, afterMatchBoolean, U"Combine after matches with", kMatchBoolean::OR_)
8628 COMMENT (U"")
8629 OPTIONMENU_ENUM (kContext_combination, combinationCriterion, U"Combination criterion", kContext_combination::BEFORE_AND_AFTER)
8630 BOOLEAN (excludeTopic, U"Exclude topic labels", false)
8631 COMMENT (U"")
8632 OPTIONMENU_ENUM (kMatchDomain, matchDomain, U"Match domain", kMatchDomain::DEFAULT)
8633 OPTIONMENU_ENUM (kMatchDomainAlignment, matchDomainAlignment, U"Match domain alignment", kMatchDomainAlignment::DEFAULT)
8634 OK
8635 DO
8636 MODIFY_FIRST_OF_ONE_AND_ONE (TextGridNavigator, TextGrid)
8637 TextGridNavigator_and_TextGrid_addSearchTier (me, you, tierNumber,
8638 topicLabels, topicCriterion, topicMatchBoolean,
8639 beforeLabels, beforeCriterion, beforeMatchBoolean,
8640 afterLabels, afterCriterion, afterMatchBoolean,
8641 combinationCriterion, excludeTopic, matchDomain, matchDomainAlignment
8642 );
8643 MODIFY_FIRST_OF_ONE_AND_ONE_END
8644 }
8645
8646 DIRECT (CONVERT_EACH_TO_ONE__TextGridTierNavigator_to_TextGridNavigator) {
8647 CONVERT_EACH_TO_ONE (TextGridTierNavigator)
8648 autoTextGridNavigator result = TextGridTierNavigator_to_TextGridNavigator (me);
8649 CONVERT_EACH_TO_ONE_END (my name.get())
8650 }
8651
8652 FORM (MODIFY_EACH__TextGrid_setTierName, U"TextGrid: Set tier name", U"TextGrid: Set tier name...") {
8653 NATURAL (tierNUmber, U"Tier number", U"1")
8654 SENTENCE (name, U"Name", U"");
8655 OK
8656 DO
8657 MODIFY_EACH (TextGrid)
8658 TextGrid_setTierName (me, tierNUmber, name);
8659 MODIFY_EACH_END
8660 }
8661
8662 static void cb_publish (Editor /*editor*/, autoDaata publish) {
8663 try {
8664 praat_new (publish.move(), U"");
8665 praat_updateSelection ();
8666 } catch (MelderError) {
8667 Melder_flushError ();
8668 }
8669 }
8670
8671 DIRECT (CREATION_WINDOW__VowelEditor_create) {
8672 CREATION_WINDOW (a, VowelEditor)
8673 autoVowelEditor creationWindow = VowelEditor_create (U"VowelEditor");
8674 Editor_setPublicationCallback (creationWindow.get(), cb_publish);
8675 CREATION_WINDOW_END
8676 }
8677
8678 static autoDaata cmuAudioFileRecognizer (integer nread, const char *header, MelderFile file) {
8679 return nread < 12 || header [0] != 6 || header [1] != 0 ?
8680 autoSound () : Sound_readFromCmuAudioFile (file);
8681 }
8682
8683 static autoDaata oggFileRecognizer (integer nread, const char *header, MelderFile file) {
8684 if (nread < 27 ) // each page header is 27 bytes
8685 return autoDaata ();
8686 if (! strnequ (header, "OggS", 4)) // Capture pattern 32 bits
8687 return autoDaata ();
8688 unsigned char version = header [4];
8689 if (version != 0) // Currently mandated to be zero
8690 return autoDaata ();
8691 unsigned int headerType = header [5];
8692 if (headerType != 0x02) // Beginning of stream
8693 return autoDaata ();
8694 if (header [6] == '\0' && header [7] == '\0' && header [8] == '\0' && header [9] == '\0' &&
8695 header [10] == '\0' && header [11] == '\0' && header [12] == '\0' && header [13] == '\0' &&
8696 strnequ (& header [28], "OpusHead", 8))
8697 {
8698 return Sound_readFromOggOpusFile (file);
8699 }
8700 /*
8701 Leave rest of checking to libVorbis
8702 */
8703 return Sound_readFromOggVorbisFile (file);
8704 }
8705
8706 void praat_CC_init (ClassInfo klas) {
8707 praat_addAction1 (klas, 1, U"Paint...", nullptr, 1,
8708 GRAPHICS_EACH__CC_paint);
8709 praat_addAction1 (klas, 1, U"Draw...", nullptr, 1,
8710 GRAPHICS_EACH__CC_drawC0);
8711 praat_addAction1 (klas, 1, U"Query -", nullptr, 0, nullptr);
8712 praat_TimeFrameSampled_query_init (klas);
8713 praat_addAction1 (klas, 1, U"Get number of coefficients...", nullptr, 1,
8714 QUERY_ONE_FOR_INTEGER__CC_getNumberOfCoefficients);
8715 praat_addAction1 (klas, 1, U"Get value in frame...", nullptr, 1,
8716 QUERY_ONE_FOR_REAL__CC_getValueInFrame);
8717 praat_addAction1 (klas, 1, U"Get c0 value in frame...", nullptr, 1,
8718 QUERY_ONE_FOR_REAL__CC_getC0ValueInFrame);
8719 praat_addAction1 (klas, 1, U"Get value...", nullptr, GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
8720 QUERY_ONE_FOR_REAL__CC_getValue);
8721 praat_addAction1 (klas, 0, U"To Matrix", nullptr, 0,
8722 CONVERT_EACH_TO_ONE__CC_to_Matrix);
8723 praat_addAction1 (klas, 2, U"To DTW...", nullptr, 0,
8724 CONVERT_TWO_TO_ONE__CCs_to_DTW);
8725 }
8726
8727 static void praat_Eigen_Matrix_project (ClassInfo klase, ClassInfo klasm); // deprecated 2014
8728 static void praat_Eigen_Matrix_project (ClassInfo klase, ClassInfo klasm) {
8729 praat_addAction2 (klase, 1, klasm, 1, U"Project...", nullptr, GuiMenu_HIDDEN,
8730 CONVERT_ONE_AND_ONE_TO_ONE__Eigen_Matrix_projectColumns);
8731 praat_addAction2 (klase, 1, klasm, 1, U"To Matrix (project columns)...", nullptr, GuiMenu_HIDDEN,
8732 CONVERT_ONE_AND_ONE_TO_ONE__Eigen_Matrix_projectColumns);
8733 }
8734
8735 static void praat_Eigen_Spectrogram_project (ClassInfo klase, ClassInfo klasm);
8736 static void praat_Eigen_Spectrogram_project (ClassInfo klase, ClassInfo klasm) {
8737 praat_addAction2 (klase, 1, klasm, 1, U"Project...", nullptr, GuiMenu_HIDDEN,
8738 CONVERT_ONE_AND_ONE_TO_ONE__Eigen_Matrix_projectColumns);
8739 praat_addAction2 (klase, 1, klasm, 1, U"To Matrix (project columns)...", nullptr, 0,
8740 CONVERT_ONE_AND_ONE_TO_ONE__Eigen_Matrix_projectColumns);
8741 }
8742
8743 static void praat_Eigen_query_init (ClassInfo klas) {
8744 praat_addAction1 (klas, 1, U"Get eigenvalue...", nullptr, 1,
8745 QUERY_ONE_FOR_REAL__Eigen_getEigenvalue);
8746 praat_addAction1 (klas, 1, U"Get sum of eigenvalues...", nullptr, 1,
8747 QUERY_ONE_FOR_REAL__Eigen_getSumOfEigenvalues);
8748 praat_addAction1 (klas, 1, U"Get number of eigenvectors", nullptr, 1,
8749 QUERY_ONE_FOR_INTEGER__Eigen_getNumberOfEigenvectors);
8750 praat_addAction1 (klas, 1, U"Get eigenvector dimension", nullptr, 1,
8751 QUERY_ONE_FOR_INTEGER__Eigen_getEigenvectorDimension);
8752 praat_addAction1 (klas, 1, U"Get eigenvector element...", nullptr, 1,
8753 QUERY_ONE_FOR_REAL__Eigen_getEigenvectorElement);
8754 }
8755
8756 static void praat_Eigen_draw_init (ClassInfo klas) {
8757 praat_addAction1 (klas, 0, U"Draw eigenvalues...", nullptr, 1,
8758 GRAPHICS_EACH__Eigen_drawEigenvalues);
8759 praat_addAction1 (klas, 0, U"Draw eigenvalues (scree)...", nullptr, GuiMenu_DEPRECATED_2010 | GuiMenu_DEPTH_1,
8760 WARNING__Eigen_drawEigenvalues_scree);
8761 praat_addAction1 (klas, 0, U"Draw eigenvector...", nullptr, 1,
8762 GRAPHICS_EACH__Eigen_drawEigenvector);
8763 }
8764
8765 static void praat_FilterBank_query_init (ClassInfo klas);
8766 static void praat_FilterBank_query_init (ClassInfo klas) {
8767 praat_addAction1 (klas, 0, U"Query -", nullptr, 0, nullptr);
8768 praat_TimeFrameSampled_query_init (klas);
8769 praat_addAction1 (klas, 1, U"Get time from column...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8770 QUERY_ONE_FOR_REAL__FilterBank_getTimeFromColumn);
8771 praat_addAction1 (klas, 1, U"-- frequencies --", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1, 0);
8772 praat_addAction1 (klas, 1, U"Get lowest frequency", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8773 QUERY_ONE_FOR_REAL__FilterBank_getLowestFrequency);
8774 praat_addAction1 (klas, 1, U"Get highest frequency", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8775 QUERY_ONE_FOR_REAL__FilterBank_getHighestFrequency);
8776 praat_addAction1 (klas, 1, U"Get number of frequencies", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8777 QUERY_ONE_FOR_INTEGER__FilterBank_getNumberOfFrequencies);
8778 praat_addAction1 (klas, 1, U"Get frequency distance", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8779 QUERY_ONE_FOR_REAL__FilterBank_getFrequencyDistance);
8780 praat_addAction1 (klas, 1, U"Get frequency from row...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8781 QUERY_ONE_FOR_REAL__FilterBank_getFrequencyFromRow);
8782 praat_addAction1 (klas, 1, U"-- get value --", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1, 0);
8783 praat_addAction1 (klas, 1, U"Get value in cell...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8784 QUERY_ONE_FOR_REAL__FilterBank_getValueInCell);
8785 praat_addAction1 (klas, 0, U"-- frequency scales --", nullptr, GuiMenu_DEPTH_1, 0);
8786 praat_addAction1 (klas, 1, U"Get frequency in Hertz...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8787 QUERY_ONE_FOR_REAL__FilterBank_getFrequencyInHertz);
8788 praat_addAction1 (klas, 1, U"Get frequency in Bark...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8789 QUERY_ONE_FOR_REAL__FilterBank_getFrequencyInBark);
8790 praat_addAction1 (klas, 1, U"Get frequency in mel...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8791 QUERY_ONE_FOR_REAL__FilterBank_getFrequencyInMel);
8792 }
8793
8794 static void praat_FilterBank_modify_init (ClassInfo klas);
8795 static void praat_FilterBank_modify_init (ClassInfo klas) {
8796 // praat_addAction1 (klas, 0, U"Modify -", nullptr, 0, nullptr);
8797 praat_addAction1 (klas, 0, U"Equalize intensities...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1, MODIFY_EACH__FilterBank_equalizeIntensities);
8798 }
8799
8800 static void praat_FilterBank_draw_init (ClassInfo klas);
8801 static void praat_FilterBank_draw_init (ClassInfo klas) {
8802 // praat_addAction1 (klas, 0, U"Draw -", nullptr, 0, nullptr);
8803 praat_addAction1 (klas, 0, U"Draw filters...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8804 GRAPHICS_EACH__FilterBank_drawFilters);
8805 praat_addAction1 (klas, 0, U"Draw one contour...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8806 GRAPHICS_EACH__FilterBank_drawOneContour);
8807 praat_addAction1 (klas, 0, U"Draw contours...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8808 GRAPHICS_EACH__FilterBank_drawContours);
8809 praat_addAction1 (klas, 0, U"Paint image...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8810 GRAPHICS_EACH__FilterBank_paintImage);
8811 praat_addAction1 (klas, 0, U"Paint contours...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8812 GRAPHICS_EACH__FilterBank_paintContours);
8813 praat_addAction1 (klas, 0, U"Paint cells...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8814 GRAPHICS_EACH__FilterBank_paintCells);
8815 praat_addAction1 (klas, 0, U"Paint surface...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8816 GRAPHICS_EACH__FilterBank_paintSurface);
8817 praat_addAction1 (klas, 0, U"-- frequency scales --", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1, 0);
8818 praat_addAction1 (klas, 0, U"Draw frequency scales...", nullptr, GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
8819 GRAPHICS_EACH__FilterBank_drawFrequencyScales);
8820 }
8821
8822 static void praat_FilterBank_all_init (ClassInfo klas);
8823 static void praat_FilterBank_all_init (ClassInfo klas) {
8824 praat_FilterBank_draw_init (klas);
8825 praat_FilterBank_query_init (klas);
8826 praat_FilterBank_modify_init (klas);
8827 praat_addAction1 (klas, 0, U"To Intensity", nullptr, GuiMenu_DEPRECATED_2014,
8828 CONVERT_EACH_TO_ONE__FilterBank_to_Intensity);
8829 praat_addAction1 (klas, 0, U"To Matrix", nullptr, GuiMenu_DEPRECATED_2014,
8830 CONVERT_EACH_TO_ONE__FilterBank_to_Matrix);
8831 praat_addAction1 (klas, 2, U"Cross-correlate...", nullptr, GuiMenu_DEPRECATED_2014,
8832 CONVERT_TWO_TO_ONE__FilterBanks_crossCorrelate);
8833 praat_addAction1 (klas, 2, U"Convolve...", nullptr, GuiMenu_DEPRECATED_2014,
8834 CONVERT_TWO_TO_ONE__FilterBanks_convolve);
8835 }
8836
8837 static void praat_FunctionSeries_init (ClassInfo klas) {
8838 praat_addAction1 (klas, 0, U"Draw -", nullptr, 0, nullptr);
8839 praat_addAction1 (klas, 0, U"Draw...", nullptr, 1,
8840 GRAPHICS_EACH__FunctionSeries_draw);
8841 praat_addAction1 (klas, 0, U"Draw basis function...", nullptr, 1,
8842 GRAPHICS_EACH__FunctionSeries_drawBasisFunction);
8843 praat_addAction1 (klas, 0, U"Query -", nullptr, 0, nullptr);
8844 praat_addAction1 (klas, 1, U"Get number of coefficients", nullptr, 1,
8845 QUERY_ONE_FOR_INTEGER__FunctionSeries_getNumberOfCoefficients);
8846 praat_addAction1 (klas, 1, U"Get coefficient...", nullptr, 1,
8847 QUERY_ONE_FOR_REAL__FunctionSeries_getCoefficient);
8848 praat_addAction1 (klas, 1, U"Get degree", nullptr, 1,
8849 QUERY_ONE_FOR_INTEGER__FunctionSeries_getDegree);
8850 praat_addAction1 (klas, 0, U"-- function specifics --", nullptr, 1, 0);
8851 praat_addAction1 (klas, 1, U"Get value...", nullptr, 1,
8852 QUERY_ONE_FOR_REAL__FunctionSeries_getValue);
8853 praat_addAction1 (klas, 1, U"Get minimum...", nullptr, 1,
8854 QUERY_ONE_FOR_REAL__FunctionSeries_getMinimum);
8855 praat_addAction1 (klas, 1, U"Get x of minimum...", nullptr, 1,
8856 QUERY_ONE_FOR_REAL__FunctionSeries_getXOfMinimum);
8857 praat_addAction1 (klas, 1, U"Get maximum...", nullptr, 1,
8858 QUERY_ONE_FOR_REAL__FunctionSeries_getMaximum);
8859 praat_addAction1 (klas, 1, U"Get x of maximum...", nullptr, 1,
8860 QUERY_ONE_FOR_REAL__FunctionSeries_getXOfMaximum);
8861 praat_addAction1 (klas, 0, U"Modify -", nullptr, 0, 0);
8862 praat_addAction1 (klas, 1, U"Set domain...", nullptr, 1,
8863 MODIFY_EACH__FunctionSeries_setDomain);
8864 praat_addAction1 (klas, 1, U"Set coefficient...", nullptr, 1,
8865 MODIFY_EACH__FunctionSeries_setCoefficient);
8866 praat_addAction1 (klas, 0, U"Analyse", nullptr, 0, 0);
8867 }
8868
8869 /* Query buttons for frame-based frequency x time subclasses of matrix. */
8870
8871 void praat_BandFilterSpectrogram_query_init (ClassInfo klas) {
8872 praat_TimeFrameSampled_query_init (klas);
8873 praat_addAction1 (klas, 1, U"Get time from column...", nullptr, 1,
8874 QUERY_ONE_FOR_REAL__BandFilterSpectrogram_getTimeFromColumn);
8875 praat_addAction1 (klas, 1, U"-- frequencies --", nullptr, 1, 0);
8876 praat_addAction1 (klas, 1, U"Get lowest frequency", nullptr, 1,
8877 QUERY_ONE_FOR_REAL__BandFilterSpectrogram_getLowestFrequency);
8878 praat_addAction1 (klas, 1, U"Get highest frequency", nullptr, 1,
8879 QUERY_ONE_FOR_REAL__BandFilterSpectrogram_getHighestFrequency);
8880 praat_addAction1 (klas, 1, U"Get number of frequencies", nullptr, 1,
8881 QUERY_ONE_FOR_INTEGER__BandFilterSpectrogram_getNumberOfFrequencies);
8882 praat_addAction1 (klas, 1, U"Get frequency distance", nullptr, 1,
8883 QUERY_ONE_FOR_REAL__BandFilterSpectrogram_getFrequencyDistance);
8884 praat_addAction1 (klas, 1, U"Get frequency from row...", nullptr, 1,
8885 QUERY_ONE_FOR_REAL__BandFilterSpectrogram_getFrequencyFromRow);
8886 praat_addAction1 (klas, 1, U"-- get value --", nullptr, 1, 0);
8887 praat_addAction1 (klas, 1, U"Get value in cell...", nullptr, 1,
8888 QUERY_ONE_FOR_REAL__BandFilterSpectrogram_getValueInCell);
8889 }
8890
8891 static void praat_PatternList_query_init (ClassInfo klas) {
8892 praat_addAction1 (klas, 0, U"Query -", nullptr, 0, nullptr);
8893 praat_addAction1 (klas, 1, U"Get number of patterns", nullptr, 1,
8894 QUERY_ONE_FOR_INTEGER__PatternList_getNumberOfPatterns);
8895 praat_addAction1 (klas, 1, U"Get pattern size", nullptr, 1,
8896 QUERY_ONE_FOR_INTEGER__PatternList_getPatternSize);
8897 praat_addAction1 (klas, 1, U"Get value...", nullptr, 1,
8898 QUERY_ONE_FOR_REAL__PatternList_getValue);
8899
8900 }
8901
8902 static void praat_Spline_init (ClassInfo klas) {
8903 praat_FunctionSeries_init (klas);
8904 praat_addAction1 (klas, 0, U"Draw knots...", U"Draw basis function...", 1,
8905 GRAPHICS_EACH__Spline_drawKnots);
8906 praat_addAction1 (klas, 1, U"Get order", U"Get degree", 1,
8907 QUERY_ONE_FOR_INTEGER__Spline_getOrder);
8908 praat_addAction1 (klas, 1, U"Scale x...", U"Analyse", 0,
8909 CONVERT_EACH_TO_ONE__Spline_scaleX);
8910 }
8911
8912 static void praat_SSCP_query_init (ClassInfo klas) {
8913 praat_addAction1 (klas, 1, U"-- statistics --", U"Get value...", 1, 0);
8914 praat_addAction1 (klas, 1, U"Get number of observations", U"-- statistics --", 1,
8915 QUERY_ONE_FOR_INTEGER__SSCP_getNumberOfObservations);
8916 praat_addAction1 (klas, 1, U"Get degrees of freedom", U"Get number of observations", 1,
8917 QUERY_ONE_FOR_REAL__SSCP_getDegreesOfFreedom);
8918 praat_addAction1 (klas, 1, U"Get centroid element...", U"Get degrees of freedom", 1,
8919 QUERY_ONE_FOR_REAL__SSCP_getCentroidElement);
8920 praat_addAction1 (klas, 1, U"Get ln(determinant)", U"Get centroid element...", 1,
8921 QUERY_ONE_FOR_REAL__SSCP_getLnDeterminant);
8922 }
8923
8924 static void praat_SSCP_extract_init (ClassInfo klas) {
8925 praat_addAction1 (klas, 1, U"Extract centroid", U"Extract -", 1,
8926 CONVERT_EACH_TO_ONE__SSCP_extractCentroid);
8927 }
8928
8929 FORM (MODIFY_SSCP_setValue, U"Covariance: Set value", U"Covariance: Set value...") {
8930 NATURAL (rowNumber, U"Row number", U"1")
8931 NATURAL (columnNumber, U"Column number", U"1")
8932 REAL (value, U"New value", U"1.0")
8933 OK
8934 DO
8935 MODIFY_EACH (SSCP)
8936 SSCP_setValue (me, rowNumber, columnNumber, value);
8937 MODIFY_EACH_END
8938 }
8939
8940 FORM (MODIFY_SSCP_setCentroid, U"", nullptr) {
8941 NATURAL (elementNumber, U"Element number", U"1")
8942 REAL (value, U"New value", U"1.0")
8943 OK
8944 DO
8945 MODIFY_EACH (SSCP)
8946 SSCP_setCentroid (me, elementNumber, value);
8947 MODIFY_EACH_END
8948 }
8949
8950 void praat_SSCP_as_TableOfReal_init (ClassInfo klas) {
8951 praat_TableOfReal_init (klas);
8952 praat_removeAction (klas, nullptr, nullptr, U"Set value...");
8953 praat_addAction1 (klas, 1, U"Set centroid...", U"Formula...", 1,
8954 MODIFY_SSCP_setCentroid);
8955 praat_addAction1 (klas, 1, U"Set value...", U"Formula...", 1,
8956 MODIFY_SSCP_setValue);
8957 praat_addAction1 (klas, 0, U"To TableOfReal", U"To Matrix", 1,
8958 CONVERT_EACH_TO_ONE__TableOfReal_to_TableOfReal);
8959 }
8960
8961 void praat_TableOfReal_init2 (ClassInfo klas) {
8962 praat_TableOfReal_init (klas);
8963 praat_addAction1 (klas, 0, U"To TableOfReal", U"To Matrix", 1,
8964 CONVERT_EACH_TO_ONE__TableOfReal_to_TableOfReal);
8965 }
8966
8967 void praat_EditDistanceTable_as_TableOfReal_init (ClassInfo klas) {
8968 praat_TableOfReal_init (klas);
8969 praat_addAction1 (klas, 0, U"Set default costs...", U"Formula...", 1,
8970 MODIFY_EditDistanceTable_setDefaultCosts);
8971 praat_removeAction (klas, nullptr, nullptr, U"Draw as numbers...");
8972 praat_addAction1 (klas, 0, U"Draw...", U"Draw -", 1,
8973 GRAPHICS_EACH__EditDistanceTable_draw);
8974 praat_addAction1 (klas, 0, U"Draw edit operations", U"Draw...", 1,
8975 GRAPHICS_EACH__EditDistanceTable_drawEditOperations);
8976 praat_removeAction (klas, nullptr, nullptr, U"Draw as numbers if...");
8977 praat_removeAction (klas, nullptr, nullptr, U"Draw as squares...");
8978 praat_removeAction (klas, nullptr, nullptr, U"Draw vertical lines...");
8979 praat_removeAction (klas, nullptr, nullptr, U"Draw horizontal lines...");
8980 praat_removeAction (klas, nullptr, nullptr, U"Draw left and right lines...");
8981 praat_removeAction (klas, nullptr, nullptr, U"Draw top and bottom lines...");
8982 praat_removeAction (klas, nullptr, nullptr, U"-- draw lines --");
8983 }
8984
8985 void praat_David_generics_new_init ();
8986 void praat_David_generics_new_init () {
8987
8988 Thing_recognizeClassesByName (
8989 classPermutation,
8990 classPolynomial, classLegendreSeries, classChebyshevSeries, classMSpline, classISpline
8991 );
8992
8993 praat_addMenuCommand (U"Objects", U"New", U"Create Permutation...", nullptr, 1,
8994 CREATE_ONE__Permutation_create);
8995 praat_addMenuCommand (U"Objects", U"New", U"Create simple Permutation...", nullptr, 1,
8996 CREATE_ONE__Permutation_createSimplePermutation);
8997 praat_addMenuCommand (U"Objects", U"New", U"Polynomial", nullptr, 1, nullptr);
8998 praat_addMenuCommand (U"Objects", U"New", U"Create Polynomial...", nullptr, 2,
8999 CREATE_ONE__Polynomial_create);
9000 praat_addMenuCommand (U"Objects", U"New", U"Create Polynomial from product terms...", nullptr, 2,
9001 CREATE_ONE__Polynomial_createFromProductTerms);
9002 praat_addMenuCommand (U"Objects", U"New", U"Create Polynomial from real zeros...", nullptr, 2,
9003 CREATE_ONE__Polynomial_createFromRealZeros);
9004 praat_addMenuCommand (U"Objects", U"New", U"Create LegendreSeries...", nullptr, 2,
9005 CREATE_ONE__LegendreSeries_create);
9006 praat_addMenuCommand (U"Objects", U"New", U"Create ChebyshevSeries...", nullptr, 2,
9007 CREATE_ONE__ChebyshevSeries_create);
9008 praat_addMenuCommand (U"Objects", U"New", U"Create MSpline...", nullptr, 2,
9009 CREATE_ONE__MSpline_create);
9010 praat_addMenuCommand (U"Objects", U"New", U"Create ISpline...", nullptr, 2,
9011 CREATE_ONE__ISpline_create);
9012 }
9013
9014 void praat_David_init ();
9015 void praat_David_init () {
9016
9017 Data_recognizeFileType (TextGrid_TIMITLabelFileRecognizer);
9018 Data_recognizeFileType (cmuAudioFileRecognizer);
9019 Data_recognizeFileType (oggFileRecognizer);
9020
9021 Thing_recognizeClassesByName (classActivationList, classBarkFilter, classBarkSpectrogram,
9022 classCategories, classCepstrum, classCCA,
9023 classClassificationTable, classComplexSpectrogram, classConfusion,
9024 classCorrelation, classCovariance, classDiscriminant, classDTW,
9025 classEigen, classExcitationList, classEditCostsTable, classEditDistanceTable,
9026 classFileInMemory, classFileInMemorySet,
9027 classFormantFilter,
9028 classIndex, classKlattTable, classNMF,
9029 classMelFilter, classMelSpectrogram, classNavigationContext,
9030 classPatternList, classPCA, classRoots,
9031 classSimpleString, classStringsIndex, classSpeechSynthesizer, classSPINET, classSSCP,
9032 classSVD, classTextGridNavigator, classTextGridTierNavigator
9033 );
9034
9035 Thing_recognizeClassByOtherName (classExcitationList, U"Excitations");
9036 Thing_recognizeClassByOtherName (classActivationList, U"Activation");
9037 Thing_recognizeClassByOtherName (classPatternList, U"Pattern");
9038 Thing_recognizeClassByOtherName (classFileInMemorySet, U"FilesInMemory");
9039
9040 structVowelEditor :: f_preferences ();
9041
9042 {// scope
9043 //TRACE
9044 double t = Melder_clock ();
9045 classSpeechSynthesizer_initClass ();
9046 trace (U"initializing eSpeak data took ", Melder_fixed (1000 * (Melder_clock () - t), 3), U" milliseconds");
9047 }
9048
9049 praat_addMenuCommand (U"Objects", U"Goodies", U"Get TukeyQ...", 0, GuiMenu_HIDDEN,
9050 QUERY_NONE_FOR_REAL__Praat_getTukeyQ);
9051 praat_addMenuCommand (U"Objects", U"Goodies", U"Get invTukeyQ...", 0, GuiMenu_HIDDEN,
9052 QUERY_NONE_FOR_REAL__Praat_getInvTukeyQ);
9053 praat_addMenuCommand (U"Objects", U"Goodies", U"Get incomplete gamma...", 0, GuiMenu_HIDDEN,
9054 QUERY_NONE_FOR_COMPLEX__Praat_getIncompleteGamma);
9055
9056 praat_addMenuCommand (U"Objects", U"New", U"Create Sound as gammatone... || Create Sound from gammatone...", U"Create Sound as tone complex...", 1,
9057 CREATE_ONE__Sound_createAsGammaTone); // alternative COMPATIBILITY <= 2016
9058 praat_addMenuCommand (U"Objects", U"New", U"Create Sound as Shepard tone... || Create Sound from Shepard tone...", U"Create Sound as gammatone...", GuiMenu_DEPTH_1,
9059 CREATE_ONE__Sound_createAsShepardTone); // alternative COMPATIBILITY <= 2016
9060 praat_addMenuCommand (U"Objects", U"New", U"Create Sound from VowelEditor...", U"Create Sound as Shepard tone...", GuiMenu_DEPTH_1 | GuiMenu_NO_API,
9061 CREATION_WINDOW__VowelEditor_create);
9062 praat_addMenuCommand (U"Objects", U"New", U"Create TextGridNavigator...", U"Create Corpus...", GuiMenu_HIDDEN,
9063 CREATE_ONE__TextGridNavigator_createSimple);
9064
9065 /*
9066 The `New/SpeechSynthesizer` commands don't require us to supply the `after` argument,
9067 because `praat_David_init()` is called between `praat_uvafon_Artsynth_init()` and `praat_uvafon_gram_init()`.
9068 (last checked 2024-09-07)
9069 */
9070 praat_addMenuCommand (U"Objects", U"New", U"Text-to-speech synthesis", nullptr, 0, nullptr);
9071 praat_addMenuCommand (U"Objects", U"New", U"SpeechSynthesizer help", nullptr, 1,
9072 HELP__SpeechSynthesizer_help);
9073 praat_addMenuCommand (U"Objects", U"New", U" (more info)", nullptr, 1, nullptr);
9074 praat_addMenuCommand (U"Objects", U"New", U"Tabulate SpeechSynthesizer language properties", nullptr, 2,
9075 CREATE_ONE__TabulateSpeechSynthesizerLanguageProperties);
9076 praat_addMenuCommand (U"Objects", U"New", U"Tabulate SpeechSynthesizer voice properties", nullptr, 2,
9077 CREATE_ONE__TabulateSpeechSynthesizerVoiceProperties);
9078 praat_addMenuCommand (U"Objects", U"New", U"-- new SpeechSynthesizer --", nullptr, 1, nullptr);
9079 praat_addMenuCommand (U"Objects", U"New", U"Create SpeechSynthesizer...", nullptr, 1,
9080 CREATE_ONE__SpeechSynthesizer_create);
9081
9082 praat_addMenuCommand (U"Objects", U"New", U"Data sets from the literature", U"Create Table without column names...", 1, nullptr);
9083 praat_addMenuCommand (U"Objects", U"New", U"Create formant table (Peterson & Barney 1952)", U"Data sets from the literature", 2,
9084 CREATE_ONE__Table_create_petersonBarney1952);
9085 praat_addMenuCommand (U"Objects", U"New", U"Create formant table (Hillenbrand et al. 1995)", U"Data sets from the literature",
9086 GuiMenu_HIDDEN + GuiMenu_DEPTH_2,
9087 CREATE_ONE__Table_create_hillenbrandEtAl1995);
9088 praat_addMenuCommand (U"Objects", U"New", U"Create formant table (Pols & Van Nierop 1973)", U"Create formant table (Peterson & Barney 1952)", 2,
9089 CREATE_ONE__Table_create_polsVanNierop1973);
9090 praat_addMenuCommand (U"Objects", U"New", U"Create formant table (Weenink 1985)", U"Create formant table (Pols & Van Nierop 1973)", 2,
9091 CREATE_ONE__Table_create_weenink1983);
9092 praat_addMenuCommand (U"Objects", U"New", U"Create H1H2 table (Keating & Esposito 2006)", U"Create formant table (Weenink 1985)", 2,
9093 CREATE_ONE__Table_create_keatingEsposito2006);
9094 praat_addMenuCommand (U"Objects", U"New", U"Create Table (Ganong 1980)", U"Create H1H2 table (Keating & Esposito 2006)", 2,
9095 CREATE_ONE__Table_create_ganong1980);
9096 praat_addMenuCommand (U"Objects", U"New", U"-- new TableOfReal --", U"Create Table (Ganong 1980)", 2, nullptr);
9097 praat_addMenuCommand (U"Objects", U"New", U"Create iris data set", U"-- new TableOfReal --" , 2,
9098 CREATE_ONE__CreateIrisDataset);
9099 praat_addMenuCommand (U"Objects", U"New", U"Create TableOfReal (Pols 1973)...", U"Create iris data set", 2,
9100 CREATE_ONE__TableOfReal_create_pols1973);
9101 praat_addMenuCommand (U"Objects", U"New", U"Create TableOfReal (Van Nierop 1973)...", U"Create TableOfReal (Pols 1973)...", 2,
9102 CREATE_ONE__TableOfReal_create_vanNierop1973);
9103 praat_addMenuCommand (U"Objects", U"New", U"Create TableOfReal (Weenink 1985)...", U"Create TableOfReal (Van Nierop 1973)...", 2,
9104 CREATE_ONE__TableOfReal_create_weenink1983);
9105 praat_addMenuCommand (U"Objects", U"New", U"Create TableOfReal (Sandwell 1987)", U"Create TableOfReal (Weenink 1985)...", 2,
9106 CREATE_ONE__Table_create_sandwell1987);
9107 praat_addMenuCommand (U"Objects", U"New", U"-- new TableOfReal children --", U"Create TableOfReal (Weenink 1985)...", 1,
9108 CREATE_ONE__Confusion_createSimple);
9109 praat_addMenuCommand (U"Objects", U"New", U"Create simple Confusion...", U"-- new TableOfReal children --", 1,
9110 CREATE_ONE__Confusion_createSimple);
9111 praat_addMenuCommand (U"Objects", U"New", U"Create simple Covariance...", U"Create simple Confusion...", 1,
9112 CREATE_ONE__Covariance_createSimple);
9113 praat_addMenuCommand (U"Objects", U"New", U"Create simple Correlation...", U"Create simple Covariance...", 1,
9114 CREATE_ONE__Correlation_createSimple);
9115 praat_addMenuCommand (U"Objects", U"New", U"Create empty EditCostsTable...", U"Create simple Covariance...", 1,
9116 CREATE_ONE__EditCostsTable_createEmpty);
9117 praat_addMenuCommand (U"Objects", U"New", U"Create KlattTable example", U"Create TableOfReal (Weenink 1985)...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
9118 CREATE_ONE__KlattTable_createExample);
9119 praat_addMenuCommand (U"Objects", U"New", U"Create Strings from tokens...", U"Create Strings as folder list...", 2,
9120 CREATE_ONE__Strings_createFromTokens);
9121 praat_addMenuCommand (U"Objects", U"New", U"Create Strings as tokens...", U"Create Strings from tokens...", GuiMenu_DEPTH_2 | GuiMenu_HIDDEN,
9122 CREATE_ONE__Strings_createAsTokens);
9123 praat_addMenuCommand (U"Objects", U"New", U"Create Strings as characters...", U"Create Strings from tokens...", GuiMenu_DEPTH_2 | GuiMenu_HIDDEN,
9124 CREATE_ONE__Strings_createAsCharacters);
9125
9126 praat_addMenuCommand (U"Objects", U"New", U"Create simple Polygon...", nullptr, GuiMenu_HIDDEN,
9127 CREATE_ONE__Polygon_createSimple);
9128 praat_addMenuCommand (U"Objects", U"New", U"Create Polygon (random vertices)...", nullptr, GuiMenu_DEPRECATED_2016,
9129 CREATE_ONE__Polygon_createFromRandomPoints);
9130 praat_addMenuCommand (U"Objects", U"New", U"Create Polygon (random points)...", nullptr, GuiMenu_HIDDEN,
9131 CREATE_ONE__Polygon_createFromRandomPoints);
9132 praat_addMenuCommand (U"Objects", U"New", U"FileInMemory", nullptr, GuiMenu_HIDDEN, nullptr);
9133 praat_addMenuCommand (U"Objects", U"New", U"Create FileInMemory...", nullptr, GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
9134 READ_ONE__FileInMemory_create);
9135 praat_addMenuCommand (U"Objects", U"New", U"Create FileInMemorySet from directory contents...", nullptr, GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
9136 CREATE_ONE__FileInMemorySet_createFromDirectoryContents);
9137
9138 praat_addMenuCommand (U"Objects", U"Open", U"Read Sound from raw 16-bit Little Endian file...", U"Read from special sound file", 1,
9139 READ_ONE__Sound_readFromRawFileLE);
9140 praat_addMenuCommand (U"Objects", U"Open", U"Read Sound from raw 16-bit Big Endian file...", U"Read Sound from raw 16-bit Little Endian file...", 1,
9141 READ_ONE__Sound_readFromRawFileBE);
9142 praat_addMenuCommand (U"Objects", U"Open", U"Read KlattTable from raw text file...", U"Read Matrix from raw text file...", GuiMenu_HIDDEN,
9143 READ_ONE__KlattTable_readFromRawTextFile);
9144
9145 praat_addAction1 (classActivationList, 0, U"Modify", nullptr, 0, nullptr);
9146 praat_addAction1 (classActivationList, 0, U"Formula...", nullptr, 0,
9147 MODIFY_ActivationList_formula);
9148 praat_addAction1 (classActivationList, 0, U"Hack", nullptr, 0, nullptr);
9149 praat_addAction1 (classActivationList, 0, U"To Matrix", nullptr, 0,
9150 CONVERT_EACH_TO_ONE__ActivationList_to_Matrix);
9151 praat_addAction1 (classActivationList, 0, U"To PatternList", nullptr, 0,
9152 CONVERT_EACH_TO_ONE__ActivationList_to_PatternList);
9153
9154 praat_addAction2 (classActivationList, 1, classCategories, 1, U"To TableOfReal", nullptr, 0,
9155 CONVERT_ONE_AND_ONE_TO_ONE__ActivationList_Categories_to_TableOfReal);
9156
9157 praat_addAction1 (classAmplitudeTier, 0, U"Get value at time...", U"Get time from index...", 1,
9158 QUERY_ONE_FOR_REAL__AmplitudeTier_getValueAtTime);
9159 praat_addAction1 (classAmplitudeTier, 0, U"Get value at index...", U"Get value at time...", 1,
9160 QUERY_ONE_FOR_REAL__AmplitudeTier_getValueAtIndex);
9161
9162 praat_addAction1 (classBarkFilter, 0, U"BarkFilter help", nullptr, 0, HELP__BarkFilter_help);
9163 praat_FilterBank_all_init (classBarkFilter); // deprecated 2014
9164 praat_addAction1 (classBarkFilter, 0, U"Draw spectrum (slice)...", U"Draw filters...", GuiMenu_DEPRECATED_2014,
9165 GRAPHICS_EACH__BarkFilter_drawSpectrum);
9166 praat_addAction1 (classBarkFilter, 1, U"Draw filter functions...", U"Draw filters...", GuiMenu_DEPRECATED_2014,
9167 GRAPHICS_EACH__BarkFilter_drawSekeyHansonFilterFunctions);
9168 praat_addAction1 (classBarkFilter, 0, U"Paint...", U"Draw filters...", GuiMenu_DEPTH_1,
9169 GRAPHICS_EACH__BarkFilter_paint); // deprecated 2014
9170 praat_addAction1 (classBarkFilter, 0, U"To BarkSpectrogram", nullptr, 0,
9171 CONVERT_EACH_TO_ONE__BarkFilter_to_BarkSpectrogram);
9172
9173 praat_addAction1 (classBarkSpectrogram, 0, U"BarkSpectrogram help", nullptr, 0,
9174 HELP__BarkSpectrogram_help);
9175 praat_addAction1 (classBarkSpectrogram, 0, U"Draw -", nullptr, 0, nullptr);
9176 praat_addAction1 (classBarkSpectrogram, 0, U"Draw frequency scale...", nullptr, 1,
9177 GRAPHICS_EACH__BarkSpectrogram_drawFrequencyScale);
9178 praat_addAction1 (classBarkSpectrogram, 0, U"Paint image...", nullptr, 1,
9179 GRAPHICS_EACH__BarkSpectrogram_paintImage);
9180 praat_addAction1 (classBarkSpectrogram, 0, U"Draw Sekey-Hanson auditory filters...", nullptr, 1,
9181 GRAPHICS_EACH__BarkSpectrogram_drawSekeyHansonAuditoryFilters);
9182 praat_addAction1 (classBarkSpectrogram, 0, U"Draw spectrum at nearest time slice...", nullptr, 1,
9183 GRAPHICS_EACH__BarkSpectrogram_drawSpectrumAtNearestTimeSlice);
9184 praat_addAction1 (classBarkSpectrogram, 0, U"Query -", nullptr, 0, nullptr);
9185 praat_BandFilterSpectrogram_query_init (classBarkSpectrogram);
9186 praat_addAction1 (classBarkSpectrogram, 0, U"Equalize intensities...", nullptr, 0,
9187 MODIFY_EACH__BandFilterSpectrogram_equalizeIntensities);
9188 praat_addAction1 (classBarkSpectrogram, 0, U"To Intensity", nullptr, 0,
9189 CONVERT_EACH_TO_ONE__BandFilterSpectrogram_to_Intensity);
9190 praat_addAction1 (classBarkSpectrogram, 0, U"To Matrix...", nullptr, 0,
9191 CONVERT_EACH_TO_ONE__BandFilterSpectrogram_to_Matrix);
9192 praat_addAction1 (classBarkSpectrogram, 2, U"Cross-correlate...", nullptr, 0,
9193 CONVERT_TWO_TO_ONE__BandFilterSpectrograms_crossCorrelate);
9194 praat_addAction1 (classBarkSpectrogram, 2, U"Convolve...", nullptr, 0,
9195 CONVERT_TWO_TO_ONE__BandFilterSpectrograms_convolve);
9196
9197 praat_addAction1 (classCategories, 0, U"View & Edit || Edit", nullptr, GuiMenu_NO_API,
9198 EDITOR_ONE_Categories_edit);
9199 praat_addAction1 (classCategories, 0, U"Query -", nullptr, 0, nullptr);
9200 praat_addAction1 (classCategories, 1, U"Get number of categories", nullptr, 1,
9201 QUERY_ONE_FOR_INTEGER__Categories_getNumberOfCategories);
9202 praat_addAction1 (classCategories, 2, U"Get number of differences", nullptr, 1,
9203 QUERY_TWO_FOR_REAL__Categories_getNumberOfDifferences);
9204 praat_addAction1 (classCategories, 2, U"Get fraction different", nullptr, 1,
9205 QUERY_TWO_FOR_REAL__Categories_getFractionDifferent);
9206 praat_addAction1 (classCategories, 0, U"Modify -", nullptr, 0, nullptr);
9207 praat_addAction1 (classCategories, 1, U"Append category... || Append 1 category...",
9208 nullptr, 1, MODIFY_Categories_appendCategory);
9209 praat_addAction1 (classCategories, 0, U"Permute items (in-place)", nullptr, 1,
9210 MODIFY_EACH__Categories_permuteItems_inplace);
9211 praat_addAction1 (classCategories, 0, U"Extract", nullptr, 0, nullptr);
9212 praat_addAction1 (classCategories, 0, U"To unique Categories", nullptr, 0,
9213 CONVERT_EACH_TO_ONE__Categories_selectUniqueItems);
9214 praat_addAction1 (classCategories, 0, U"Analyse", nullptr, 0, nullptr); // TODO name
9215 praat_addAction1 (classCategories, 2, U"To Confusion", nullptr, 0,
9216 CONVERT_TWO_TO_ONE__Categories_to_Confusion);
9217 praat_addAction1 (classCategories, 0, U"Synthesize", nullptr, 0, nullptr);
9218 praat_addAction1 (classCategories, 2, U"Join", nullptr, 0,
9219 CONVERT_TWO_TO_ONE__Categories_join);
9220 praat_addAction1 (classCategories, 0, U"Permute items", nullptr, 0,
9221 CONVERT_EACH_TO_ONE__Categories_permuteItems);
9222 praat_addAction1 (classCategories, 0, U"To Strings", nullptr, 0,
9223 CONVERT_EACH_TO_ONE__Categories_to_Strings);
9224
9225 praat_addAction1 (classChebyshevSeries, 0, U"ChebyshevSeries help", nullptr, 0,
9226 HELP__ChebyshevSeries_help);
9227 praat_FunctionSeries_init (classChebyshevSeries);
9228 praat_addAction1 (classChebyshevSeries, 0, U"To Polynomial", U"Analyse", 0,
9229 CONVERT_EACH_TO_ONE__ChebyshevSeries_to_Polynomial);
9230
9231 praat_addAction1 (classCCA, 1, U"CCA help", nullptr, 0,
9232 HELP__CCA_help);
9233 praat_addAction1 (classCCA, 1, U"Draw eigenvector...", nullptr, 0,
9234 GRAPHICS_EACH__CCA_drawEigenvector);
9235 praat_addAction1 (classCCA, 1, U"Get number of correlations", nullptr, 0,
9236 QUERY_ONE_FOR_INTEGER__CCA_getNumberOfCorrelations);
9237 praat_addAction1 (classCCA, 1, U"Get correlation...", nullptr, 0,
9238 QUERY_ONE_FOR_REAL__CCA_getCorrelation);
9239 praat_addAction1 (classCCA, 1, U"Get eigenvector element...", nullptr, 0,
9240 QUERY_ONE_FOR_REAL__CCA_getEigenvectorElement);
9241 praat_addAction1 (classCCA, 1, U"Get zero correlation probability...", nullptr, 0,
9242 QUERY_ONE_FOR_REAL__CCA_getZeroCorrelationProbability);
9243 praat_addAction1 (classCCA, 1, U"Extract Eigen...", nullptr, 0,
9244 CONVERT_EACH_TO_ONE__CCA_extractEigen);
9245
9246 praat_addAction2 (classCCA, 1, classTableOfReal, 1, U"To TableOfReal (scores)...", nullptr, 0,
9247 CONVERT_ONE_AND_ONE_TO_ONE__CCA_TableOfReal_to_TableOfReal_scores);
9248 praat_addAction2 (classCCA, 1, classTableOfReal, 1, U"To TableOfReal (loadings)", nullptr, 0,
9249 CONVERT_ONE_AND_ONE_TO_ONE__CCA_TableOfReal_to_TableOfReal_loadings);
9250 praat_addAction2 (classCCA, 1, classTableOfReal, 1, U"Predict...", nullptr, 0,
9251 CONVERT_ONE_AND_ONE_TO_ONE__CCA_TableOfReal_predict);
9252 praat_addAction2 (classCCA, 1, classCorrelation, 1, U"To TableOfReal (loadings)", nullptr, 0,
9253 CONVERT_ONE_AND_ONE_TO_ONE__CCA_Correlation_to_TableOfReal_loadings);
9254 praat_addAction2 (classCCA, 1, classCorrelation, 1, U"Get variance fraction...", nullptr, 0,
9255 QUERY_ONE_AND_ONE_FOR_REAL__CCA_Correlation_getVarianceFraction);
9256 praat_addAction2 (classCCA, 1, classCorrelation, 1, U"Get redundancy (sl)...", nullptr, 0,
9257 QUERY_ONE_AND_ONE_FOR_REAL__CCA_Correlation_getRedundancy_sl);
9258
9259 praat_addAction1 (classComplexSpectrogram, 0, U"ComplexSpectrogram help", nullptr, 0,
9260 HELP__ComplexSpectrogram_help);
9261 praat_addAction1 (classComplexSpectrogram, 0, U"Draw -", nullptr, 0, nullptr);
9262 praat_addAction1 (classComplexSpectrogram, 0, U"To Sound...", nullptr, 0,
9263 CONVERT_EACH_TO_ONE__ComplexSpectrogram_to_Sound);
9264 praat_addAction1 (classComplexSpectrogram, 0, U"Down to Spectrogram", nullptr, 0,
9265 CONVERT_EACH_TO_ONE__ComplexSpectrogram_downto_Spectrogram);
9266 praat_addAction1 (classComplexSpectrogram, 0, U"To Spectrum (slice)...", nullptr, 0,
9267 CONVERT_EACH_TO_ONE__ComplexSpectrogram_to_Spectrum_slice);
9268 praat_addAction2 (classComplexSpectrogram, 1, classSpectrogram, 1, U"Replace amplitudes", nullptr, 0,
9269 MODIFY_ComplexSpectrogram_Spectrogram_replaceAmplitudes);
9270
9271 praat_addAction1 (classConfusion, 0, U"Confusion help", nullptr, 0,
9272 HELP__Confusion_help);
9273 praat_TableOfReal_init2 (classConfusion);
9274 praat_removeAction (classConfusion, nullptr, nullptr, U"Draw as numbers...");
9275 praat_removeAction (classConfusion, nullptr, nullptr, U"Sort by label...");
9276 praat_removeAction (classConfusion, nullptr, nullptr, U"Sort by column...");
9277 praat_addAction1 (classConfusion, 0, U"Draw as numbers...", U"Draw -", 1,
9278 GRAPHICS_EACH__Confusion_drawAsNumbers);
9279 praat_addAction1 (classConfusion, 1, U"Get value (labels)...", U"Get value...", 1,
9280 QUERY_ONE_FOR_REAL__Confusion_getValue_labels);
9281 praat_addAction1 (classConfusion, 0, U"-- confusion statistics --", U"Get value (labels)...", 1, nullptr);
9282 praat_addAction1 (classConfusion, 1, U"Get fraction correct", U"-- confusion statistics --", 1,
9283 QUERY_ONE_FOR_REAL__Confusion_getFractionCorrect);
9284 praat_addAction1 (classConfusion, 1, U"Get stimulus sum...", U"Get fraction correct", 1,
9285 QUERY_ONE_FOR_REAL__Confusion_getStimulusSum);
9286 praat_addAction1 (classConfusion, 1, U"Get row sum...", U"Get fraction correct", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
9287 QUERY_ONE_FOR_REAL__TableOfReal_getRowSum);
9288 praat_addAction1 (classConfusion, 1, U"Get response sum...", U"Get stimulus sum...", 1,
9289 QUERY_ONE_FOR_REAL__Confusion_getResponseSum);
9290 praat_addAction1 (classConfusion, 1, U"Get column sum...", U"Get row sum...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
9291 QUERY_ONE_FOR_REAL__TableOfReal_getColumnSum);
9292 praat_addAction1 (classConfusion, 1, U"Get grand sum", U"Get response sum...", 1,
9293 QUERY_ONE_FOR_REAL__TableOfReal_getGrandSum);
9294 praat_addAction1 (classConfusion, 0, U"Increase...", U"Formula...", 1,
9295 MODIFY_Confusion_increase);
9296 praat_addAction1 (classConfusion, 0, U"To TableOfReal (marginals)", U"To TableOfReal", 0,
9297 CONVERT_EACH_TO_ONE__Confusion_to_TableOfReal_marginals);
9298 praat_addAction1 (classConfusion, 0, U"Analyse", nullptr, 0, nullptr);
9299 praat_addAction1 (classConfusion, 0, U"Condense...", nullptr, GuiMenu_HIDDEN,
9300 CONVERT_EACH_TO_ONE__Confusion_condense);
9301 praat_addAction1 (classConfusion, 0, U"Group...", nullptr, 0,
9302 CONVERT_EACH_TO_ONE__Confusion_group);
9303 praat_addAction1 (classConfusion, 0, U"Group stimuli...", nullptr, 0,
9304 CONVERT_EACH_TO_ONE__Confusion_groupStimuli);
9305 praat_addAction1 (classConfusion, 0, U"Group responses...", nullptr, 0,
9306 CONVERT_EACH_TO_ONE__Confusion_groupResponses);
9307 praat_addAction1 (classConfusion, 2, U"To difference matrix", nullptr, 0,
9308 CONVERT_TWO_TO_ONE__Confusion_difference); // TODO to_Matrix_difference ?
9309
9310 praat_addAction2 (classConfusion, 1, classClassificationTable, 1, U"Increase confusion count", nullptr, 0,
9311 MODIFY_Confusion_ClassificationTable_increaseConfusionCount);
9312
9313 praat_addAction2 (classConfusion, 1, classMatrix, 1, U"Draw", nullptr, 0, nullptr);
9314 praat_addAction2 (classConfusion, 1, classMatrix, 1, U"Draw confusion...", nullptr, 0,
9315 GRAPHICS_ONE_AND_ONE__Confusion_Matrix_draw);
9316
9317 praat_addAction1 (classCovariance, 0, U"Covariance help", nullptr, 0,
9318 HELP__Covariance_help);
9319 praat_SSCP_as_TableOfReal_init (classCovariance);
9320 praat_SSCP_query_init (classCovariance);
9321 praat_SSCP_extract_init (classCovariance);
9322 praat_addAction1 (classCovariance, 1, U"Get probability at position...", U"Get value...", 1,
9323 QUERY_ONE_FOR_REAL__Covariance_getProbabilityAtPosition);
9324 praat_addAction1 (classCovariance, 1, U"Get diagonality (bartlett)...", U"Get ln(determinant)", 1,
9325 QUERY_ONE_FOR_REAL__SSCP_getDiagonality_bartlett);
9326 praat_addAction1 (classCovariance, 1, U"Get significance of one mean...", U"Get diagonality (bartlett)...", 1,
9327 QUERY_ONE_FOR_REAL__Covariance_getSignificanceOfOneMean);
9328 praat_addAction1 (classCovariance, 1, U"Get significance of means difference...", U"Get significance of one mean...", 1,
9329 QUERY_ONE_FOR_REAL__Covariance_getSignificanceOfMeansDifference);
9330 praat_addAction1 (classCovariance, 1, U"Get significance of one variance...", U"Get significance of means difference...", 1,
9331 QUERY_ONE_FOR_REAL__Covariance_getSignificanceOfOneVariance);
9332 praat_addAction1 (classCovariance, 1, U"Get significance of variances ratio...", U"Get significance of one variance...", 1,
9333 QUERY_ONE_FOR_REAL__Covariance_getSignificanceOfVariancesRatio);
9334 praat_addAction1 (classCovariance, 1, U"Get fraction variance...", U"Get significance of variances ratio...", 1,
9335 QUERY_ONE_FOR_REAL__Covariance_getFractionVariance);
9336 praat_addAction1 (classCovariance, 2, U"Report multivariate mean difference...", U"Get fraction variance...", 1,
9337 INFO_TWO__Covariances_reportMultivariateMeanDifference);
9338 praat_addAction1 (classCovariance, 2, U"Difference", U"Report multivariate mean difference...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
9339 INFO_NONE__Covariances_reportEquality);
9340 praat_addAction1 (classCovariance, 0, U"Report equality of covariances", U"Report multivariate mean difference...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
9341 INFO_NONE__Covariances_reportEquality);
9342 praat_addAction1 (classCovariance, 0, U"To TableOfReal (random sampling)...", nullptr, 0,
9343 CONVERT_EACH_TO_ONE__Covariance_to_TableOfReal_randomSampling);
9344 praat_addAction1 (classCovariance, 0, U"To Correlation", nullptr, 0,
9345 CONVERT_EACH_TO_ONE__Covariance_to_Correlation);
9346 praat_addAction1 (classCovariance, 0, U"To PCA", nullptr, 0,
9347 CONVERT_EACH_TO_ONE__Covariance_to_PCA);
9348 praat_addAction1 (classCovariance, 0, U"Pool", nullptr, 0,
9349 COMBINE_ALL_LISTED_TO_ONE__Covariances_pool);
9350 praat_addAction1 (classCovariance, 0, U"To Covariance (between)", nullptr, 0,
9351 COMBINE_ALL_LISTED_TO_ONE__Covariances_to_Covariance_between);
9352 praat_addAction1 (classCovariance, 0, U"To Covariance (within)", nullptr, 0,
9353 COMBINE_ALL_LISTED_TO_ONE__Covariances_to_Covariance_within);
9354
9355 praat_addAction2 (classCovariance, 1, classTableOfReal, 1, U"To TableOfReal (mahalanobis)...", nullptr, 0,
9356 CONVERT_ONE_AND_ONE_TO_ONE__Covariance_TableOfReal_mahalanobis);
9357
9358 praat_addAction1 (classClassificationTable, 0, U"ClassificationTable help", nullptr, 0,
9359 HELP__ClassificationTable_help);
9360 praat_TableOfReal_init (classClassificationTable);
9361 praat_addAction1 (classClassificationTable, 0, U"Get class index at maximum in row...", U"Get column index...", 1,
9362 QUERY_ONE_FOR_INTEGER__ClassificationTable_getClassIndexAtMaximumInRow);
9363 praat_addAction1 (classClassificationTable, 0, U"Get class label at maximum in row...", U"Get class index at maximum in row...", 1,
9364 QUERY_ONE_FOR_STRING__ClassificationTable_getClassLabelAtMaximumInRow);
9365 praat_addAction1 (classClassificationTable, 0, U"To Confusion...", nullptr, 0,
9366 CONVERT_EACH_TO_ONE__ClassificationTable_to_Confusion);
9367 praat_addAction1 (classClassificationTable, 0, U"To Confusion", nullptr, GuiMenu_DEPRECATED_2014,
9368 CONVERT_EACH_TO_ONE__ClassificationTable_to_Confusion_old); // replace with To Confusion: 0
9369 praat_addAction1 (classClassificationTable, 0, U"To Correlation (columns)", nullptr, 0,
9370 CONVERT_EACH_TO_ONE__ClassificationTable_to_Correlation_columns);
9371 praat_addAction1 (classClassificationTable, 0, U"To Strings (max. prob.)", nullptr, 0,
9372 CONVERT_EACH_TO_ONE__ClassificationTable_to_Strings_maximumProbability); // TODO name?
9373
9374 praat_addAction1 (classCorrelation, 0, U"Correlation help", nullptr, 0,
9375 HELP__Correlation_help);
9376 praat_TableOfReal_init2 (classCorrelation);
9377 praat_SSCP_query_init (classCorrelation);
9378 praat_SSCP_extract_init (classCorrelation);
9379 praat_addAction1 (classCorrelation, 1, U"Get diagonality (bartlett)...", U"Get ln(determinant)", 1,
9380 QUERY_ONE_FOR_REAL__Correlation_getDiagonality_bartlett);
9381 praat_addAction1 (classCorrelation, 0, U"Confidence intervals...", nullptr, 0,
9382 CONVERT_EACH_TO_ONE__Correlation_confidenceIntervals);
9383 praat_addAction1 (classCorrelation, 0, U"To PCA", nullptr, 0,
9384 CONVERT_EACH_TO_ONE__Correlation_to_PCA);
9385
9386 praat_addAction1 (classDiscriminant, 0, U"Discriminant help", 0, 0,
9387 HELP__Discriminant_help);
9388 praat_addAction1 (classDiscriminant, 0, U"Draw -", nullptr, 0, nullptr);
9389 praat_addAction1 (classDiscriminant, 0, U"Draw eigenvalues...", nullptr, 1,
9390 GRAPHICS_EACH__Discriminant_drawEigenvalues);
9391 praat_addAction1 (classDiscriminant, 0, U"Draw eigenvalues (scree)...", nullptr, GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
9392 WARNING__Eigen_drawEigenvalues_scree);
9393 praat_addAction1 (classDiscriminant, 0, U"Draw eigenvector...", nullptr, 1,
9394 GRAPHICS_EACH__Discriminant_drawEigenvector);
9395
9396 praat_addAction1 (classDiscriminant, 0, U"-- sscps --", 0, 1, 0);
9397 praat_addAction1 (classDiscriminant, 0, U"Draw sigma ellipses...", 0, 1,
9398 GRAPHICS_EACH__Discriminant_drawSigmaEllipses);
9399 praat_addAction1 (classDiscriminant, 0, U"Draw one sigma ellipse...", 0, 1,
9400 GRAPHICS_EACH__Discriminant_drawOneSigmaEllipse);
9401 praat_addAction1 (classDiscriminant, 0, U"Draw confidence ellipses...", 0, 1,
9402 GRAPHICS_EACH__Discriminant_drawConfidenceEllipses);
9403
9404 praat_addAction1 (classDiscriminant, 1, U"Query -", nullptr, 0, nullptr);
9405 praat_addAction1 (classDiscriminant, 1, U"-- eigen structure --", nullptr, 1, 0);
9406 praat_addAction1 (classDiscriminant, 1, U"Get eigenvalue...", nullptr, 1,
9407 QUERY_ONE_FOR_REAL__Discriminant_getEigenvalue);
9408 praat_addAction1 (classDiscriminant, 1, U"Get sum of eigenvalues...", nullptr, 1,
9409 QUERY_ONE_FOR_REAL__Discriminant_getSumOfEigenvalues);
9410 praat_addAction1 (classDiscriminant, 1, U"Get number of eigenvectors", nullptr, 1,
9411 QUERY_ONE_FOR_INTEGER__Discriminant_getNumberOfEigenvectors);
9412 praat_addAction1 (classDiscriminant, 1, U"Get eigenvector dimension", nullptr, 1,
9413 QUERY_ONE_FOR_INTEGER__Discriminant_getEigenvectorDimension);
9414 praat_addAction1 (classDiscriminant, 1, U"Get eigenvector element...", nullptr, 1,
9415 QUERY_ONE_FOR_REAL__Discriminant_getEigenvectorElement);
9416
9417 praat_addAction1 (classDiscriminant, 1, U"-- discriminant --", 0, 1, 0);
9418 praat_addAction1 (classDiscriminant, 1, U"Get number of functions", 0, 1,
9419 QUERY_ONE_FOR_INTEGER__Discriminant_getNumberOfFunctions);
9420 praat_addAction1 (classDiscriminant, 1, U"Get dimension of functions", 0, 1,
9421 QUERY_ONE_FOR_INTEGER__Discriminant_getDimensionOfFunctions);
9422 praat_addAction1 (classDiscriminant, 1, U"Get number of groups", 0, 1,
9423 QUERY_ONE_FOR_INTEGER__Discriminant_getNumberOfGroups);
9424 praat_addAction1 (classDiscriminant, 1, U"Get number of observations...", 0, 1,
9425 QUERY_ONE_FOR_INTEGER__Discriminant_getNumberOfObservations);
9426 praat_addAction1 (classDiscriminant, 1, U"-- tests --", 0, 1, 0);
9427 praat_addAction1 (classDiscriminant, 1, U"Get Wilks lambda...", 0, 1,
9428 QUERY_ONE_FOR_REAL__Discriminant_getWilksLambda);
9429 praat_addAction1 (classDiscriminant, 1, U"Get cumulative contribution of components...", 0, 1,
9430 QUERY_ONE_FOR_REAL__Discriminant_getCumulativeContributionOfComponents);
9431 praat_addAction1 (classDiscriminant, 1, U"Get partial discrimination probability...", 0, 1,
9432 QUERY_ONE_FOR_REAL__Discriminant_getPartialDiscriminationProbability);
9433 praat_addAction1 (classDiscriminant, 1, U"Get homogeneity of covariances (box)", 0, GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
9434 QUERY_ONE_FOR_REAL__Discriminant_getHomegeneityOfCovariances_box);
9435 praat_addAction1 (classDiscriminant, 1, U"Report equality of covariance matrices", 0, 1,
9436 INFO_ONE__Discriminant_reportEqualityOfCovarianceMatrices);
9437 praat_addAction1 (classDiscriminant, 1, U"-- ellipses --", 0, 1, 0);
9438 praat_addAction1 (classDiscriminant, 1, U"Get sigma ellipse area...", 0, 1,
9439 QUERY_ONE_FOR_REAL__Discriminant_getSigmaEllipseArea);
9440 praat_addAction1 (classDiscriminant, 1, U"Get confidence ellipse area...", 0, 1,
9441 QUERY_ONE_FOR_REAL__Discriminant_getConfidenceEllipseArea);
9442 praat_addAction1 (classDiscriminant, 1, U"Get ln(determinant_group)...", 0, 1,
9443 QUERY_ONE_FOR_REAL__Discriminant_getLnDeterminant_group);
9444 praat_addAction1 (classDiscriminant, 1, U"Get ln(determinant_total)", 0, 1,
9445 QUERY_ONE_FOR_REAL__Discriminant_getLnDeterminant_total);
9446
9447 praat_addAction1 (classDiscriminant, 0, U"Modify -", nullptr, 0, nullptr);
9448 praat_addAction1 (classDiscriminant, 1, U"Invert eigenvector...", nullptr, 1,
9449 MODIFY_Discriminant_invertEigenvector);
9450 praat_addAction1 (classDiscriminant, 0, U"Align eigenvectors", nullptr, 1,
9451 MODIFY_ALL__Eigens_alignEigenvectors);
9452
9453 praat_addAction1 (classDiscriminant, 0, U"Extract -", nullptr, 0, 0);
9454 praat_addAction1 (classDiscriminant, 0, U"Extract pooled within-groups SSCP", nullptr, 1,
9455 CONVERT_EACH_TO_ONE__Discriminant_extractPooledWithinGroupsSSCP);
9456 praat_addAction1 (classDiscriminant, 0, U"Extract within-group SSCP...", nullptr, 1,
9457 CONVERT_EACH_TO_ONE__Discriminant_extractWithinGroupSSCP);
9458 praat_addAction1 (classDiscriminant, 0, U"Extract between-groups SSCP", nullptr, 1,
9459 CONVERT_EACH_TO_ONE__Discriminant_extractBetweenGroupsSSCP);
9460 praat_addAction1 (classDiscriminant, 0, U"Extract group centroids", nullptr, 1,
9461 CONVERT_EACH_TO_ONE__Discriminant_extractGroupCentroids);
9462 praat_addAction1 (classDiscriminant, 0, U"Extract group standard deviations", nullptr, 1,
9463 CONVERT_EACH_TO_ONE__Discriminant_extractGroupStandardDeviations);
9464 praat_addAction1 (classDiscriminant, 0, U"Extract group labels", nullptr, 1,
9465 CONVERT_EACH_TO_ONE__Discriminant_extractGroupLabels);
9466 praat_addAction1 (classDiscriminant, 0, U"Extract Eigen", nullptr, 1,
9467 CONVERT_EACH_TO_ONE__Discriminant_extractEigen);
9468
9469 praat_addAction1 (classDiscriminant , 0, U"& TableOfReal: To ClassificationTable?", nullptr, 0,
9470 HINT__Discriminant_TableOfReal_to_ClassificationTable);
9471
9472 praat_Eigen_Spectrogram_project (classDiscriminant, classSpectrogram);
9473 praat_Eigen_Spectrogram_project (classDiscriminant, classBarkSpectrogram);
9474 praat_Eigen_Spectrogram_project (classDiscriminant, classMelSpectrogram);
9475
9476 praat_Eigen_Matrix_project (classDiscriminant, classFormantFilter); // deprecated 2014
9477 praat_Eigen_Matrix_project (classDiscriminant, classBarkFilter); // deprecated 2014
9478 praat_Eigen_Matrix_project (classDiscriminant, classMelFilter); // deprecated 2014
9479
9480 praat_addAction2 (classDiscriminant, 1, classPatternList, 1, U"To Categories...", nullptr, 0,
9481 CONVERT_ONE_AND_ONE_TO_ONE__Discriminant_PatternList_to_Categories);
9482 praat_addAction2 (classDiscriminant, 1, classSSCP, 1, U"Project", nullptr, 0,
9483 CONVERT_ONE_AND_ONE_TO_ONE__Eigen_SSCP_project);
9484 praat_addAction2 (classDiscriminant, 1, classStrings, 1, U"Modify Discriminant", nullptr, 0, 0);
9485 praat_addAction2 (classDiscriminant, 1, classStrings, 1, U"Set group labels", nullptr, 0,
9486 MODIFY_FIRST_OF_ONE_AND_ONE__Discriminant_setGroupLabels);
9487
9488 praat_addAction2 (classDiscriminant, 1, classTableOfReal, 1, U"To Configuration...", nullptr, 0,
9489 CONVERT_ONE_AND_ONE_TO_ONE__Discriminant_TableOfReal_to_Configuration);
9490 praat_addAction2 (classDiscriminant, 1, classTableOfReal, 1, U"To ClassificationTable...", nullptr, 0,
9491 CONVERT_ONE_AND_ONE_TO_ONE__Discriminant_TableOfReal_to_ClassificationTable);
9492 praat_addAction2 (classDiscriminant, 1, classTableOfReal, 1, U"To TableOfReal (mahalanobis)...", nullptr, 0,
9493 CONVERT_ONE_AND_ONE_TO_ONE__Discriminant_TableOfReal_mahalanobis);
9494 praat_addAction2 (classDiscriminant, 1, classTableOfReal, 1, U"To TableOfReal (mahalanobis, all)...", nullptr, 0,
9495 CONVERT_ONE_AND_ONE_TO_ONE__Discriminant_TableOfReal_mahalanobis_all);
9496
9497 praat_addAction1 (classDTW, 0, U"DTW help", nullptr, 0,
9498 HELP__DTW_help);
9499 praat_addAction1 (classDTW, 0, U"Draw -", nullptr, 0, nullptr);
9500 praat_addAction1 (classDTW, 0, U"Draw path...", nullptr, 1,
9501 GRAPHICS_EACH__DTW_drawPath);
9502 praat_addAction1 (classDTW, 0, U"Paint distances...", nullptr, 1,
9503 GRAPHICS_EACH__DTW_paintDistances);
9504 praat_addAction1 (classDTW, 0, U"Draw warp (x)...", nullptr, 1,
9505 GRAPHICS_EACH__DTW_drawWarp_x);
9506 praat_addAction1 (classDTW, 0, U"Draw warp (y)...", nullptr, 1,
9507 GRAPHICS_EACH__DTW_drawWarp_y);
9508 praat_addAction1 (classDTW, 0, U"Query -", nullptr, 0, nullptr);
9509 praat_addAction1 (classDTW, 1, U"Query time domains", nullptr, 1, 0);
9510 praat_addAction1 (classDTW, 1, U"Get start time (x)", nullptr, 2,
9511 QUERY_ONE_FOR_REAL__DTW_getStartTime_x);
9512 praat_addAction1 (classDTW, 1, U"Get end time (x)", nullptr, 2,
9513 QUERY_ONE_FOR_REAL__DTW_getEndTime_x);
9514 praat_addAction1 (classDTW, 1, U"Get total duration (x)", nullptr, 2,
9515 QUERY_ONE_FOR_REAL__DTW_getTotalDuration_x);
9516 praat_addAction1 (classDTW, 1, U"-- time domain x from y separator --", nullptr, 2, 0);
9517 praat_addAction1 (classDTW, 1, U"Get start time (y)", nullptr, 2,
9518 QUERY_ONE_FOR_REAL__DTW_getStartTime_y);
9519 praat_addAction1 (classDTW, 1, U"Get end time (y)", nullptr, 2,
9520 QUERY_ONE_FOR_REAL__DTW_getEndTime_y);
9521 praat_addAction1 (classDTW, 1, U"Get total duration (y)", nullptr, 2,
9522 QUERY_ONE_FOR_REAL__DTW_getTotalDuration_y);
9523 praat_addAction1 (classDTW, 1, U"Query time samplings", nullptr, 1, 0);
9524 praat_addAction1 (classDTW, 1, U"Get number of frames (x)", nullptr, 2,
9525 QUERY_ONE_FOR_INTEGER__DTW_getNumberOfFrames_x);
9526 praat_addAction1 (classDTW, 1, U"Get time step (x)", nullptr, 2,
9527 QUERY_ONE_FOR_REAL__DTW_getTimeStep_x);
9528 praat_addAction1 (classDTW, 1, U"Get time from frame number (x)...", nullptr, 2,
9529 QUERY_ONE_FOR_REAL__DTW_getTimeFromFrameNumber_x);
9530 praat_addAction1 (classDTW, 1, U"Get frame number from time (x)...", nullptr, 2,
9531 QUERY_ONE_FOR_INTEGER__DTW_getFrameNumberFromTime_x);
9532 praat_addAction1 (classDTW, 1, U"-- time sampling x from y separator --", nullptr, 2, 0);
9533 praat_addAction1 (classDTW, 1, U"Get number of frames (y)", nullptr, 2,
9534 QUERY_ONE_FOR_INTEGER__DTW_getNumberOfFrames_y);
9535 praat_addAction1 (classDTW, 1, U"Get time step (y)", nullptr, 2,
9536 QUERY_ONE_FOR_REAL__DTW_getTimeStep_y);
9537 praat_addAction1 (classDTW, 1, U"Get time from frame number (y)...", nullptr, 2,
9538 QUERY_ONE_FOR_REAL__DTW_getTimeFromFrameNumber_y);
9539 praat_addAction1 (classDTW, 1, U"Get frame number from time (y)...", nullptr, 2,
9540 QUERY_ONE_FOR_INTEGER__DTW_getFrameNumberFromTime_y);
9541
9542 praat_addAction1 (classDTW, 1, U"Get y time from x time...", nullptr, 1,
9543 QUERY_ONE_FOR_REAL__DTW_getYTimeFromXTime);
9544 praat_addAction1 (classDTW, 1, U"Get x time from y time...", nullptr, 1,
9545 QUERY_ONE_FOR_REAL__DTW_getXTimeFromYTime);
9546 praat_addAction1 (classDTW, 1, U"Get y time...", nullptr, GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
9547 QUERY_ONE_FOR_REAL__DTW_getYTimeFromXTime);
9548 praat_addAction1 (classDTW, 1, U"Get x time...", nullptr, GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
9549 QUERY_ONE_FOR_REAL__DTW_getXTimeFromYTime);
9550 praat_addAction1 (classDTW, 1, U"Get maximum consecutive steps...", nullptr, 1,
9551 QUERY_ONE_FOR_INTEGER__DTW_getMaximumConsecutiveSteps);
9552 praat_addAction1 (classDTW, 1, U"Get time along path...", nullptr, GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
9553 QUERY_ONE_FOR_REAL__DTW_getPathY);
9554 praat_addAction1 (classDTW, 1, U"-- distance queries --", nullptr, 1, 0);
9555 praat_addAction1 (classDTW, 1, U"Get distance value...", nullptr, 1,
9556 QUERY_ONE_FOR_REAL__DTW_getDistanceValue);
9557 praat_addAction1 (classDTW, 1, U"Get minimum distance", nullptr, 1,
9558 QUERY_ONE_FOR_REAL__DTW_getMinimumDistance);
9559 praat_addAction1 (classDTW, 1, U"Get maximum distance", nullptr, 1,
9560 QUERY_ONE_FOR_REAL__DTW_getMaximumDistance);
9561 praat_addAction1 (classDTW, 1, U"Get distance (weighted)", nullptr, 1,
9562 QUERY_ONE_FOR_REAL__DTW_getDistance_weighted);
9563 praat_addAction1 (classDTW, 0, U"Modify -", nullptr, 0, nullptr);
9564 praat_addAction1 (classDTW, 0, U"Formula (distances)...", nullptr, 1,
9565 MODIFY_DTW_formula_distances);
9566 praat_addAction1 (classDTW, 0, U"Set distance value...", nullptr, 1,
9567 MODIFY_DTW_setDistanceValue);
9568
9569 praat_addAction1 (classDTW, 0, U"Analyse", nullptr, 0, 0);
9570 praat_addAction1 (classDTW, 0, U"Find path...", nullptr, GuiMenu_HIDDEN,
9571 MODIFY_DTW_findPath);
9572 praat_addAction1 (classDTW, 0, U"Find path (band & slope)...", nullptr, 0,
9573 MODIFY_DTW_findPath_bandAndSlope);
9574 praat_addAction1 (classDTW, 0, U"To Polygon...", nullptr, 1,
9575 CONVERT_EACH_TO_ONE__DTW_to_Polygon);
9576 praat_addAction1 (classDTW, 0, U"To Matrix (distances)", nullptr, 0,
9577 CONVERT_EACH_TO_ONE__DTW_to_Matrix_distances);
9578 praat_addAction1 (classDTW, 0, U"To Matrix (cum. distances)...", nullptr, 0,
9579 CONVERT_EACH_TO_ONE__DTW_to_Matrix_cumulativeDistances);
9580 praat_addAction1 (classDTW, 0, U"Swap axes", nullptr, 0,
9581 CONVERT_EACH_TO_ONE__DTW_swapAxes);
9582
9583 praat_addAction2 (classDTW, 1, classMatrix, 1, U"Replace matrix", nullptr, 0,
9584 MODIFY_DTW_Matrix_replace);
9585 praat_addAction2 (classDTW, 1, classTextGrid, 1, U"To TextGrid (warp times)", nullptr, 0,
9586 CONVERT_ONE_AND_ONE_TO_ONE__DTW_TextGrid_to_TextGrid);
9587 praat_addAction2 (classDTW, 1, classIntervalTier, 1, U"To Table (distances)", nullptr, 0,
9588 CONVERT_ONE_AND_ONE_TO_ONE__DTW_IntervalTier_to_Table);
9589
9590 praat_addAction2 (classDTW, 1, classPolygon, 1, U"Find path inside...", nullptr, 0,
9591 MODIFY_DTW_Polygon_findPathInside);
9592 praat_addAction2 (classDTW, 1, classPolygon, 1, U"To Matrix (cum. distances)...", nullptr, 0,
9593 CONVERT_ONE_AND_ONE_TO_ONE__DTW_Polygon_to_Matrix_cumulativeDistances);
9594 praat_addAction2 (classDTW, 1, classSound, 2, U"Draw...", nullptr, 0,
9595 GRAPHICS_TWO_AND_ONE__DTW_Sounds_draw);
9596 praat_addAction2 (classDTW, 1, classSound, 2, U"Draw warp (x)...", nullptr, 0,
9597 GRAPHICS_TWO_AND_ONE__DTW_Sounds_drawWarp_x);
9598
9599 praat_addAction1 (classEditDistanceTable, 1, U"EditDistanceTable help", nullptr, 0,
9600 HELP__EditDistanceTable_help);
9601 praat_EditDistanceTable_as_TableOfReal_init (classEditDistanceTable);
9602 praat_addAction1 (classEditDistanceTable, 1, U"To TableOfReal (directions)...", nullptr, GuiMenu_HIDDEN,
9603 CONVERT_EACH_TO_ONE__EditDistanceTable_to_TableOfReal_directions);
9604 praat_addAction2 (classEditDistanceTable, 1, classEditCostsTable, 1, U"Set edit costs", nullptr, 0,
9605 MODIFY_EditDistanceTable_setEditCosts);
9606 praat_addAction2 (classEditDistanceTable, 1, classEditCostsTable, 1, U"Set new edit costs", nullptr, GuiMenu_DEPRECATED_2017,
9607 MODIFY_EditDistanceTable_setEditCosts);
9608
9609 praat_addAction1 (classEditCostsTable, 1, U"EditCostsTable help", nullptr, 0,
9610 HELP__EditCostsTable_help);
9611 praat_addAction1 (classEditCostsTable, 0, U"Query -", nullptr, 0, nullptr);
9612 praat_addAction1 (classEditCostsTable, 1, U"Get target index...", nullptr, 1,
9613 QUERY_ONE_FOR_INTEGER__EditCostsTable_getTargetIndex);
9614 praat_addAction1 (classEditCostsTable, 1, U"Get source index...", nullptr, 1,
9615 QUERY_ONE_FOR_INTEGER__EditCostsTable_getSourceIndex);
9616 praat_addAction1 (classEditCostsTable, 1, U"Get insertion costs...", nullptr, 1,
9617 QUERY_ONE_FOR_REAL__EditCostsTable_getInsertionCosts);
9618 praat_addAction1 (classEditCostsTable, 1, U"Get insertion cost...", nullptr, GuiMenu_DEPRECATED_2017,
9619 QUERY_ONE_FOR_REAL__EditCostsTable_getInsertionCosts);
9620 praat_addAction1 (classEditCostsTable, 1, U"Get deletion costs...", nullptr, 1,
9621 QUERY_ONE_FOR_REAL__EditCostsTable_getDeletionCost);
9622 praat_addAction1 (classEditCostsTable, 1, U"Get deletion cost...", nullptr, GuiMenu_DEPRECATED_2017,
9623 QUERY_ONE_FOR_REAL__EditCostsTable_getDeletionCost);
9624 praat_addAction1 (classEditCostsTable, 1, U"Get substitution costs...", nullptr, 1,
9625 QUERY_ONE_FOR_REAL__EditCostsTable_getSubstitutionCost);
9626 praat_addAction1 (classEditCostsTable, 1, U"Get substitution cost...", nullptr, GuiMenu_DEPRECATED_2017,
9627 QUERY_ONE_FOR_REAL__EditCostsTable_getSubstitutionCost);
9628 praat_addAction1 (classEditCostsTable, 1, U"Get costs (others)...", nullptr, 1,
9629 QUERY_ONE_FOR_REAL__EditCostsTable_getCosts_others);
9630 praat_addAction1 (classEditCostsTable, 1, U"Get cost (others)...", nullptr, GuiMenu_DEPRECATED_2017,
9631 QUERY_ONE_FOR_REAL__EditCostsTable_getCosts_others);
9632 praat_addAction1 (classEditCostsTable, 0, U"Modify -", nullptr, 0, nullptr);
9633 praat_addAction1 (classEditCostsTable, 1, U"Set target symbol (index)...", nullptr, 1,
9634 MODIFY_EditCostsTable_setTargetSymbol_index);
9635 praat_addAction1 (classEditCostsTable, 1, U"Set source symbol (index)...", nullptr, 1,
9636 MODIFY_EditCostsTable_setSourceSymbol_index);
9637 praat_addAction1 (classEditCostsTable, 1, U"Set insertion costs...", nullptr, 1,
9638 MODIFY_EditCostsTable_setInsertionCosts);
9639 praat_addAction1 (classEditCostsTable, 1, U"Set insertion cost...", nullptr, GuiMenu_DEPRECATED_2017,
9640 MODIFY_EditCostsTable_setInsertionCosts);
9641 praat_addAction1 (classEditCostsTable, 1, U"Set deletion costs...", nullptr, 1,
9642 MODIFY_EditCostsTable_setDeletionCosts);
9643 praat_addAction1 (classEditCostsTable, 1, U"Set substitution costs...", nullptr, 1,
9644 MODIFY_EditCostsTable_setSubstitutionCosts);
9645 praat_addAction1 (classEditCostsTable, 1, U"Set costs (others)...", nullptr, 1,
9646 MODIFY_EditCostsTable_setCosts_others);
9647 praat_addAction1 (classEditCostsTable, 1, U"To TableOfReal", nullptr, 0,
9648 CONVERT_EACH_TO_ONE__EditCostsTable_to_TableOfReal);
9649
9650 praat_addAction1 (classIndex, 0, U"Index help", nullptr, 0, HELP__Index_help);
9651 praat_addAction1 (classStringsIndex, 0, U"Query -", nullptr, 0, nullptr);
9652 praat_addAction1 (classStringsIndex, 1, U"Get number of classes", nullptr, 1,
9653 QUERY_ONE_FOR_INTEGER__Index_getNumberOfClasses);
9654 praat_addAction1 (classStringsIndex, 1, U"Get class label...", nullptr, 1,
9655 QUERY_ONE_FOR_STRING__StringsIndex_getClassLabelFromClassIndex);
9656 praat_addAction1 (classStringsIndex, 1, U"Get class index...", nullptr, 1,
9657 QUERY_ONE_FOR_INTEGER__StringsIndex_getClassIndex);
9658 praat_addAction1 (classStringsIndex, 1, U"Get item label...", nullptr, 1,
9659 QUERY_ONE_FOR_STRING__StringsIndex_getItemLabelFromItemIndex);
9660 praat_addAction1 (classStringsIndex, 1, U"Get class index from item index...", nullptr, 1,
9661 QUERY_ONE_FOR_INTEGER__StringsIndex_getClassIndexFromItemIndex);
9662 praat_addAction1 (classStringsIndex, 1, U"Get index...", nullptr, 1,
9663 QUERY_ONE_FOR_INTEGER__Index_getIndex);
9664 praat_addAction1 (classStringsIndex, 1, U"List all classes", nullptr, 1,
9665 QUERY_ONE_FOR_STRING_ARRAY__StringsIndex_listAllClasses);
9666 praat_addAction1 (classStringsIndex, 1, U"To Strings", nullptr, 0,
9667 CONVERT_EACH_TO_ONE__StringsIndex_to_Strings);
9668 praat_addAction1 (classStringsIndex, 1, U"To Permutation...", nullptr, 0,
9669 CONVERT_EACH_TO_ONE__Index_to_Permutation);
9670 praat_addAction1 (classStringsIndex, 1, U"Extract part...", nullptr, 0,
9671 CONVERT_EACH_TO_ONE__Index_extractPart);
9672
9673 praat_addAction1 (classEigen, 0, U"Eigen help", nullptr, 0,
9674 HELP__Eigen_help);
9675 praat_addAction1 (classEigen, 0, U"Draw -", nullptr, 0, nullptr);
9676 praat_Eigen_draw_init (classEigen);
9677 praat_addAction1 (classEigen, 0, U"Query -", nullptr, 0, nullptr);
9678 praat_addAction1 (classEigen, 1, U"Get number of eigenvalues", nullptr, 1,
9679 QUERY_ONE_FOR_INTEGER__Eigen_getNumberOfEigenvalues);
9680 praat_addAction1 (classEigen, 1, U"Get eigenvalue...", nullptr, 1,
9681 QUERY_ONE_FOR_REAL__Eigen_getEigenvalue);
9682 praat_addAction1 (classEigen, 1, U"List eigenvalues", nullptr, 1,
9683 QUERY_ONE_FOR_REAL_VECTOR__Eigen_listEigenvalues);
9684 praat_addAction1 (classEigen, 1, U"Get sum of eigenvalues...", nullptr, 1,
9685 QUERY_ONE_FOR_REAL__Eigen_getSumOfEigenvalues);
9686 praat_addAction1 (classEigen, 1, U"-- eigenvectors --", nullptr, 1, 0);
9687 praat_addAction1 (classEigen, 1, U"Get number of eigenvectors", nullptr, 1,
9688 QUERY_ONE_FOR_INTEGER__Eigen_getNumberOfEigenvectors);
9689 praat_addAction1 (classEigen, 1, U"Get eigenvector dimension", nullptr, 1,
9690 QUERY_ONE_FOR_INTEGER__Eigen_getEigenvectorDimension);
9691 praat_addAction1 (classEigen, 1, U"Get eigenvector element...", nullptr, 1,
9692 QUERY_ONE_FOR_REAL__Eigen_getEigenvectorElement);
9693 praat_addAction1 (classEigen, 1, U"Get eigenvector...", nullptr, 1,
9694 QUERY_ONE_FOR_REAL_VECTOR__Eigen_getEigenvector);
9695 praat_addAction1 (classEigen, 1, U"-- imaginary part --", nullptr, 1, nullptr);
9696 praat_addAction1 (classEigen, 1, U"Are all eigenvalues real?", nullptr, 1,
9697 QUERY_ONE_FOR_BOOLEAN__Eigen_areAllEigenvaluesReal);
9698 praat_addAction1 (classEigen, 1, U"Get eigenvector (imag)...", nullptr, 1,
9699 QUERY_ONE_FOR_REAL_VECTOR__Eigen_getEigenvector_imag);
9700 praat_addAction1 (classEigen, 1, U"List eigenvalues (imag)", nullptr, 1,
9701 QUERY_ONE_FOR_REAL_VECTOR__Eigen_listEigenvalues_imag);
9702 praat_addAction1 (classEigen, 0, U"Modify -", nullptr, 0, nullptr);
9703 praat_addAction1 (classEigen, 1, U"Sort...", nullptr, 1,
9704 MODIFY__Eigen_sort);
9705 praat_addAction1 (classEigen, 1, U"Invert eigenvector...", nullptr, 1,
9706 MODIFY__Eigen_invertEigenvector);
9707 praat_addAction1 (classExcitation, 0, U"Synthesize", U"To Formant...", 0, 0);
9708 praat_addAction1 (classExcitation, 0, U"To ExcitationList", U"Synthesize", 0,
9709 COMBINE_ALL_TO_ONE__Excitations_to_ExcitationList);
9710 praat_addAction1 (classExcitation, 0, U"To Excitations", U"Synthesize", GuiMenu_DEPRECATED_2015,
9711 COMBINE_ALL_TO_ONE__Excitations_to_ExcitationList);
9712
9713 praat_addAction1 (classExcitationList, 0, U"Modify", nullptr, 0, 0);
9714 praat_addAction1 (classExcitationList, 0, U"Formula...", nullptr, 0,
9715 MODIFY_ExcitationList_formula);
9716 praat_addAction1 (classExcitationList, 0, U"Extract", nullptr, 0, 0);
9717 praat_addAction1 (classExcitationList, 0, U"Extract Excitation...", nullptr, 0,
9718 CONVERT_EACH_TO_ONE__ExcitationList_extractItem);
9719 praat_addAction1 (classExcitationList, 0, U"Synthesize", nullptr, 0, 0);
9720 praat_addAction1 (classExcitationList, 2, U"Append", nullptr, 0,
9721 CONVERT_TWO_TO_ONE__ExcitationList_append);
9722 praat_addAction1 (classExcitationList, 0, U"Convert", nullptr, 0, 0);
9723 praat_addAction1 (classExcitationList, 0, U"To PatternList...", nullptr, 0,
9724 CONVERT_EACH_TO_ONE__ExcitationList_to_PatternList);
9725 praat_addAction1 (classExcitationList, 0, U"To Pattern...", nullptr, GuiMenu_HIDDEN,
9726 CONVERT_EACH_TO_ONE__ExcitationList_to_PatternList);
9727 praat_addAction1 (classExcitationList, 0, U"To TableOfReal", nullptr, 0,
9728 CONVERT_EACH_TO_ONE__ExcitationList_to_TableOfReal);
9729
9730 praat_addAction2 (classExcitationList, 1, classExcitation, 0, U"Add to ExcitationList", nullptr, 0,
9731 MODIFY_ExcitationList_addItem);
9732 praat_addAction2 (classExcitationList, 1, classExcitation, 0, U"Add to Excitations", nullptr, GuiMenu_HIDDEN,
9733 MODIFY_ExcitationList_addItem);
9734
9735 praat_addAction1 (classFileInMemory, 1, U"Show as code...", nullptr, 0,
9736 INFO_ONE__FileInMemory_showAsCode);
9737 praat_addAction1 (classFileInMemory, 0, U"To FileInMemorySet", nullptr, 0,
9738 COMBINE_ALL_TO_ONE__FilesInMemory_to_FileInMemorySet);
9739 praat_addAction1 (classFileInMemory, 0, U"To FilesInMemory", nullptr, GuiMenu_DEPRECATED_2015,
9740 COMBINE_ALL_TO_ONE__FilesInMemory_to_FileInMemorySet);
9741
9742 praat_addAction1 (classFileInMemorySet, 1, U"Query -", nullptr, 0, nullptr);
9743 praat_addAction1 (classFileInMemorySet, 1, U"Get number of files", nullptr, 1,
9744 QUERY_ONE_FOR_INTEGER__FileInMemorySet_getNumberOfFiles);
9745 //praat_addAction1 (classFileInMemorySet, 1, U"Get number of open files", nullptr, 1,
9746 // QUERY_ONE_FOR_INTEGER__classFileInMemorySet_getNumberOfOpenFiles);
9747 praat_addAction1 (classFileInMemorySet, 1, U"Has directory?", nullptr, 1,
9748 QUERY_ONE_FOR_BOOLEAN__FileInMemorySet_hasDirectory);
9749 praat_addAction1 (classFileInMemorySet, 1, U"Show as code...", nullptr, 0,
9750 INFO_ONE__FileInMemorySet_showAsCode);
9751 praat_addAction1 (classFileInMemorySet, 1, U"Show one file as code...", nullptr, 0,
9752 INFO_ONE__FileInMemorySet_showOneFileAsCode);
9753 praat_addAction1 (classFileInMemorySet, 0, U"Merge", nullptr, 0,
9754 COMBINE_ALL_TO_ONE__FileInMemorySets_merge);
9755 praat_addAction1 (classFileInMemorySet, 0, U"To Strings (path)", nullptr, 0,
9756 CONVERT_EACH_TO_ONE__FileInMemorySet_to_Strings_path);
9757 praat_addAction1 (classFileInMemorySet, 0, U"Extract files...", nullptr, 0,
9758 CONVERT_EACH_TO_ONE__FileInMemorySet_extractFiles);
9759 praat_addAction1 (classFileInMemorySet, 0, U"Remove files...", nullptr, 0,
9760 CONVERT_EACH_TO_ONE__FileInMemorySet_removeFiles);
9761 praat_addAction2 (classFileInMemorySet, 1, classFileInMemory, 0, U"Add items to set", nullptr, 0,
9762 MODIFY_FIRST_OF_ONE_AND_ONE__FileInMemorySet_addItemsToSet);
9763 praat_addAction1 (classFileInMemorySet, 0, U"Down to Table...", nullptr, 0,
9764 CONVERT_EACH_TO_ONE__FileInMemorySet_downto_Table);
9765
9766 praat_addAction1 (classFormantFilter, 0, U"FormantFilter help", nullptr, GuiMenu_DEPRECATED_2015,
9767 HELP__FormantFilter_help);
9768 praat_FilterBank_all_init (classFormantFilter);
9769 praat_addAction1 (classFormantFilter, 0, U"Draw spectrum (slice)...", U"Draw filters...", GuiMenu_DEPTH_1 | GuiMenu_DEPRECATED_2014,
9770 GRAPHICS_EACH__FormantFilter_drawSpectrum_slice);
9771 praat_addAction1 (classFormantFilter, 0, U"Draw filter functions...", U"Draw filters...", GuiMenu_DEPTH_1 | GuiMenu_DEPRECATED_2014,
9772 GRAPHICS_EACH__FormantFilter_drawFilterFunctions);
9773 praat_addAction1 (classFormantFilter, 0, U"To Spectrogram", nullptr, 0,
9774 CONVERT_EACH_TO_ONE__FormantFilter_to_Spectrogram);
9775
9776 praat_addAction1 (classFormantGrid, 0, U"Draw...", U"Edit", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
9777 GRAPHICS_EACH__FormantGrid_draw);
9778
9779 praat_addAction1 (classIntensity, 0, U"To TextGrid (silences)...", U"To IntensityTier (valleys)", 0,
9780 CONVERT_EACH_TO_ONE__Intensity_to_TextGrid_silences);
9781 praat_addAction1 (classIntensity, 0, U"Get nearest level crossing...", U"Get time of maximum...", 1,
9782 QUERY_ONE_FOR_REAL__Intensity_getNearestLevelCrossing);
9783 praat_addAction1 (classIntensityTier, 0, U"To TextGrid (silences)...", nullptr, 0,
9784 CONVERT_EACH_TO_ONE__IntensityTier_to_TextGrid_silences);
9785 praat_addAction1 (classIntensityTier, 0, U"To Intensity...", nullptr, GuiMenu_HIDDEN,
9786 CONVERT_EACH_TO_ONE__IntensityTier_to_Intensity);
9787
9788 praat_addAction1 (classISpline, 0, U"ISpline help", nullptr, 0,
9789 HELP__ISpline_help);
9790 praat_Spline_init (classISpline);
9791
9792 praat_addAction1 (classKlattTable, 0, U"KlattTable help", nullptr, 0,
9793 HELP__KlattTable_help);
9794 praat_addAction1 (classKlattTable, 0, U"To Sound...", nullptr, 0,
9795 CONVERT_EACH_TO_ONE__KlattTable_to_Sound);
9796 praat_addAction1 (classKlattTable, 0, U"To KlattGrid...", nullptr, 0,
9797 CONVERT_EACH_TO_ONE__KlattTable_to_KlattGrid);
9798 praat_addAction1 (classKlattTable, 0, U"To Table", nullptr, 0,
9799 CONVERT_EACH_TO_ONE__KlattTable_to_Table);
9800
9801 praat_addAction1 (classLegendreSeries, 0, U"LegendreSeries help", nullptr, 0,
9802 HELP__LegendreSeries_help);
9803 praat_FunctionSeries_init (classLegendreSeries);
9804 praat_addAction1 (classLegendreSeries, 0, U"To Polynomial", U"Analyse", 0,
9805 CONVERT_EACH_TO_ONE__LegendreSeries_to_Polynomial);
9806
9807 praat_addAction1 (classLongSound, 0, U"Append to existing sound file...", nullptr, 0,
9808 APPEND_ALL__LongSounds_appendToExistingSoundFile);
9809 praat_addAction1 (classSound, 0, U"Append to existing sound file...", nullptr, 0,
9810 APPEND_ALL__LongSounds_appendToExistingSoundFile);
9811 praat_addAction2 (classLongSound, 0, classSound, 0, U"Append to existing sound file...", nullptr, 0,
9812 APPEND_ALL__LongSounds_appendToExistingSoundFile);
9813
9814 praat_addAction1 (classLongSound, 2, U"Save as stereo AIFF file...", U"Save as NIST file...", 1,
9815 SAVE_TWO__LongSounds_saveAsStereoAiffFile);
9816 praat_addAction1 (classLongSound, 2, U"Write to stereo AIFF file...", U"Write to NIST file...", GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
9817 SAVE_TWO__LongSounds_saveAsStereoAiffFile);
9818 praat_addAction1 (classLongSound, 2, U"Save as stereo AIFC file...", U"Save as stereo AIFF file...", 1,
9819 SAVE_TWO__LongSounds_saveAsStereoAifcFile);
9820 praat_addAction1 (classLongSound, 2, U"Write to stereo AIFC file...", U"Write to stereo AIFF file...", GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
9821 SAVE_TWO__LongSounds_saveAsStereoAifcFile);
9822 praat_addAction1 (classLongSound, 2, U"Save as stereo WAV file...", U"Save as stereo AIFC file...", 1,
9823 SAVE_TWO__LongSounds_saveAsStereoWavFile);
9824 praat_addAction1 (classLongSound, 2, U"Write to stereo WAV file...", U"Write to stereo AIFC file...", GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
9825 SAVE_TWO__LongSounds_saveAsStereoWavFile);
9826 praat_addAction1 (classLongSound, 2, U"Save as stereo NeXT/Sun file...", U"Save as stereo WAV file...", 1,
9827 SAVE_TWO__LongSounds_saveAsStereoNextSunFile);
9828 praat_addAction1 (classLongSound, 2, U"Write to stereo NeXT/Sun file...", U"Write to stereo WAV file...", GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
9829 SAVE_TWO__LongSounds_saveAsStereoNextSunFile);
9830 praat_addAction1 (classLongSound, 2, U"Save as stereo NIST file...", U"Save as stereo NeXT/Sun file...", 1,
9831 SAVE_TWO__LongSounds_saveAsStereoNistFile);
9832 praat_addAction1 (classLongSound, 2, U"Write to stereo NIST file...", U"Write to stereo NeXT/Sun file...", GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
9833 SAVE_TWO__LongSounds_saveAsStereoNistFile);
9834
9835 praat_addAction1 (classLtas, 0, U"Report spectral trend...", U"Get slope...", 1, INFO_ONE__Ltas_reportSpectralTrend);
9836 praat_addAction1 (classLtas, 0, U"Report spectral tilt...", U"Get slope...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
9837 INFO_ONE__Ltas_reportSpectralTrend);
9838
9839 praat_addAction1 (classMatrix, 0, U"Scatter plot...", U"Paint cells...", 1,
9840 GRAPHICS_EACH__Matrix_scatterPlot);
9841 praat_addAction1 (classMatrix, 0, U"Draw as squares...", U"Scatter plot...", 1,
9842 GRAPHICS_EACH__Matrix_drawAsSquares);
9843 praat_addAction1 (classMatrix, 0, U"Draw distribution...", U"Draw as squares...", 1,
9844 GRAPHICS_EACH__Matrix_drawDistribution);
9845 praat_addAction1 (classMatrix, 0, U"Draw cumulative distribution...", U"Draw distribution...", 1,
9846 GRAPHICS_EACH__Matrix_drawCumulativeDistribution);
9847 praat_addAction1 (classMatrix, 0, U"Get mean...", U"Get sum", 1,
9848 QUERY_ONE_FOR_REAL__Matrix_getMean);
9849 praat_addAction1 (classMatrix, 0, U"Get standard deviation...", U"Get mean...", 1,
9850 QUERY_ONE_FOR_REAL__Matrix_getStandardDeviation);
9851 praat_addAction1 (classMatrix, 0, U"Mathematical", U"Get standard deviation...", 1, nullptr);
9852 praat_addAction1 (classMatrix, 0, U"Get norm...", U"Mathematical", 2,
9853 QUERY_ONE_FOR_REAL__Matrix_getNorm);
9854
9855 praat_addAction1 (classMatrix, 0, U"Transpose", U"Synthesize", 0,
9856 CONVERT_EACH_TO_ONE__Matrix_transpose);
9857 praat_addAction1 (classMatrix, 0, U"Solve equation...", U"Analyse", 0,
9858 CONVERT_EACH_TO_ONE__Matrix_solveEquation);
9859 praat_addAction1 (classMatrix, 2, U"Solve matrix equation...", U"Solve equation...", 0,
9860 CONVERT_TWO_TO_ONE__Matrix_solveMatrixEquation);
9861 praat_addAction1 (classMatrix, 0, U"To PCA (by rows)", U"Solve matrix equation...", 0,
9862 CONVERT_EACH_TO_ONE__Matrix_to_PCA_byRows);
9863 praat_addAction1 (classMatrix, 0, U"To PCA (by columns)", U"To PCA (by rows)", 0,
9864 CONVERT_EACH_TO_ONE__Matrix_to_PCA_byColumns);
9865 praat_addAction1 (classMatrix, 0, U"To PatternList... || To Pattern...",
9866 U"To VocalTract", 1, CONVERT_EACH_TO_ONE__Matrix_to_PatternList);
9867 praat_addAction1 (classMatrix, 0, U"To ActivationList || To Activation",
9868 U"To PatternList...", 1, CONVERT_EACH_TO_ONE__Matrix_to_ActivationList);
9869 praat_addAction1 (classMatrix, 0, U"To Eigen", U"Eigen", GuiMenu_DEPRECATED_2026,
9870 CONVERT_EACH_TO_ONE__Matrix_to_Eigen);
9871 praat_addAction1 (classMatrix, 0, U"To Eigen (special)...", U"Eigen", GuiMenu_HIDDEN,
9872 CONVERT_EACH_TO_ONE__Matrix_to_Eigen_special);
9873 praat_addAction1 (classMatrix, 0, U"To SVD", U"To Eigen", GuiMenu_HIDDEN,
9874 CONVERT_EACH_TO_ONE__Matrix_to_SVD);
9875 praat_addAction1 (classMatrix, 0, U"To NMF (m.u.)...", U"To SVD", GuiMenu_HIDDEN,
9876 CONVERT_EACH_TO_ONE__Matrix_to_NMF_mu);
9877 praat_addAction1 (classMatrix, 0, U"To NMF (ALS)...", U"To SVD", GuiMenu_HIDDEN,
9878 CONVERT_EACH_TO_ONE__Matrix_to_NMF_als);
9879 praat_addAction1 (classMatrix, 0, U"To NMF (IS)...", U"To SVD", GuiMenu_HIDDEN,
9880 CONVERT_EACH_TO_ONE__Matrix_to_NMF_is);
9881 praat_addAction1 (classMatrix, 0, U"Eigen (complex)", U"Eigen", GuiMenu_HIDDEN,
9882 CONVERT_EACH_TO_MULTIPLE_Matrix_eigen_complex);
9883 praat_addAction1 (classMatrix, 2, U"To DTW...", U"To ParamCurve", 1,
9884 CONVERT_TWO_TO_ONE__Matrices_to_DTW);
9885
9886 praat_addAction2 (classMatrix, 1, classCategories, 1, U"To TableOfReal", nullptr, 0,
9887 CONVERT_ONE_AND_ONE_TO_ONE__Matrix_Categories_to_TableOfReal);
9888
9889 praat_addAction1 (classMelSpectrogram, 0, U"MelSpectrogram help", nullptr, 0,
9890 HELP__MelSpectrogram_help);
9891 praat_addAction1 (classMelSpectrogram, 0, U"Draw -", nullptr, 0, nullptr);
9892 praat_addAction1 (classMelSpectrogram, 0, U"Draw frequency scale...", nullptr, 1,
9893 GRAPHICS_EACH__MelSpectrogram_drawFrequencyScale);
9894 praat_addAction1 (classMelSpectrogram, 0, U"Paint image...", nullptr, 1,
9895 GRAPHICS_EACH__MelSpectrogram_paintImage);
9896 praat_addAction1 (classMelSpectrogram, 0, U"Draw triangular filter functions...", nullptr, 1,
9897 GRAPHICS_EACH__MelSpectrogram_drawTriangularFilterFunctions);
9898 praat_addAction1 (classMelSpectrogram, 0, U"Draw spectrum at nearest time slice...", nullptr, 1,
9899 GRAPHICS_EACH__MelSpectrogram_drawSpectrumAtNearestTimeSlice);
9900 praat_addAction1 (classMelSpectrogram, 0, U"Query -", nullptr, 0, nullptr);
9901 praat_BandFilterSpectrogram_query_init (classMelSpectrogram);
9902
9903 praat_addAction1 (classMelSpectrogram, 0, U"Equalize intensities...", nullptr, 0,
9904 MODIFY_EACH__BandFilterSpectrogram_equalizeIntensities);
9905 praat_addAction1 (classMelSpectrogram, 0, U"To MFCC...", nullptr, 0,
9906 CONVERT_EACH_TO_ONE__MelSpectrogram_to_MFCC);
9907 praat_addAction1 (classMelSpectrogram, 0, U"To Intensity", nullptr, 0,
9908 CONVERT_EACH_TO_ONE__BandFilterSpectrogram_to_Intensity);
9909 praat_addAction1 (classMelSpectrogram, 0, U"To Matrix...", nullptr, 0,
9910 CONVERT_EACH_TO_ONE__BandFilterSpectrogram_to_Matrix);
9911 praat_addAction1 (classMelSpectrogram, 2, U"Cross-correlate...", nullptr, 0,
9912 CONVERT_TWO_TO_ONE__BandFilterSpectrograms_crossCorrelate);
9913 praat_addAction1 (classMelSpectrogram, 2, U"Convolve...", nullptr, 0,
9914 CONVERT_TWO_TO_ONE__BandFilterSpectrograms_convolve);
9915
9916 praat_addAction1 (classMelFilter, 0, U"MelFilter help", nullptr, 0,
9917 HELP__MelFilter_help); //
9918 praat_FilterBank_all_init (classMelFilter); // deprecated 2014
9919 praat_addAction1 (classMelFilter, 0, U"Draw spectrum (slice)...", U"Draw filters...", GuiMenu_DEPTH_1 | GuiMenu_DEPRECATED_2014,
9920 GRAPHICS_EACH__MelFilter_drawSpectrum);
9921 praat_addAction1 (classMelFilter, 0, U"Draw filter functions...", U"Draw filters...", GuiMenu_DEPTH_1 | GuiMenu_DEPRECATED_2014,
9922 GRAPHICS_EACH__MelFilter_drawFilterFunctions);
9923 praat_addAction1 (classMelFilter, 0, U"Paint...", U"Draw filter functions...", GuiMenu_DEPTH_1 | GuiMenu_DEPRECATED_2014,
9924 GRAPHICS_EACH__MelFilter_paint);
9925 praat_addAction1 (classMelFilter, 0, U"To MFCC...", nullptr, GuiMenu_DEPRECATED_2014,
9926 CONVERT_EACH_TO_ONE__MelFilter_to_MFCC);
9927 praat_addAction1 (classMelFilter, 0, U"To MelSpectrogram", nullptr, 0,
9928 CONVERT_EACH_TO_ONE__MelFilter_to_MelSpectrogram);
9929
9930 praat_addAction1 (classMFCC, 0, U"MFCC help", nullptr, 0, HELP__MFCC_help);
9931 praat_CC_init (classMFCC);
9932 praat_addAction1 (classMFCC, 0, U"To MelFilter...", nullptr, GuiMenu_DEPRECATED_2014,
9933 CONVERT_EACH_TO_ONE__MFCC_to_MelFilter);
9934 praat_addAction1 (classMFCC, 0, U"To MelSpectrogram...", nullptr, 0,
9935 CONVERT_EACH_TO_ONE__MFCC_to_MelSpectrogram);
9936 praat_addAction1 (classMFCC, 0, U"To TableOfReal...", nullptr, 0,
9937 CONVERT_EACH_TO_ONE__MFCC_to_TableOfReal);
9938 praat_addAction1 (classMFCC, 0, U"To Matrix (features)...", nullptr, GuiMenu_HIDDEN,
9939 CONVERT_EACH_TO_ONE__MFCC_to_Matrix_features);
9940 praat_addAction1 (classMFCC, 0, U"To Sound", nullptr, GuiMenu_HIDDEN,
9941 CONVERT_EACH_TO_ONE__MFCC_to_Sound);
9942 praat_addAction1 (classMFCC, 2, U"Cross-correlate...", nullptr, 0,
9943 CONVERT_TWO_TO_ONE__MFCCs_crossCorrelate);
9944 praat_addAction1 (classMFCC, 2, U"Convolve...", nullptr, 0,
9945 CONVERT_TWO_TO_ONE__MFCCs_convolve);
9946
9947 praat_addAction1 (classMSpline, 0, U"MSpline help", nullptr, 0,
9948 HELP__MSpline_help);
9949 praat_Spline_init (classMSpline);
9950
9951 praat_addAction1 (classNavigationContext, 0, U"Modify use criterion...", nullptr, 0,
9952 MODIFY_EACH__NavigationContext_modifyUseCriterion);
9953 praat_addAction1 (classNavigationContext, 0, U"Modify Topic match criterion...", nullptr, 0,
9954 MODIFY_EACH__NavigationContext_modifyTopicCriterion);
9955 praat_addAction1 (classNavigationContext, 0, U"Modify Before match criterion...", nullptr, 0,
9956 MODIFY_EACH__NavigationContext_modifyBeforeCriterion);
9957 praat_addAction1 (classNavigationContext, 0, U"Modify After match criterion...", nullptr, 0,
9958 MODIFY_EACH__NavigationContext_modifyAfterCriterion);
9959 praat_addAction2 (classNavigationContext, 1, classStrings, 1, U"Replace Topic labels", nullptr, 0,
9960 MODIFY_FIRST_OF_ONE_AND_ONE__NavigationContext_replaceTopicLabels);
9961 praat_addAction2 (classNavigationContext, 1, classStrings, 1, U"Replace Before labels", nullptr, 0,
9962 MODIFY_FIRST_OF_ONE_AND_ONE__NavigationContext_replaceBeforeLabels);
9963 praat_addAction2 (classNavigationContext, 1, classStrings, 1, U"Replace After labels", nullptr, 0,
9964 MODIFY_FIRST_OF_ONE_AND_ONE__NavigationContext_replaceAfterLabels);
9965
9966 praat_addAction1 (classNMF, 0, U"NMF help", nullptr, 0,
9967 HELP__NMF_help);
9968 praat_addAction1 (classNMF, 0, U"Paint features...", nullptr, 0,
9969 GRAPHICS_EACH__NMF_paintFeatures);
9970 praat_addAction1 (classNMF, 0, U"Paint weights...", nullptr, 0,
9971 GRAPHICS_EACH__NMF_paintWeights);
9972 praat_addAction1 (classNMF, 0, U"To Matrix", nullptr, 0,
9973 CONVERT_EACH_TO_ONE__NMF_to_Matrix);
9974
9975 praat_addAction2 (classNMF, 1, classMatrix, 1, U"Get Euclidean distance", nullptr, 0,
9976 QUERY_ONE_AND_ONE_FOR_REAL__NMF_Matrix_getEuclideanDistance);
9977 praat_addAction2 (classNMF, 1, classMatrix, 1, U"Get Itakura-Saito distance", nullptr, 0,
9978 QUERY_ONE_AND_ONE_FOR_REAL__NMF_Matrix_getItakuraSaitoDivergence);
9979 praat_addAction2 (classNMF, 1, classMatrix, 1, U"Improve factorization (ALS)...", nullptr, 0,
9980 MODIFY_FIRST_OF_ONE_AND_ONE__NMF_Matrix_improveFactorization_als);
9981 praat_addAction2 (classNMF, 1, classMatrix, 1, U"Improve factorization (m.u.)...", nullptr, 0,
9982 MODIFY_FIRST_OF_ONE_AND_ONE__NMF_Matrix_improveFactorization_mu);
9983 praat_addAction2 (classNMF, 1, classMatrix, 1, U"Improve factorization (IS)...", nullptr, 0,
9984 MODIFY_FIRST_OF_ONE_AND_ONE__NMF_Matrix_improveFactorization_is);
9985
9986 praat_addAction1 (classPatternList, 0, U"Draw", nullptr, 0, 0);
9987 praat_addAction1 (classPatternList, 0, U"Draw...", nullptr, 0,
9988 GRAPHICS_EACH__PatternList_draw);
9989 praat_PatternList_query_init (classPatternList);
9990 praat_addAction1 (classPatternList, 0, U"Modify -", nullptr, 0, nullptr);
9991 praat_addAction1 (classPatternList, 0, U"Formula...", nullptr, 1,
9992 MODIFY_PatternList_formula);
9993 praat_addAction1 (classPatternList, 0, U"Set value...", nullptr, 1,
9994 MODIFY_PatternList_setValue);
9995 praat_addAction1 (classPatternList, 0, U"Get all values", nullptr, 0,
9996 NUMMAT_PatternList_getAllValues);
9997 praat_addAction1 (classPatternList, 0, U"To Matrix", nullptr, 0,
9998 CONVERT_EACH_TO_ONE__PatternList_to_Matrix);
9999
10000 praat_addAction2 (classPatternList, 1, classCategories, 1, U"To TableOfReal", nullptr, 0,
10001 CONVERT_ONE_AND_ONE_TO_ONE__Matrix_Categories_to_TableOfReal);
10002 praat_addAction2 (classPatternList, 1, classCategories, 1, U"To Discriminant", nullptr, 0,
10003 CONVERT_ONE_AND_ONE__TO_ONE_PatternList_Categories_to_Discriminant);
10004
10005 praat_addAction1 (classPCA, 0, U"PCA help", nullptr, 0,
10006 HELP__PCA_help);
10007 praat_addAction1 (classPCA, 0, U"Draw -", nullptr, 0, nullptr);
10008 praat_Eigen_draw_init (classPCA);
10009 praat_addAction1 (classPCA, 0, U"Query -", nullptr, 0, nullptr);
10010 praat_Eigen_query_init (classPCA);
10011 praat_addAction1 (classPCA, 1, U"-- pca --", nullptr, 1, 0);
10012 praat_addAction1 (classPCA, 1, U"Get centroid element...", nullptr, 1,
10013 QUERY_ONE_FOR_REAL__PCA_getCentroidElement);
10014 praat_addAction1 (classPCA, 1, U"Get equality of eigenvalues...", nullptr, 1,
10015 QUERY_ONE_FOR_REAL__PCA_getEqualityOfEigenvalues);
10016 praat_addAction1 (classPCA, 1, U"Get fraction variance accounted for...", nullptr, 1,
10017 QUERY_ONE_FOR_REAL__PCA_getFractionVAF);
10018 praat_addAction1 (classPCA, 1, U"Get number of components (VAF)...", nullptr, 1,
10019 QUERY_ONE_FOR_INTEGER__PCA_getNumberOfComponents_VAF);
10020 praat_addAction1 (classPCA, 2, U"Get angle between pc1-pc2 planes", nullptr, 1,
10021 QUERY_TWO_FOR_REAL__PCAs_getAngleBetweenPc1Pc2Plane_degrees);
10022 praat_addAction1 (classPCA, 0, U"Modify -", nullptr, 0, nullptr);
10023 praat_addAction1 (classPCA, 1, U"Invert eigenvector...", nullptr, 1,
10024 MODIFY_PCA_invertEigenvector);
10025 praat_addAction1 (classPCA, 0, U"Align eigenvectors", nullptr, 1,
10026 MODIFY_ALL__Eigens_alignEigenvectors);
10027 praat_addAction1 (classPCA, 0, U"Extract -", nullptr, 0, 0);
10028 praat_addAction1 (classPCA, 0, U"Extract eigenvector...", nullptr, 1,
10029 CONVERT_EACH_TO_ONE__PCA_extractEigenvector);
10030 praat_addAction1 (classPCA, 0, U"Extract Eigen", nullptr, 1,
10031 CONVERT_EACH_TO_ONE__PCA_extractEigen);
10032 praat_addAction1 (classPCA, 2, U"To Procrustes...", nullptr, 0,
10033 CONVERT_TWO_TO_ONE__PCAs_to_Procrustes);
10034 praat_addAction1 (classPCA, 0, U"To TableOfReal (reconstruct 1)...", nullptr, 0,
10035 CONVERT_EACH_TO_ONE__PCA_to_TableOfReal_reconstruct1);
10036
10037 praat_addAction1 (classPCA, 0, U"& TableOfReal: To Configuration?",
10038 nullptr, GuiMenu_NO_API, HINT__hint_PCA_TableOfReal_to_Configuration);
10039 praat_addAction1 (classPCA, 0, U"& Configuration (reconstruct)?",
10040 nullptr, GuiMenu_NO_API, HINT_hint__PCA_Configuration_to_TableOfReal_reconstruct);
10041 praat_addAction1 (classPCA, 0, U"& Covariance: Project?",
10042 nullptr, GuiMenu_NO_API, HINT_hint__PCA_Covariance_Project);
10043 praat_addAction2 (classPCA, 1, classConfiguration, 1, U"To TableOfReal (reconstruct)",
10044 nullptr, 0, CONVERT_ONE_AND_ONE_TO_ONE__PCA_Configuration_to_TableOfReal_reconstruct);
10045 praat_addAction2 (classPCA, 1, classMatrix, 1, U"To Matrix (project rows)...",
10046 nullptr, 0, CONVERT_ONE_AND_ONE_TO_ONE__PCA_Matrix_to_Matrix_projectRows);
10047 praat_addAction2 (classPCA, 1, classMatrix, 1, U"To Matrix (project columns)... || To Matrix (pc)...",
10048 nullptr, 0, CONVERT_ONE_AND_ONE_GENERIC_TO_ONE__Matrix_to_Matrix_projectColumns);
10049 praat_addAction2 (classPCA, 1, classPatternList, 1, U"To Matrix (project rows)...",
10050 nullptr, 0, CONVERT_ONE_AND_ONE_TO_ONE__PCA_Matrix_to_Matrix_projectRows);
10051 praat_addAction2 (classPCA, 1, classSSCP, 1, U"Project",
10052 nullptr, 0, CONVERT_ONE_AND_ONE_TO_ONE__PCA_SSCP_project);
10053 praat_addAction2 (classPCA, 1, classTableOfReal, 1, U"To TableOfReal (project rows)... || To TableOfReal...",
10054 nullptr, 0, CONVERT_ONE_AND_ONE_TO_ONE__PCA_TableOfReal_to_TableOfReal_projectRows); // alternative GuiMenu_DEPRECATED_2016
10055 praat_addAction2 (classPCA, 1, classTableOfReal, 1, U"To Configuration...",
10056 nullptr, 0, CONVERT_ONE_AND_ONE_GENERIC_TO_ONE__PCA_TableOfReal_to_Configuration);
10057 praat_addAction2 (classPCA, 1, classTableOfReal, 1, U"To TableOfReal (z-scores)...",
10058 nullptr, 0, CONVERT_ONE_AND_ONE_GENERIC_TO_ONE__PCA_TableOfReal_to_TableOfReal_zscores);
10059 praat_addAction2 (classPCA, 1, classTableOfReal, 1, U"Get fraction variance...",
10060 nullptr, 0, QUERY_ONE_AND_ONE_FOR_REAL__PCA_TableOfReal_getFractionVariance);
10061 praat_addAction2 (classPCA, 1, classCovariance, 1, U"Project",
10062 nullptr, 0, CONVERT_ONE_AND_ONE_TO_ONE__Eigen_Covariance_project);
10063
10064 praat_Eigen_Spectrogram_project (classPCA, classSpectrogram);
10065 praat_Eigen_Spectrogram_project (classPCA, classBarkSpectrogram);
10066 praat_Eigen_Spectrogram_project (classPCA, classMelSpectrogram);
10067
10068 praat_Eigen_Matrix_project (classPCA, classFormantFilter); // deprecated 2014
10069 praat_Eigen_Matrix_project (classPCA, classBarkFilter); // deprecated 2014
10070 praat_Eigen_Matrix_project (classPCA, classMelFilter); // deprecated 2014
10071
10072 praat_addAction1 (classPermutation, 0, U"Permutation help",
10073 nullptr, 0, HELP__Permutation_help);
10074 praat_addAction1 (classPermutation, 0, U"Draw as line...",
10075 nullptr, 0, GRAPHICS_EACH__Permutation_drawAsLine);
10076 praat_addAction1 (classPermutation, 0, U"Query -", nullptr, 0, nullptr);
10077 praat_addAction1 (classPermutation, 1, U"Get number of elements",
10078 nullptr, 1, QUERY_ONE_FOR_INTEGER__Permutation_getNumberOfElements);
10079 praat_addAction1 (classPermutation, 1, U"Get value...",
10080 nullptr, 1, QUERY_ONE_FOR_INTEGER__Permutation_getValueAtIndex);
10081 praat_addAction1 (classPermutation, 1, U"List values",
10082 nullptr, 1, QUERY_ONE_FOR_REAL_VECTOR__Permutation_listValues);
10083 praat_addAction1 (classPermutation, 1, U"Get index...",
10084 nullptr, 1, QUERY_ONE_FOR_INTEGER__Permutation_getIndexAtValue);
10085 praat_addAction1 (classPermutation, 1, U"Get number of inversions",
10086 nullptr, 1, QUERY_ONE_FOR_INTEGER__Permutation_getNumberOfInversions);
10087 praat_addAction1 (classPermutation, 1, U"List random inversions...",
10088 nullptr, 1, QUERY_ONE_FOR_MATRIX__Permutation_listRandomInversions);
10089 praat_addAction1 (classPermutation, 1, U"List all inversions",
10090 nullptr, 1, QUERY_ONE_FOR_MATRIX__Permutation_listAllInversions);
10091 praat_addAction1 (classPermutation, 0, U"Modify -", nullptr, 0, nullptr);
10092 praat_addAction1 (classPermutation, 0, U"Permute randomly (in-place)...",
10093 nullptr, 1, MODIFY__Permutation_permuteRandomlyInplace);
10094 praat_addAction1 (classPermutation, 1, U"Sort",
10095 nullptr, 1, MODIFY_Permutation_sort);
10096 praat_addAction1 (classPermutation, 1, U"Swap blocks...",
10097 nullptr, 1, MODIFY_Permutation_swapBlocks);
10098 praat_addAction1 (classPermutation, 1, U"Swap numbers...",
10099 nullptr, 1, MODIFY_Permutation_swapNumbers);
10100 praat_addAction1 (classPermutation, 1, U"Swap positions...",
10101 nullptr, 1, MODIFY_Permutation_swapPositions);
10102 praat_addAction1 (classPermutation, 1, U"Swap one from range...",
10103 nullptr, 1, MODIFY_Permutation_swapOneFromRange);
10104 praat_addAction1 (classPermutation, 1, U"Jump...",
10105 nullptr, 1, MODIFY_Permutation_tableJump);
10106 praat_addAction1 (classPermutation, 0, U"-- sequential permutations --",
10107 nullptr, 1, nullptr);
10108 praat_addAction1 (classPermutation, 0, U"Next",
10109 nullptr, 1, MODIFY_Permutations_next);
10110 praat_addAction1 (classPermutation, 0, U"Previous",
10111 nullptr, 1, MODIFY_Permutations_previous);
10112
10113 praat_addAction1 (classPermutation, 1, U"Permute randomly...",
10114 nullptr, 0, CONVERT_EACH_TO_ONE__Permutation_permuteRandomly);
10115 praat_addAction1 (classPermutation, 1, U"Permute randomly (blocks)...",
10116 nullptr, 0, CONVERT_EACH_TO_ONE__Permutation_permuteBlocksRandomly);
10117 praat_addAction1 (classPermutation, 1, U"Interleave...",
10118 nullptr, 0, CONVERT_EACH_TO_ONE__Permutation_interleave);
10119 praat_addAction1 (classPermutation, 1, U"Rotate...",
10120 nullptr, 0, CONVERT_EACH_TO_ONE__Permutation_rotate);
10121 praat_addAction1 (classPermutation, 1, U"Reverse...",
10122 nullptr, 0, CONVERT_EACH_TO_ONE__Permutation_reverse);
10123 praat_addAction1 (classPermutation, 1, U"Invert",
10124 nullptr, 0, CONVERT_EACH_TO_ONE__Permutation_invert);
10125 praat_addAction1 (classPermutation, 0, U"Multiply",
10126 nullptr, 0, COMBINE_ALL_TO_ONE__Permutations_multiply);
10127 praat_addAction1 (classPermutation, 2, U"Permute part...",
10128 nullptr, 0, CONVERT_TWO_TO_ONE__Permutation_permutePartByOther);
10129
10130 praat_addAction1 (classPitch, 2, U"To DTW...", U"To PointProcess",
10131 GuiMenu_HIDDEN, CONVERT_TWO_TO_ONE__Pitches_to_DTW);
10132
10133 praat_addAction1 (classPitchTier, 0, U"To Pitch...",
10134 U"To Sound (sine)...", 1, CONVERT_EACH_TO_ONE__PitchTier_to_Pitch);
10135 praat_addAction1 (classPitchTier, 0, U"Modify interval...",
10136 U"Add point...", 1, MODIFY_PitchTier_modifyInterval);
10137 praat_addAction1 (classPitchTier, 0, U"Modify interval (tone levels)...",
10138 U"Modify interval...", 1, MODIFY_PitchTier_modifyInterval_toneLevels);
10139 praat_addAction1 (classPolygon, 0, U"Query -", U"Paint circles...", 0, nullptr);
10140 praat_addAction1 (classPolygon, 0, U"Get number of points",
10141 U"Query -", 1, QUERY_ONE_FOR_INTEGER__Polygon_getNumberOfPoints);
10142 praat_addAction1 (classPolygon, 0, U"Get point (x)...",
10143 U"Get number of points", 1, QUERY_ONE_FOR_REAL__Polygon_getPointX);
10144 praat_addAction1 (classPolygon, 0, U"Get point (y)...", U"Get point (x)...", 1,
10145 QUERY_ONE_FOR_REAL__Polygon_getPointY);
10146 praat_addAction1 (classPolygon, 0, U"-- other queries --", U"Get point (y)...", 1, 0);
10147 praat_addAction1 (classPolygon, 0, U"Get location of point...", U"-- other queries --", 1,
10148 QUERY_ONE_FOR_STRING__Polygon_getLocationOfPoint);
10149 praat_addAction1 (classPolygon, 0, U"Get area of convex hull...", U"Get location of point...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10150 QUERY_ONE_FOR_REAL__Polygon_getAreaOfConvexHull);
10151
10152 praat_addAction1 (classPolygon, 0, U"Translate...", U"Modify -", 1,
10153 MODIFY_EACH__Polygon_translate);
10154 praat_addAction1 (classPolygon, 0, U"Rotate...", U"Translate...", 1,
10155 MODIFY_EACH__Polygon_rotate);
10156 praat_addAction1 (classPolygon, 0, U"Scale...", U"Rotate...", 1,
10157 MODIFY_EACH__Polygon_scale);
10158 praat_addAction1 (classPolygon, 0, U"Reverse X", U"Scale...", 1,
10159 MODIFY_EACH__Polygon_reverseX);
10160 praat_addAction1 (classPolygon, 0, U"Reverse Y", U"Reverse X", 1,
10161 MODIFY_EACH__Polygon_reverseY);
10162 praat_addAction1 (classPolygon, 0, U"Simplify", nullptr, GuiMenu_HIDDEN,
10163 CONVERT_EACH_TO_ONE__Polygon_simplify);
10164 praat_addAction1 (classPolygon, 0, U"Convex hull", nullptr, 0,
10165 CONVERT_EACH_TO_ONE__Polygon_convexHull);
10166 praat_addAction1 (classPolygon, 0, U"Circular permutation...", nullptr, GuiMenu_HIDDEN,
10167 CONVERT_EACH_TO_ONE__Polygon_circularPermutation);
10168
10169 praat_addAction2 (classPolygon, 1, classCategories, 1, U"Draw...", nullptr, 0,
10170 GRAPHICS_ONE_AND_ONE__Polygon_Categories_draw);
10171
10172 praat_addAction1 (classPolynomial, 0, U"Polynomial help", nullptr, 0,
10173 HELP__Polynomial_help);
10174 praat_FunctionSeries_init (classPolynomial);
10175 praat_addAction1 (classPolynomial, 0, U"-- area --", U"Get x of maximum...", 1, 0);
10176 praat_addAction1 (classPolynomial, 1, U"Get area...", U"-- area --", 1,
10177 QUERY_ONE_FOR_REAL__Polynomial_getArea);
10178 praat_addAction1 (classPolynomial, 1, U"Get remainder after division... || Get remainder...", U"Get area...", 1,
10179 QUERY_ONE_FOR_REAL__Polynomial_getRemainderAfterDivision); // alternative COMPATIBILITY <= 2016
10180 praat_addAction1 (classPolynomial, 0, U"-- monic --", U"Set coefficient...", 1, 0);
10181 praat_addAction1 (classPolynomial, 0, U"Scale coefficients (monic)", U"-- monic --", 1,
10182 MODIFY_Polynomial_scaleCoefficients_monic);
10183 praat_addAction1 (classPolynomial, 1, U"Divide (second order factor)...", U"Scale coefficients (monic)", 1,
10184 MODIFY_EACH__Polynomial_divide_secondOrderFactor);
10185
10186 praat_addAction1 (classPolynomial, 1, U"Get value (complex)...", U"Get value...", 1,
10187 INFO_ONE__Polynomial_evaluate_z);
10188 praat_addAction1 (classPolynomial, 1, U"Get derivatives at X...", U"Get value (complex)...", 1,
10189 INFO_ONE__Polynomial_getDerivativesAtX);
10190 praat_addAction1 (classPolynomial, 1, U"Get one real root...", U"Get derivatives at X...", 1,
10191 QUERY_ONE_FOR_REAL__Polynomial_getOneRealRoot);
10192 praat_addAction1 (classPolynomial, 0, U"To Spectrum...", U"Analyse", 0,
10193 CONVERT_EACH_TO_ONE__Polynomial_to_Spectrum);
10194 praat_addAction1 (classPolynomial, 0, U"To Roots", nullptr, 0,
10195 CONVERT_EACH_TO_ONE__Polynomial_to_Roots);
10196 praat_addAction1 (classPolynomial, 0, U"To Polynomial (derivative)", nullptr, 0,
10197 CONVERT_EACH_TO_ONE__Polynomial_getDerivative);
10198 praat_addAction1 (classPolynomial, 0, U"To Polynomial (primitive)...", nullptr, 0,
10199 CONVERT_EACH_TO_ONE__Polynomial_getPrimitive);
10200 praat_addAction1 (classPolynomial, 0, U"Scale x...", nullptr, 0,
10201 CONVERT_EACH_TO_ONE__Polynomial_scaleX);
10202 praat_addAction1 (classPolynomial, 2, U"Multiply", nullptr, 0,
10203 CONVERT_EACH_TO_ONE__Polynomials_multiply);
10204 praat_addAction1 (classPolynomial, 2, U"Divide...", nullptr, 0,
10205 CONVERT_TWO_TO_MULTIPLE__Polynomials_divide);
10206
10207 praat_addAction1 (classRoots, 1, U"Roots help", nullptr, 0,
10208 HELP__Roots_help);
10209 praat_addAction1 (classRoots, 1, U"Draw...", nullptr, 0,
10210 GRAPHICS_EACH__Roots_draw);
10211 praat_addAction1 (classRoots, 1, U"Query -", nullptr, 0, nullptr);
10212 praat_addAction1 (classRoots, 1, U"Get number of roots", nullptr, 1,
10213 QUERY_ONE_FOR_INTEGER__Roots_getNumberOfRoots);
10214 praat_addAction1 (classRoots, 1, U"-- roots --", nullptr, 1, 0);
10215 praat_addAction1 (classRoots, 1, U"Get root...", nullptr, 1,
10216 COMPLEX_Roots_getRoot);
10217 praat_addAction1 (classRoots, 1, U"Get real part of root...", nullptr, 1,
10218 QUERY_ONE_FOR_REAL__Roots_getRealPartOfRoot);
10219 praat_addAction1 (classRoots, 1, U"Get imaginary part of root...", nullptr, 1,
10220 QUERY_ONE_FOR_REAL__Roots_getImaginaryPartOfRoot);
10221 praat_addAction1 (classRoots, 1, U"Modify -", nullptr, 0, 0);
10222 praat_addAction1 (classRoots, 1, U"Set root...", nullptr, 1,
10223 MODIFY_EACH__Roots_setRoot);
10224 praat_addAction1 (classRoots, 0, U"Analyse", nullptr, 0, 0);
10225 praat_addAction1 (classRoots, 0, U"To Spectrum...", nullptr, 0,
10226 CONVERT_EACH_TO_ONE__Roots_to_Spectrum);
10227
10228 praat_addAction2 (classRoots, 1, classPolynomial, 1, U"Polish roots", nullptr, 0,
10229 MODIFY_FIRST_OF_ONE_AND_ONE__Roots_Polynomial_polish);
10230
10231 praat_addAction1 (classSound, 0, U"To TextGrid (silences)...", U"To IntervalTier", 1,
10232 CONVERT_EACH_TO_ONE__Sound_to_TextGrid_detectSilences);
10233 praat_addAction1 (classSound, 0, U"To TextGrid (speech activity, LTSF)... || To TextGrid (speech activity)... || To TextGrid (voice activity)...", U"To IntervalTier", 1,
10234 CONVERT_EACH_TO_ONE__Sound_to_TextGrid_speechActivity);
10235 praat_addAction1 (classSound, 0, U"To TextGrid (high, mid, low)...", U"To IntervalTier", GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
10236 CONVERT_EACH_TO_ONE__Sound_to_TextGrid_highMidLowIntervals);
10237 praat_addAction1 (classSound, 0, U"Play one channel...", U"Play", GuiMenu_HIDDEN,
10238 PLAY_EACH__Sound_playOneChannel);
10239 praat_addAction1 (classSound, 0, U"Play as frequency shifted...", U"Play", GuiMenu_HIDDEN,
10240 PLAY_EACH__Sound_playAsFrequencyShifted);
10241 praat_addAction1 (classSound, 0, U"Draw where...", U"Draw...", 1,
10242 GRAPHICS_EACH__Sound_drawWhere);
10243 praat_addAction1 (classSound, 0, U"Paint where...", U"Draw where...", 1,
10244 GRAPHICS_EACH__Sound_paintWhere);
10245 praat_addAction1 (classSound, 2, U"Paint enclosed...", U"Paint where...", 1,
10246 GRAPHICS_TWO__Sounds_paintEnclosed);
10247
10248 praat_addAction1 (classSound, 1, U"Get nearest level crossing...", U"Get nearest zero crossing...", 1,
10249 QUERY_ONE_FOR_REAL__Sound_getNearestLevelCrossing);
10250
10251 praat_addAction1 (classSound, 0, U"To Pitch (shs)...", U"To Pitch (filtered cc)...", 1,
10252 CONVERT_EACH_TO_ONE__Sound_to_Pitch_shs);
10253 praat_addAction1 (classSound, 0, U"Fade in...", U"Multiply by window...", GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
10254 MODIFY_EACH__Sound_fadeIn);
10255 praat_addAction1 (classSound, 0, U"Fade out...", U"Fade in...", GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
10256 MODIFY_Sound_fadeOut);
10257 praat_addAction1 (classSound, 0, U"To Pitch (SPINET)...", U"To Pitch (shs)...", 1,
10258 CONVERT_EACH_TO_ONE__Sound_to_Pitch_SPINET);
10259
10260 praat_addAction1 (classSound, 1, U"Save as highest quality MP3 file...", U"Save as 32-bit WAV file...", 1,
10261 SAVE__Sound_saveAsHighestQualityMP3File);
10262 praat_addAction1 (classSound, 0, U"To Spectrum (resampled)...", U"To Spectrum...", GuiMenu_DEPTH_1,
10263 CONVERT_EACH_TO_ONE__Sound_to_Spectrum_resampled);
10264 praat_addAction1 (classSound, 0, U"To FormantFilter...", U"To Cochleagram (edb)...", GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
10265 CONVERT_EACH_TO_ONE__Sound_to_FormantFilter);
10266 praat_addAction1 (classSound, 0, U"To Spectrogram (pitch-dependent)...", U"To Cochleagram (edb)...", 1,
10267 CONVERT_EACH_TO_ONE__Sound_to_Spectrogram_pitchDependent);
10268
10269 praat_addAction1 (classSound, 0, U"To BarkFilter...", U"To FormantFilter...", GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
10270 CONVERT_EACH_TO_ONE__Sound_to_BarkFilter);
10271 praat_addAction1 (classSound, 0, U"To BarkSpectrogram...", U"To FormantFilter...", GuiMenu_DEPTH_1,
10272 CONVERT_EACH_TO_ONE__Sound_to_BarkSpectrogram);
10273
10274 praat_addAction1 (classSound, 0, U"To MelFilter...", U"To BarkFilter...", GuiMenu_DEPRECATED_2014 | GuiMenu_DEPTH_1,
10275 CONVERT_EACH_TO_ONE__Sound_to_MelFilter);
10276 praat_addAction1 (classSound, 0, U"To MelSpectrogram...", U"To BarkSpectrogram...", GuiMenu_DEPTH_1,
10277 CONVERT_EACH_TO_ONE__Sound_to_MelSpectrogram);
10278 praat_addAction1 (classSound, 0, U"To ComplexSpectrogram...", U"To MelSpectrogram...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10279 CONVERT_EACH_TO_ONE__Sound_to_ComplexSpectrogram);
10280
10281 praat_addAction1 (classSound, 0, U"To Polygon...", U"Down to Matrix", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10282 CONVERT_EACH_TO_ONE__Sound_to_Polygon);
10283 praat_addAction1 (classSound, 2, U"To Polygon (enclosed)...", U"Cross-correlate...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10284 CONVERT_TWO_TO_ONE__Sounds_to_Polygon_enclosed);
10285 praat_addAction1 (classSound, 2, U"To DTW...", U"Cross-correlate...", GuiMenu_DEPTH_1,
10286 CONVERT_TWO_TO_ONE__Sounds_to_DTW);
10287
10288 praat_addAction1 (classSound, 1, U"Filter (gammatone)...", U"Filter (de-emphasis)...", 1,
10289 CONVERT_EACH_TO_ONE__Sound_filterByGammaToneFilter4);
10290 praat_addAction1 (classSound, 0, U"Remove noise...", U"Filter (formula)...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10291 CONVERT_EACH_TO_ONE__Sound_removeNoise);
10292 praat_addAction1 (classSound, 0, U"Reduce noise...", U"Filter (formula)...", GuiMenu_DEPTH_1,
10293 CONVERT_EACH_TO_ONE__Sound_reduceNoise);
10294 praat_addAction1 (classSound, 0, U"To Sound (derivative)...", U"Filter (formula)...", GuiMenu_DEPTH_1,
10295 CONVERT_EACH_TO_ONE__Sound_to_Sound_derivative);
10296
10297 praat_addAction1 (classSound, 0, U"Change gender...", U"Deepen band modulation...", 1,
10298 CONVERT_EACH_TO_ONE__Sound_changeGender);
10299
10300 praat_addAction1 (classSound, 0, U"Change speaker...", U"Deepen band modulation...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10301 CONVERT_EACH_TO_ONE__Sound_changeSpeaker);
10302 praat_addAction1 (classSound, 0, U"Copy channel ranges...", U"Extract all channels", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10303 CONVERT_EACH_TO_ONE__Sound_copyChannelRanges);
10304 praat_addAction1 (classSound, 0 /* TODO produces 2N objects */, U"Trim silences...", U"Resample...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10305 CONVERT_EACH_TO_ONE__Sound_trimSilences);
10306 praat_addAction1 (classSound, 0, U"To KlattGrid (simple)...", U"To Manipulation...", 1,
10307 CONVERT_EACH_TO_ONE__Sound_to_KlattGrid_simple);
10308 praat_addAction2 (classSound, 1, classPitch, 1, U"To FormantFilter...", nullptr, GuiMenu_DEPRECATED_2014,
10309 CONVERT_ONE_AND_ONE_TO_ONE__Sound_Pitch_to_FormantFilter);
10310 praat_addAction2 (classSound, 1, classPitch, 1, U"To Spectrogram (pitch-dependent)...", nullptr, 0,
10311 CONVERT_ONE_AND_ONE_TO_ONE__Sound_Pitch_to_Spectrogram);
10312
10313 praat_addAction2 (classSound, 1, classPitch, 1, U"Change gender...", nullptr, 0,
10314 CONVERT_ONE_AND_ONE_TO_ONE__Sound_Pitch_changeGender);
10315 praat_addAction2 (classSound, 1, classPitch, 1, U"Change speaker...", nullptr, GuiMenu_HIDDEN,
10316 CONVERT_ONE_AND_ONE_TO_ONE__Sound_Pitch_changeSpeaker);
10317 praat_addAction2 (classSound, 1, classIntervalTier, 1, U"Cut parts matching label...", nullptr, 0,
10318 CONVERT_ONE_AND_ONE_TO_ONE__Sound_IntervalTier_cutPartsMatchingLabel);
10319
10320 praat_addAction1 (classSpectrogram, 2, U"To DTW...", U"To Spectrum (slice)...", 1,
10321 CONVERT_TWO_TO_ONE__Spectrograms_to_DTW);
10322 praat_addAction1 (classSpectrogram, 0, U"Draw long-term spectral flatness...", U"Paint...", GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
10323 GRAPHICS_EACH__Spectrogram_drawLongtermSpectralFlatness);
10324 praat_addAction1 (classSpectrogram, 0, U"Get long-term spectral flatness...", U"To DTW...", GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
10325 CONVERT_EACH_TO_ONE__Spectrogram_getLongtermSpectralFlatness);
10326
10327 praat_addAction1 (classSpectrum, 0, U"To Sound (resampled)...", U"To Sound", GuiMenu_DEPTH_1,
10328 CONVERT_EACH_TO_ONE__Spectrum_to_Sound_resampled);
10329 praat_addAction1 (classSpectrum, 0, U"Draw phases...", U"Draw (log freq)...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10330 GRAPHICS_EACH__Spectrum_drawPhases);
10331 praat_addAction1 (classSpectrum, 0, U"Set real value in bin...", U"Formula...", GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
10332 MODIFY_EACH__Spectrum_setRealValueInBin);
10333 praat_addAction1 (classSpectrum, 0, U"Set imaginary value in bin...", U"Formula...", GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
10334 MODIFY_EACH__Spectrum_setImaginaryValueInBin);
10335 praat_addAction1 (classSpectrum, 0, U"Conjugate", U"Formula...", GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
10336 MODIFY_EACH__Spectrum_conjugate);
10337 praat_addAction1 (classSpectrum, 2, U"Multiply", U"To Sound (fft)", GuiMenu_HIDDEN,
10338 CONVERT_TWO_TO_ONE__Spectra_multiply);
10339 praat_addAction1 (classSpectrum, 0, U"To Matrix (unwrap)", U"To Matrix", GuiMenu_HIDDEN,
10340 CONVERT_EACH_TO_ONE__Spectrum_unwrap);
10341 praat_addAction1 (classSpectrum, 0, U"Shift frequencies...", U"To Matrix", GuiMenu_HIDDEN,
10342 CONVERT_EACH_TO_ONE__Spectrum_shiftFrequencies);
10343 praat_addAction1 (classSpectrum, 0, U"Compress frequency domain...", U"Shift frequencies...", GuiMenu_HIDDEN,
10344 CONVERT_EACH_TO_ONE__Spectrum_compressFrequencyDomain);
10345 praat_addAction1 (classSpectrum, 0, U"Resample...", U"Compress frequency domain...", GuiMenu_HIDDEN,
10346 CONVERT_EACH_TO_ONE__Spectrum_resample);
10347 praat_addAction1 (classSpectrum, 0, U"To Cepstrum", U"To Spectrogram", 1,
10348 CONVERT_EACH_TO_ONE__Spectrum_to_Cepstrum);
10349 praat_addAction1 (classSpectrum, 0, U"To PowerCepstrum", U"To Cepstrum", 1,
10350 CONVERT_EACH_TO_ONE__Spectrum_to_PowerCepstrum);
10351
10352 praat_addAction1 (classSpeechSynthesizer, 0, U"SpeechSynthesizer help", nullptr, 0,
10353 HELP__SpeechSynthesizer_help);
10354 praat_addAction1 (classSpeechSynthesizer, 0, U"Play text...", nullptr, 0,
10355 PLAY_EACH__SpeechSynthesizer_playText);
10356 praat_addAction1 (classSpeechSynthesizer, 0, U"To Sound...", nullptr, 0,
10357 CONVERT_EACH_TO_ONE__SpeechSynthesizer_to_Sound);
10358 praat_addAction1 (classSpeechSynthesizer, 0, U"Query -", nullptr, 0, nullptr);
10359 praat_addAction1 (classSpeechSynthesizer, 1, U"Get language name", nullptr, 1,
10360 QUERY_ONE_FOR_STRING__SpeechSynthesizer_getLanguageName);
10361 praat_addAction1 (classSpeechSynthesizer, 1, U"Get voice name", nullptr, 1,
10362 QUERY_ONE_FOR_STRING__SpeechSynthesizer_getVoiceName);
10363 praat_addAction1 (classSpeechSynthesizer, 1, U"Get phoneme set name", nullptr, 1,
10364 QUERY_ONE_FOR_STRING__SpeechSynthesizer_getPhonemeSetName);
10365 praat_addAction1 (classSpeechSynthesizer, 1, U"Get phonemes from text...", nullptr, 1,
10366 QUERY_ONE_FOR_AUTOSTRING__SpeechSynthesizer_getPhonemesFromText);
10367 praat_addAction1 (classSpeechSynthesizer, 1, U"Get phonemes from text (space-separated)...", nullptr, 1,
10368 QUERY_ONE_FOR_AUTOSTRING__SpeechSynthesizer_getPhonemesFromTextSpaceSeparated);
10369 praat_addAction1 (classSpeechSynthesizer, 1, U"Get voice variant", nullptr, GuiMenu_DEPRECATED_2017,
10370 QUERY_ONE_FOR_STRING__SpeechSynthesizer_getVoiceName);
10371
10372 praat_addAction1 (classSpeechSynthesizer, 0, U"Modify -", nullptr, 0, nullptr);
10373 praat_addAction1 (classSpeechSynthesizer, 1, U"View & Edit...", nullptr, 1,
10374 WINDOW_SpeechSynthesizer_viewAndEdit);
10375 praat_addAction1 (classSpeechSynthesizer, 0, U"Set text input settings...", nullptr, 1,
10376 MODIFY_EACH__SpeechSynthesizer_setTextInputSettings);
10377 praat_addAction1 (classSpeechSynthesizer, 0, U"Speech output settings...", nullptr, 1,
10378 MODIFY_EACH__SpeechSynthesizer_speechOutputSettings);
10379 praat_addAction1 (classSpeechSynthesizer, 0, U"Estimate speech rate from speech...", nullptr, 1,
10380 MODIFY_EACH__SpeechSynthesizer_estimateSpeechRateFromSpeech);
10381 praat_addAction1 (classSpeechSynthesizer, 0, U"Set speech output settings...", nullptr, GuiMenu_DEPTH_1 | GuiMenu_DEPRECATED_2017,
10382 MODIFY_EACH__SpeechSynthesizer_setSpeechOutputSettings);
10383
10384 praat_addAction2 (classSpeechSynthesizer, 1, classTextGrid, 1, U"To Sound...", nullptr, 0,
10385 CONVERT_ONE_AND_ONE_TO_ONE__SpeechSynthesizer_TextGrid_to_Sound);
10386 praat_addAction3 (classSpeechSynthesizer, 1, classSound, 1, classTextGrid, 1, U"To TextGrid (align)...", nullptr, 0,
10387 CONVERT_ONE_AND_ONE_AND_ONE_TO_ONE__SpeechSynthesizer_Sound_TextGrid_align);
10388 praat_addAction3 (classSpeechSynthesizer, 1, classSound, 1, classTextGrid, 1, U"To TextGrid (align,trim)...", nullptr, 0,
10389 CONVERT_ONE_AND_ONE_AND_ONE_TO_ONE__SpeechSynthesizer_Sound_TextGrid_align2);
10390
10391 praat_addAction1 (classSSCP, 0, U"SSCP help", nullptr, 0,
10392 HELP__SSCP_help);
10393 praat_TableOfReal_init2 (classSSCP);
10394 praat_removeAction (classSSCP, nullptr, nullptr, U"Append");
10395 praat_addAction1 (classSSCP, 0, U"Draw sigma ellipse...", U"Draw -", 1,
10396 GRAPHICS_EACH__SSCP_drawSigmaEllipse);
10397 praat_addAction1 (classSSCP, 0, U"Draw confidence ellipse...", U"Draw -", 1,
10398 GRAPHICS_EACH__SSCP_drawConfidenceEllipse);
10399 praat_SSCP_query_init (classSSCP);
10400 praat_addAction1 (classSSCP, 1, U"Get diagonality (bartlett)...", U"Get ln(determinant)", 1,
10401 QUERY_ONE_FOR_REAL__SSCP_getDiagonality_bartlett);
10402 praat_addAction1 (classSSCP, 1, U"Get total variance", U"Get diagonality (bartlett)...", 1,
10403 QUERY_ONE_FOR_REAL__SSCP_getTotalVariance);
10404 praat_addAction1 (classSSCP, 1, U"Get sigma ellipse area...", U"Get total variance", 1,
10405 QUERY_ONE_FOR_REAL__SSCP_getConcentrationEllipseArea);
10406 praat_addAction1 (classSSCP, 1, U"Get confidence ellipse area...", U"Get sigma ellipse area...", 1,
10407 QUERY_ONE_FOR_REAL__SSCP_getConfidenceEllipseArea);
10408 praat_addAction1 (classSSCP, 1, U"Get fraction variation...", U"Get confidence ellipse area...", 1,
10409 QUERY_ONE_FOR_REAL__SSCP_getFractionVariation);
10410 praat_SSCP_extract_init (classSSCP);
10411 praat_addAction1 (classSSCP, 0, U"To PCA", nullptr, 0,
10412 CONVERT_EACH_TO_ONE__SSCP_to_PCA);
10413 praat_addAction1 (classSSCP, 0, U"To Correlation", nullptr, 0,
10414 CONVERT_EACH_TO_ONE__SSCP_to_Correlation);
10415 praat_addAction1 (classSSCP, 0, U"To Covariance...", nullptr, 0,
10416 CONVERT_EACH_TO_ONE__SSCP_to_Covariance);
10417
10418 praat_addAction1 (classStrings, 0, U"To Categories", nullptr, 0,
10419 CONVERT_EACH_TO_ONE__Strings_to_Categories);
10420 praat_addAction1 (classStrings, 0, U"Append", nullptr, 0,
10421 COMBINE_ALL_TO_ONE__Strings_append);
10422 praat_addAction1 (classStrings, 0, U"Change...", U"Replace all...", GuiMenu_HIDDEN,
10423 CONVERT_EACH_TO_ONE__Strings_change);
10424 praat_addAction1 (classStrings, 0, U"Extract part...", U"Replace all...", 0,
10425 CONVERT_EACH_TO_ONE__Strings_extractPart);
10426 praat_addAction1 (classStrings, 0, U"To Permutation...", U"To Distributions", 0,
10427 CONVERT_EACH_TO_ONE__Strings_to_Permutation);
10428 praat_addAction1 (classStrings, 2, U"To EditDistanceTable", U"To Distributions", 0,
10429 CONVERT_TWO_TO_ONE__Strings_to_EditDistanceTable);
10430 praat_addAction1 (classStrings, 0, U"To StringsIndex...", U"To Permutation...", GuiMenu_HIDDEN,
10431 CONVERT_EACH_TO_ONE__Strings_to_StringsIndex);
10432 praat_addAction1 (classSVD, 0, U"SVD help", nullptr, 0,
10433 HELP__SVD_help);
10434 praat_addAction1 (classSVD, 0, U"Query -", nullptr, 0, nullptr);
10435 praat_addAction1 (classSVD, 1, U"Get number of rows", nullptr, 1,
10436 QUERY_ONE_FOR_INTEGER__SVD_getNumberOfRows);
10437 praat_addAction1 (classSVD, 1, U"Get number of columns", nullptr, 1,
10438 QUERY_ONE_FOR_INTEGER__SVD_getNumberOfColumns);
10439 praat_addAction1 (classSVD, 1, U"Get rank", nullptr, 1,
10440 QUERY_ONE_FOR_REAL__SVD_getRank);
10441 praat_addAction1 (classSVD, 1, U"Get condition number", nullptr, 1,
10442 QUERY_ONE_FOR_REAL__SVD_getConditionNumber);
10443 praat_addAction1 (classSVD, 0, U"-- singular values ---", nullptr, 1, nullptr);
10444 praat_addAction1 (classSVD, 1, U"Get singular value...", nullptr, 1,
10445 QUERY_ONE_FOR_REAL__SVD_getSingularValue);
10446 praat_addAction1 (classSVD, 1, U"Get sum of singular values...", nullptr, 1,
10447 QUERY_ONE_FOR_REAL__SVD_getSumOfSingularValues);
10448 praat_addAction1 (classSVD, 1, U"Get sum of singular values (fraction)...", nullptr, 1,
10449 QUERY_ONE_FOR_REAL__SVD_getSumOfSingularValuesAsFractionOfTotal);
10450 praat_addAction1 (classSVD, 1, U"Get minimum number of singular values...", nullptr, 1,
10451 QUERY_ONE_FOR_INTEGER__SVD_getMinimumNumberOfSingularValues);
10452 praat_addAction1 (classSVD, 1, U"Get shrinkage parameter...", nullptr, 1,
10453 QUERY_ONE_FOR_REAL__SVD_getShrinkageParameter);
10454 praat_addAction1 (classSVD, 1, U"Get effective degrees of freedom...", nullptr, 1,
10455 QUERY_ONE_FOR_REAL__SVD_getEffectiveDegreesOfFreedom);
10456
10457 praat_addAction1 (classSVD, 0, U"To TableOfReal...", nullptr, 0,
10458 CONVERT_EACH_TO_ONE__SVD_to_TableOfReal);
10459 praat_addAction1 (classSVD, 0, U"To Matrix...", nullptr, 0,
10460 CONVERT_EACH_TO_ONE__SVD_to_Matrix);
10461 praat_addAction1 (classSVD, 0, U"Extract left singular vectors", nullptr, 0,
10462 CONVERT_EACH_TO_ONE__SVD_extractLeftSingularVectors);
10463 praat_addAction1 (classSVD, 0, U"Extract right singular vectors", nullptr, 0,
10464 CONVERT_EACH_TO_ONE__SVD_extractRightSingularVectors);
10465 praat_addAction1 (classSVD, 0, U"Extract singular values", nullptr, 0,
10466 CONVERT_EACH_TO_ONE__SVD_extractSingularValues);
10467 praat_addAction1 (classTable, 0, U"Draw ellipses...", U"Draw ellipse (standard deviation)...", GuiMenu_DEPTH_1,
10468 GRAPHICS_EACH__Table_drawEllipses);
10469 praat_addAction1 (classTable, 0, U"Box plots...", U"Draw ellipses...", GuiMenu_DEPTH_1,
10470 GRAPHICS_EACH__Table_boxPlots);
10471 praat_addAction1 (classTable, 0, U"Normal probability plot...", U"Box plots...", GuiMenu_DEPTH_1,
10472 GRAPHICS_EACH__Table_normalProbabilityPlot);
10473 praat_addAction1 (classTable, 0, U"Quantile-quantile plot...", U"Normal probability plot...", GuiMenu_DEPTH_1,
10474 GRAPHICS_EACH__Table_quantileQuantilePlot);
10475 praat_addAction1 (classTable, 0, U"Quantile-quantile plot (between levels)...", U"Quantile-quantile plot...", GuiMenu_DEPTH_1,
10476 GRAPHICS_EACH__Table_quantileQuantilePlot_betweenLevels);
10477 praat_addAction1 (classTable, 0, U"Lag plot...", U"Quantile-quantile plot (between levels)...", GuiMenu_DEPTH_1,
10478 GRAPHICS_EACH__Table_lagPlot);
10479 praat_addAction1 (classTable, 0, U"Bar plot...", U"Lag plot...", GuiMenu_DEPTH_1,
10480 GRAPHICS_EACH__Table_barPlot);
10481 praat_addAction1 (classTable, 0, U"Line graph...", U"Bar plot...", GuiMenu_DEPTH_1,
10482 GRAPHICS_EACH__Table_LineGraph);
10483 praat_addAction1 (classTable, 0, U"Distribution plot...", U"Line graph...", GuiMenu_DEPTH_1,
10484 GRAPHICS_EACH__Table_distributionPlot);
10485 praat_addAction1 (classTable, 0, U"Horizontal error bars plot...", U"Distribution plot...", GuiMenu_DEPTH_1,
10486 GRAPHICS_EACH__Table_horizontalErrorBarsPlot);
10487 praat_addAction1 (classTable, 0, U"Vertical error bars plot...", U"Horizontal error bars plot...", GuiMenu_DEPTH_1,
10488 GRAPHICS_EACH__Table_verticalErrorBarsPlot);
10489
10490 // The Draw_where's are deprecated 2023
10491 praat_addAction1 (classTable, 0, U"Draw where", U"Vertical error bars plot...", GuiMenu_DEPRECATED_2023, nullptr);
10492 praat_addAction1 (classTable, 0, U"Scatter plot where...", U"Draw where", GuiMenu_DEPRECATED_2023,
10493 GRAPHICS_EACH__Table_scatterPlotWhere);
10494 praat_addAction1 (classTable, 0, U"Scatter plot where (mark)...", U"Scatter plot where...", GuiMenu_DEPRECATED_2023,
10495 GRAPHICS_EACH__Table_scatterPlotMarkWhere);
10496 praat_addAction1 (classTable, 0, U"Draw ellipses where...", U"Scatter plot where (mark)...", GuiMenu_DEPRECATED_2023,
10497 GRAPHICS_EACH__Table_drawEllipsesWhere);
10498 praat_addAction1 (classTable, 0, U"Box plots where...", U"Draw ellipses where...", GuiMenu_DEPRECATED_2023,
10499 GRAPHICS_EACH__Table_boxPlotsWhere);
10500 praat_addAction1 (classTable, 0, U"Normal probability plot where...", U"Box plots where...", GuiMenu_DEPRECATED_2023,
10501 GRAPHICS_EACH__Table_normalProbabilityPlotWhere);
10502 praat_addAction1 (classTable, 0, U"Distribution plot where...", U"Scatter plot where (mark)...", GuiMenu_DEPRECATED_2023,
10503 GRAPHICS_EACH__Table_distributionPlotWhere);
10504 praat_addAction1 (classTable, 0, U"Draw ellipse where (standard deviation)...", U"Distribution plot where...", GuiMenu_DEPRECATED_2023,
10505 GRAPHICS_EACH__Table_drawEllipseWhere);
10506 praat_addAction1 (classTable, 0, U"Bar plot where...", U"Draw ellipse where (standard deviation)...", GuiMenu_DEPRECATED_2023,
10507 GRAPHICS_EACH__Table_barPlotWhere);
10508 praat_addAction1 (classTable, 0, U"Line graph where...", U"Bar plot where...", GuiMenu_DEPRECATED_2023,
10509 GRAPHICS_EACH__Table_LineGraphWhere);
10510 praat_addAction1 (classTable, 0, U"Lag plot where...", U"Line graph where...", GuiMenu_DEPRECATED_2023,
10511 GRAPHICS_EACH__Table_lagPlotWhere);
10512 praat_addAction1 (classTable, 0, U"Horizontal error bars plot where...", U"Lag plot where...", GuiMenu_DEPRECATED_2023,
10513 GRAPHICS_EACH__Table_horizontalErrorBarsPlotWhere);
10514 praat_addAction1 (classTable, 0, U"Vertical error bars plot where...", U"Horizontal error bars plot where...", GuiMenu_DEPRECATED_2023,
10515 GRAPHICS_EACH__Table_verticalErrorBarsPlotWhere);
10516 // End of deprecated 2023
10517
10518 praat_addAction1 (classTable, 1, U"List row numbers where...", U"Get number of rows", GuiMenu_DEPTH_1,
10519 QUERY_ONE_FOR_REAL_VECTOR__Table_listRowNumbersWhere);
10520 praat_addAction1 (classTable, 1, U"Get number of rows where...", U"Get number of rows", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10521 QUERY_ONE_FOR_INTEGER__Table_getNumberOfRowsWhere);
10522 praat_addAction1 (classTable, 1, U"Report one-way anova...", U"Report group difference (Wilcoxon rank sum)...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10523 INFO_ONE__Table_reportOneWayAnova);
10524 praat_addAction1 (classTable, 1, U"Report one-way Kruskal-Wallis...", U"Report one-way anova...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10525 INFO_ONE__Table_reportOneWayKruskalWallis);
10526 praat_addAction1 (classTable, 1, U"Report two-way anova...", U"Report one-way Kruskal-Wallis...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10527 INFO_ONE__Table_reportTwoWayAnova);
10528 praat_addAction1 (classTable, 1, U"Report robust statistics...", U"Report two-way anova...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10529 INFO_ONE__Table_reportRobustStatistics);
10530 praat_addAction1 (classTable, 0, U"Extract rows where...", U"Extract rows where column (text)...", GuiMenu_DEPTH_1,
10531 CONVERT_EACH_TO_ONE__Table_extractRowsWhere);
10532 praat_addAction1 (classTable, 0, U"Extract rows where (mahalanobis)...", U"Extract rows where...", GuiMenu_DEPTH_1,
10533 CONVERT_EACH_TO_ONE__Table_extractRowsWhereMahalanobis);
10534 praat_addAction1 (classTable, 0, U"-- Extract columns ----", U"Extract rows where (mahalanobis)...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN, nullptr);
10535 praat_addAction1 (classTable, 0, U"Extract columns by number... || Extract column ranges...", U"-- Extract columns ----", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10536 CONVERT_EACH_TO_ONE__Table_extractColumnsByNumber);
10537
10538 praat_addAction1 (classTable, 0, U"To KlattTable", nullptr, GuiMenu_HIDDEN,
10539 CONVERT_EACH_TO_ONE__Table_to_KlattTable);
10540 praat_addAction1 (classTable, 1, U"Get median absolute deviation...", U"Get standard deviation...", 1,
10541 QUERY_ONE_FOR_REAL__Table_getMedianAbsoluteDeviation);
10542 praat_addAction1 (classTable, 0, U"To StringsIndex (column)...", nullptr, GuiMenu_HIDDEN,
10543 CONVERT_EACH_TO_ONE__Table_to_StringsIndex_column);
10544 praat_addAction1 (classTableOfReal, 0, U"Multivariate tests -", U"Get column stdev (label)...", 1, nullptr);
10545 praat_addAction1 (classTableOfReal, 1, U"Report multivariate normality...", U"Multivariate tests -",
10546 GuiMenu_DEPTH_2, INFO_ONE__TableOfReal_reportMultivariateNormality);
10547 praat_addAction1 (classTableOfReal, 1, U"Report covariance sphericity...", U"Report multivariate normality...",
10548 GuiMenu_DEPTH_2, INFO_ONE__TableOfReal_reportSphericityOfCovariance);
10549 praat_addAction1 (classTableOfReal, 1, U"Report covariance compound symmetry...", U"Report covariance sphericity...",
10550 GuiMenu_DEPTH_2, INFO_ONE__TableOfReal_reportCompoundSymmetryOfCovariance);
10551 praat_addAction1 (classTableOfReal, 1, U"Report covariance identity...", U"Report covariance compound symmetry...",
10552 GuiMenu_DEPTH_2, INFO_ONE__TableOfReal_reportCovarianceIdentity);
10553 praat_addAction1 (classTableOfReal, 2, U"Report equality of covariances...", U"Report covariance identity...",
10554 GuiMenu_DEPTH_2, INFO_TWO__TableOfReal_reportEqualityOfCovariances);
10555 praat_addAction1 (classTableOfReal, 0, U"Append columns", U"Append", 1,
10556 COMBINE_ALL_LISTED_TO_ONE__TableOfReal_appendColumns);
10557 praat_addAction1 (classTableOfReal, 0, U"Multivariate statistics -", nullptr, 0, nullptr);
10558 praat_addAction1 (classTableOfReal, 0, U"To Discriminant", nullptr, 1,
10559 CONVERT_EACH_TO_ONE__TableOfReal_to_Discriminant);
10560 praat_addAction1 (classTableOfReal, 0, U"To PCA", nullptr, 1,
10561 CONVERT_EACH_TO_ONE__TableOfReal_to_PCA_byRows);
10562 praat_addAction1 (classTableOfReal, 0, U"To SSCP...", nullptr, 1,
10563 CONVERT_EACH_TO_ONE__TableOfReal_to_SSCP);
10564 praat_addAction1 (classTableOfReal, 0, U"To SSCP (row weights)...", nullptr, 1,
10565 CONVERT_EACH_TO_ONE__TableOfReal_to_SSCP_rowWeights);
10566 praat_addAction1 (classTableOfReal, 0, U"To Covariance", nullptr, 1,
10567 CONVERT_EACH_TO_ONE__TableOfReal_to_Covariance);
10568 praat_addAction1 (classTableOfReal, 0, U"To Correlation", nullptr, 1,
10569 CONVERT_EACH_TO_ONE__TableOfReal_to_Correlation);
10570 praat_addAction1 (classTableOfReal, 0, U"To Correlation (rank)", nullptr, 1,
10571 CONVERT_EACH_TO_ONE__TableOfReal_to_Correlation_rank);
10572 praat_addAction1 (classTableOfReal, 0, U"To CCA...", nullptr, 1,
10573 CONVERT_EACH_TO_ONE__TableOfReal_to_CCA);
10574 praat_addAction1 (classTableOfReal, 0, U"To TableOfReal (means by row labels)...", nullptr, 1,
10575 CONVERT_EACH_TO_ONE__TableOfReal_meansByRowLabels);
10576 praat_addAction1 (classTableOfReal, 0, U"To TableOfReal (medians by row labels)...", nullptr, 1,
10577 CONVERT_EACH_TO_ONE__TableOfReal_mediansByRowLabels);
10578 praat_addAction1 (classTableOfReal, 0, U"To TableOfReal (rank columns)...", nullptr, GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
10579 CONVERT_EACH_TO_ONE__TableOfReal_to_TableOfReal_rankColumns);
10580 praat_addAction1 (classTableOfReal, 0, U"-- configurations --", nullptr, 1, 0);
10581 praat_addAction1 (classTableOfReal, 0, U"To Configuration (pca)...", nullptr, 1,
10582 CONVERT_EACH_TO_ONE__TableOfReal_to_Configuration_pca);
10583 praat_addAction1 (classTableOfReal, 0, U"To Configuration (lda)...", nullptr, 1,
10584 CONVERT_EACH_TO_ONE__TableOfReal_to_Configuration_lda);
10585 praat_addAction1 (classTableOfReal, 2, U"-- between tables --", nullptr, 1, 0);
10586 praat_addAction1 (classTableOfReal, 2, U"To TableOfReal (cross-correlations)...", nullptr, GuiMenu_HIDDEN | GuiMenu_DEPTH_1,
10587 CONVERT_TWO_TO_ONE__TableOfReal_TableOfReal_crossCorrelations);
10588
10589 praat_addAction1 (classTableOfReal, 1, U"To PatternList and Categories... || To Pattern and Categories... || Split into Pattern and Categories...", U"To Matrix", 1,
10590 CONVERT_EACH_TO_ONE__TableOfReal_to_PatternList_and_Categories); // alternatives COMPATIBILITY <= 2015
10591 praat_addAction1 (classTableOfReal, 0, U"To Permutation (sort row labels)", U"To Matrix", 1,
10592 CONVERT_EACH_TO_ONE__TableOfReal_to_Permutation_sortRowlabels);
10593
10594 praat_addAction1 (classTableOfReal, 1, U"To SVD", nullptr, GuiMenu_HIDDEN,
10595 CONVERT_EACH_TO_ONE__TableOfReal_to_SVD);
10596 praat_addAction1 (classTableOfReal, 2, U"To GSVD", nullptr, GuiMenu_HIDDEN,
10597 CONVERT_TWO_TO_ONE__TablesOfReal_to_GSVD);
10598 praat_addAction1 (classTableOfReal, 2, U"To Eigen (gsvd)", nullptr, GuiMenu_HIDDEN,
10599 CONVERT_TWO_TO_ONE__TablesOfReal_to_Eigen_gsvd);
10600
10601 praat_addAction1 (classTableOfReal, 0, U"To TableOfReal (cholesky)...", nullptr, GuiMenu_HIDDEN,
10602 CONVERT_EACH_TO_ONE__TableOfReal_choleskyDecomposition);
10603
10604 praat_addAction1 (classTableOfReal, 0, U"Draw as scalable squares...", U"Draw as squares...", 1,
10605 GRAPHICS_EACH__TableOfReal_drawAsScalableSquares);
10606 praat_addAction1 (classTableOfReal, 0, U"-- scatter plots --", U"Draw top and bottom lines...", 1, nullptr);
10607 praat_addAction1 (classTableOfReal, 0, U"Draw scatter plot...", U"-- scatter plots --", 1,
10608 GRAPHICS_EACH__TableOfReal_drawScatterPlot);
10609 praat_addAction1 (classTableOfReal, 0, U"Draw scatter plot matrix...", U"Draw scatter plot...", 1,
10610 GRAPHICS_EACH__TableOfReal_drawScatterPlotMatrix);
10611 praat_addAction1 (classTableOfReal, 0, U"Draw box plots...", U"Draw scatter plot matrix...", 1,
10612 GRAPHICS_EACH__TableOfReal_drawBoxPlots);
10613 praat_addAction1 (classTableOfReal, 0, U"Draw biplot...", U"Draw box plots...", 1,
10614 GRAPHICS_EACH__TableOfReal_drawBiplot);
10615 praat_addAction1 (classTableOfReal, 0, U"Draw vectors...", U"Draw box plots...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10616 GRAPHICS_EACH__TableOfReal_drawVectors);
10617 praat_addAction1 (classTableOfReal, 1, U"Draw row as histogram...", U"Draw biplot...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10618 GRAPHICS_EACH__TableOfReal_drawRowAsHistogram);
10619 praat_addAction1 (classTableOfReal, 1, U"Draw rows as histogram...", U"Draw row as histogram...", GuiMenu_DEPTH_1 | GuiMenu_HIDDEN,
10620 GRAPHICS_EACH__TableOfReal_drawRowsAsHistogram);
10621 praat_addAction1 (classTableOfReal, 1, U"Draw column as distribution...", U"Draw rows as histogram...", GuiMenu_DEPTH_1,
10622 GRAPHICS_EACH__TableOfReal_drawColumnAsDistribution);
10623
10624 praat_addAction2 (classStrings, 1, classPermutation, 1, U"Permute strings", nullptr, 0,
10625 CONVERT_ONE_AND_ONE_TO_ONE__Strings_Permutation_permuteStrings);
10626
10627 praat_addAction2 (classTableOfReal, 1, classPermutation, 1, U"Permute rows", nullptr, 0,
10628 CONVERT_ONE_AND_ONE_TO_ONE__TableOfReal_Permutation_permuteRows);
10629 praat_addAction2 (classTableOfReal, 1, classPermutation, 1, U"Permute columns", nullptr, 0,
10630 CONVERT_ONE_AND_ONE_TO_ONE__TableOfReal_Permutation_permuteColumns);
10631
10632 praat_addAction1 (classTextGrid, 1, U"Get total duration of intervals where...", U"Count intervals where...", 2,
10633 QUERY_ONE_FOR_REAL__TextGrid_getTotalDurationOfIntervalsWhere);
10634 praat_addAction1 (classTextGrid, 0, U"Extend time...", U"Scale times...", 2,
10635 MODIFY_TextGrid_extendTime);
10636 praat_addAction1 (classTextGrid, 1, U"Set tier name...", U"Remove tier...", 1,
10637 MODIFY_EACH__TextGrid_setTierName);
10638 praat_addAction1 (classTextGrid, 0, U"Replace interval texts... || Replace interval text...", U"Set interval text...", 2,
10639 MODIFY_TextGrid_replaceIntervalTexts); // alternatives COMPATIBILITY <= 2018
10640 praat_addAction1 (classTextGrid, 0, U"Replace point texts... || Replace point text...", U"Set point text...", 2,
10641 MODIFY_TextGrid_replacePointTexts); // alternatives COMPATIBILITY <= 2018
10642 praat_addAction1 (classTextGrid, 2, U"To Table (text alignment)...", U"Extract part...", 0,
10643 CONVERT_TWO_TO_ONE__TextGrids_to_Table_textAlignment);
10644 praat_addAction1 (classTextGrid, 0, U"To DurationTier...", U"Concatenate", 0,
10645 CONVERT_EACH_TO_ONE__TextGrid_to_DurationTier);
10646 praat_addAction1 (classTextGrid, 0, U"To TextGridNavigator (topic only)...", U"To DurationTier...", GuiMenu_HIDDEN,
10647 CONVERT_EACH_TO_ONE__TextGrid_to_TextGridNavigator_topicSearch);
10648 praat_addAction1 (classTextGrid, 0, U"To TextGridNavigator...", U"To DurationTier...", GuiMenu_HIDDEN,
10649 CONVERT_EACH_TO_ONE__TextGrid_to_TextGridNavigator);
10650 praat_addAction2 (classTextGrid, 1, classDurationTier, 1, U"To TextGrid (scale times)", nullptr, 0,
10651 CONVERT_ONE_AND_ONE_TO_ONE__TextGrid_DurationTier_to_TextGrid);
10652
10653 praat_addAction2 (classTextGrid, 2, classEditCostsTable, 1, U"To Table (text alignment)...", nullptr, 0,
10654 CONVERT_TWO_AND_ONE_TO_ONE__TextGrids_EditCostsTable_to_Table_textAlignment);
10655 praat_addAction2 (classTextGrid, 1, classNavigationContext, 1, U"To TextGridNavigator...", nullptr, 0,
10656 CONVERT_ONE_AND_ONE_TO_ONE__TextGrid_and_NavigationContext_to_TextGridNavigator);
10657 praat_addAction2 (classTextGrid, 1, classNavigationContext, 1, U"To TextGridTierNavigator...", nullptr, 0,
10658 CONVERT_ONE_AND_ONE_TO_ONE__TextGrid_and_NavigationContext_to_TextGridTierNavigator);
10659
10660 praat_addAction1 (classTextGridNavigator, 0, U"TextGridNavigator help", nullptr, 0,
10661 HELP__TextGridNavigator_help);
10662 praat_addAction1 (classTextGridNavigator, 0, U"Find first", nullptr, 0,
10663 MODIFY_EACH__TextGridNavigator_findFirst);
10664 praat_addAction1 (classTextGridNavigator, 0, U"Find last", nullptr, 0,
10665 MODIFY_EACH__TextGridNavigator_findLast);
10666 praat_addAction1 (classTextGridNavigator, 0, U"Find next", nullptr, 0,
10667 MODIFY_EACH__TextGridNavigator_findNext);
10668 praat_addAction1 (classTextGridNavigator, 0, U"Find next after time...", nullptr, 0,
10669 MODIFY_EACH__TextGridNavigator_findNextAfterTime);
10670 praat_addAction1 (classTextGridNavigator, 0, U"Find previous", nullptr, 0,
10671 MODIFY_EACH__TextGridNavigator_findPrevious);
10672 praat_addAction1 (classTextGridNavigator, 0, U"Find previous before time...", nullptr, 0,
10673 MODIFY_EACH__TextGridNavigator_findPreviousBeforeTime);
10674
10675 praat_addAction1 (classTextGridNavigator, 0, U"Query -", nullptr, 0, nullptr);
10676 praat_TimeFunction_query_init (classTextGridNavigator);
10677 praat_addAction1 (classTextGridNavigator, 1, U"Get start time...", nullptr, 1,
10678 QUERY_ONE_FOR_REAL__TextGridNavigator_getStartTime);
10679 praat_addAction1 (classTextGridNavigator, 1, U"Get label...", nullptr, 1,
10680 QUERY_ONE_FOR_STRING__TextGridNavigator_getLabel);
10681 praat_addAction1 (classTextGridNavigator, 1, U"Get end time...", nullptr, 1,
10682 QUERY_ONE_FOR_REAL__TextGridNavigator_getEndTime);
10683 praat_addAction1 (classTextGridNavigator, 1, U"Get index...", nullptr, 1,
10684 QUERY_ONE_FOR_INTEGER__TextGridNavigator_getIndex);
10685 praat_addAction1 (classTextGridNavigator, 1, U"-- number of matches --", nullptr, 1, nullptr);
10686 praat_addAction1 (classTextGridNavigator, 1, U"List indices...", nullptr, 1,
10687 QUERY_ONE_FOR_REAL_VECTOR__TextGridNavigator_listIndices);
10688 praat_addAction1 (classTextGridNavigator, 1, U"List start times...", nullptr, 1,
10689 QUERY_ONE_FOR_REAL_VECTOR__TextGridNavigator_listStartTimes);
10690 praat_addAction1 (classTextGridNavigator, 1, U"List labels...", nullptr, 1,
10691 QUERY_ONE_FOR_STRING_ARRAY__TextGridNavigator_listLabels);
10692 praat_addAction1 (classTextGridNavigator, 1, U"List end times...", nullptr, 1,
10693 QUERY_ONE_FOR_REAL_VECTOR__TextGridNavigator_listEndTimes);
10694 praat_addAction1 (classTextGridNavigator, 1, U"List domains...", nullptr, 1,
10695 QUERY_ONE_FOR_MATRIX__TextGridNavigator_listDomains);
10696 praat_addAction1 (classTextGridNavigator, 1, U"Get number of matches", nullptr, 1,
10697 QUERY_ONE_FOR_INTEGER__TextGridNavigator_getNumberOfMatches);
10698 praat_addAction1 (classTextGridNavigator, 1, U"Get number of Topic matches...", nullptr, 1,
10699 QUERY_ONE_FOR_INTEGER__TextGridNavigator_getNumberOfTopicMatches);
10700 praat_addAction1 (classTextGridNavigator, 1, U"Get number of Before matches...", nullptr, 1,
10701 QUERY_ONE_FOR_INTEGER__TextGridNavigator_getNumberOfBeforeMatches);
10702 praat_addAction1 (classTextGridNavigator, 1, U"Get number of After matches...", nullptr, 1,
10703 QUERY_ONE_FOR_INTEGER__TextGridNavigator_getNumberOfAfterMatches);
10704 praat_addAction1 (classTextGridNavigator, 0, U"Modify -", nullptr, 0, nullptr);
10705 praat_addAction1 (classTextGridNavigator, 0, U"Modify Topic match criterion...", nullptr, 1,
10706 MODIFY_EACH__TextGridNavigator_modifyTopicCriterion);
10707 praat_addAction1 (classTextGridNavigator, 0, U"Modify Before match criterion...", nullptr, 1,
10708 MODIFY_EACH__TextGridNavigator_modifyBeforeCriterion);
10709 praat_addAction1 (classTextGridNavigator, 0, U"Modify After match criterion...", nullptr, 1,
10710 MODIFY_EACH__TextGridNavigator_modifyAfterCriterion);
10711 praat_addAction1 (classTextGridNavigator, 0, U"Modify combination criterion...", nullptr, 1,
10712 MODIFY_EACH__TextGridNavigator_modifyCombinationCriterion);
10713 praat_addAction1 (classTextGridNavigator, 0, U"Modify match domain...", nullptr, 1,
10714 MODIFY_EACH__TextGridNavigator_modifyMatchDomain);
10715 praat_addAction1 (classTextGridNavigator, 0, U"Modify match domain alignment...", nullptr, 1,
10716 MODIFY_EACH__TextGridNavigator_modifyMatchDomainAlignment);
10717 praat_addAction1 (classTextGridNavigator, 0, U"-- search range extensions --", nullptr, 1, nullptr);
10718 praat_addAction1 (classTextGridNavigator, 0, U"Modify Before range...", nullptr, 1,
10719 MODIFY_EACH__TextGridNavigator_modifyBeforeRange);
10720 praat_addAction1 (classTextGridNavigator, 0, U"Modify After range...", nullptr, 1,
10721 MODIFY_EACH__TextGridNavigator_modifyAfterRange);
10722
10723 praat_addAction2 (classTextGridNavigator, 1, classNavigationContext, 1, U"Replace navigation context...", nullptr, 0,
10724 MODIFY_FIRST_OF_ONE_AND_ONE__TextGridNavigator_replaceNavigationContext);
10725 praat_addAction2 (classTextGridNavigator, 1, classTextGridTierNavigator, 1, U"Add TextGridTierNavigator...", nullptr, 0,
10726 MODIFY_FIRST_OF_ONE_AND_ONE__TextGridNavigator_addTextGridTierNavigator);
10727 praat_addAction2 (classTextGridNavigator, 1, classTextGrid, 1, U"Replace search tiers", nullptr, 0,
10728 MODIFY_FIRST_OF_ONE_AND_ONE__TextGridNavigator_replaceSearchTiers);
10729 praat_addAction2 (classTextGridNavigator, 1, classTextGrid, 1, U"Add search tier (topic only)...", nullptr, 0,
10730 MODIFY_FIRST_OF_ONE_AND_ONE__TextGridNavigator_addSearchTier_topicOnly);
10731 praat_addAction2 (classTextGridNavigator, 1, classTextGrid, 1, U"Add search tier...", nullptr, 0,
10732 MODIFY_FIRST_OF_ONE_AND_ONE__TextGridNavigator_addSearchTier);
10733
10734 praat_addAction1 (classTextGridTierNavigator, 0, U"To TextGridNavigator", nullptr, 1,
10735 CONVERT_EACH_TO_ONE__TextGridTierNavigator_to_TextGridNavigator);
10736
10737 INCLUDE_MANPAGES (manual_dwtools_init)
10738 INCLUDE_MANPAGES (manual_Permutation_init)
10739
10740 INCLUDE_LIBRARY (praat_MultiSampledSpectrogram_init)
10741 INCLUDE_LIBRARY (praat_MDS_actions_init)
10742 INCLUDE_LIBRARY (praat_HMM_init)
10743 INCLUDE_LIBRARY (praat_BSS_init)
10744 }
10745
10746 /* End of file praat_David_init.cpp */