Debian Codegraph @

fon/praat_uvafon_init.cpp

raw symbols SCIP
1 /* praat_uvafon_init.cpp
2 *
3 * Copyright (C) 1992-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.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this work. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "Cochleagram_and_Excitation.h"
20 #include "Corpus.h"
21 #include "Distributions_and_Strings.h"
22 #include "Distributions_and_Transition.h"
23 #include "Excitation_to_Formant.h"
24 #include "Harmonicity.h"
25 #include "LongSound.h"
26 #include "Ltas_to_SpectrumTier.h"
27 #include "ManipulationEditor.h"
28 #include "Matrix_and_Pitch.h"
29 #include "Matrix_and_PointProcess.h"
30 #include "Matrix_and_Polygon.h"
31 #include "Matrix_extensions.h"
32 #include "Movie.h"
33 #include "ParamCurve.h"
34 #include "Pitch_Intensity.h"
35 #include "Pitch_to_PitchTier.h"
36 #include "Pitch_to_PointProcess.h"
37 #include "Pitch_to_Sound.h"
38 #include "PitchEditor.h"
39 #include "PitchTier_to_PointProcess.h"
40 #include "PitchTier_to_Sound.h"
41 #include "PointEditor.h"
42 #include "PointProcess_and_Sound.h"
43 #include "Praat_tests.h"
44 #include "Sound_and_Spectrogram.h"
45 #include "Sound_and_Spectrum.h"
46 #include "Sound_PointProcess.h"
47 #include "SpectrogramEditor.h"
48 #include "Spectrum_and_Spectrogram.h"
49 #include "Spectrum_to_Excitation.h"
50 #include "Spectrum_to_Formant.h"
51 #include "SpectrumEditor.h"
52 #include "SpellingChecker.h"
53 #include "Strings_extensions.h"
54 #include "StringsEditor.h"
55 #include "TableEditor.h"
56 #include "TextGrid_Sound.h"
57 #include "VocalTract.h"
58 #include "VoiceAnalysis.h"
59 #include "WordList.h"
60
61 #include "praat_TimeTier.h"
62 #include "praat_TimeFrameSampled.h"
63 #include "praat_TimeVector.h"
64 #include "praat_Sound.h"
65 #include "praat_Matrix.h"
66 #include "praat_Tiers.h"
67 #include "praat_ExperimentMFC.h"
68 #include "praat_uvafon_init.h"
69
70 static const conststring32 STRING_FROM_FREQUENCY_HZ = U"left Frequency range (Hz)";
71 static const conststring32 STRING_TO_FREQUENCY_HZ = U"right Frequency range (Hz)";
72
73 // MARK: - COCHLEAGRAM
74
75 // MARK: Help
76
77 DIRECT (HELP_Cochleagram_help) {
78 HELP (U"Cochleagram")
79 }
80
81 // MARK: Movie
82
83 DIRECT (MOVIE_Cochleagram_playMovie) {
84 MOVIE_ONE (Cochleagram, U"Cochleagram movie", 300, 300)
85 Matrix_playMovie (me, graphics);
86 MOVIE_ONE_END
87 }
88
89 // MARK: Info
90
91 FORM (REAL_Cochleagram_difference, U"Cochleagram difference", nullptr) {
92 praat_TimeFunction_RANGE (fromTime, toTime)
93 OK
94 DO
95 QUERY_TWO_FOR_REAL (Cochleagram)
96 const double result = Cochleagram_difference (me, you, fromTime, toTime);
97 QUERY_TWO_FOR_REAL_END (U" hertz (root-mean-square)")
98 }
99
100 // MARK: Draw
101
102 FORM (GRAPHICS_Cochleagram_paint, U"Paint Cochleagram", nullptr) {
103 praat_TimeFunction_RANGE (fromTime, toTime)
104 BOOLEAN (garnish, U"Garnish", true)
105 OK
106 DO
107 GRAPHICS_EACH (Cochleagram)
108 Cochleagram_paint (me, GRAPHICS, fromTime, toTime, garnish);
109 GRAPHICS_EACH_END
110 }
111
112 // MARK: Modify
113
114 FORM (MODIFY_Cochleagram_formula, U"Cochleagram Formula", U"Cochleagram: Formula...") {
115 COMMENT (U"`x` is time in seconds, `y` is place in Bark")
116 COMMENT (U"y := y1; for row := 1 to nrow do { x := x1; "
117 "for col := 1 to ncol do { self [row, col] := `formula` ; x := x + dx } y := y + dy }")
118 FORMULA (formula, U"Formula", U"self")
119 OK
120 DO
121 MODIFY_EACH_WEAK (Cochleagram)
122 Matrix_formula (me, formula, interpreter, nullptr);
123 MODIFY_EACH_WEAK_END
124 }
125
126 // MARK: Analyse
127
128 FORM (NEW_Cochleagram_to_Excitation, U"From Cochleagram to Excitation", nullptr) {
129 REAL (time, U"Time (s)", U"0.0")
130 OK
131 DO
132 CONVERT_EACH_TO_ONE (Cochleagram)
133 autoExcitation result = Cochleagram_to_Excitation (me, time);
134 CONVERT_EACH_TO_ONE_END (my name.get())
135 }
136
137 // MARK: Hack
138
139 DIRECT (NEW_Cochleagram_to_Matrix) {
140 CONVERT_EACH_TO_ONE (Cochleagram)
141 autoMatrix result = Cochleagram_to_Matrix (me);
142 CONVERT_EACH_TO_ONE_END (my name.get())
143 }
144
145 // MARK: - CORPUS
146
147 // MARK: New
148
149 FORM (NEW1_Corpus_create, U"Create Corpus", U"Create Corpus...") {
150 WORD (name, U"Name", U"myCorpus")
151 FOLDER (folderWithSoundFiles, U"Folder with sound files", U"")
152 WORD (soundFileExtension, U"Sound file extension", U"wav")
153 FOLDER (folderWithAnnotationFiles, U"Folder with annotation files", U"")
154 WORD (annotationFileExtension, U"Annotation file extension", U"TextGrid")
155 OK
156 DO
157 CREATE_ONE
158 autoCorpus result = Corpus_create (folderWithSoundFiles, soundFileExtension, folderWithAnnotationFiles, annotationFileExtension);
159 CREATE_ONE_END (name)
160 }
161
162 // MARK: View & Edit
163
164 DIRECT (EDITOR_ONE_Corpus_edit) {
165 EDITOR_ONE (a,Corpus)
166 autoTableEditor editor = TableEditor_create (ID_AND_FULL_NAME, me);
167 EDITOR_ONE_END
168 }
169
170 // MARK: - DISTRIBUTIONS
171
172 FORM (NEW_Distributions_to_Transition, U"To Transition", nullptr) {
173 NATURAL (environment, U"Environment", U"1")
174 BOOLEAN (greedy, U"Greedy", true)
175 OK
176 DO
177 CONVERT_EACH_TO_ONE (Distributions)
178 autoTransition result = Distributions_to_Transition (me, nullptr, environment, nullptr, greedy);
179 CONVERT_EACH_TO_ONE_END (my name.get())
180 }
181
182 FORM (NEW1_Distributions_to_Transition_adj, U"To Transition", nullptr) {
183 NATURAL (environment, U"Environment", U"1")
184 BOOLEAN (greedy, U"Greedy", true)
185 OK
186 DO
187 CONVERT_ONE_AND_ONE_TO_ONE (Distributions, Transition)
188 autoTransition result = Distributions_to_Transition (me, nullptr, environment, you, greedy);
189 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get())
190 }
191
192 FORM (NEW1_Distributions_to_Transition_noise, U"To Transition (noise)", nullptr) {
193 NATURAL (environment, U"Environment", U"1")
194 BOOLEAN (greedy, U"Greedy", true)
195 OK
196 DO
197 CONVERT_TWO_TO_ONE (Distributions)
198 autoTransition result = Distributions_to_Transition (me, you, environment, nullptr, greedy);
199 CONVERT_TWO_TO_ONE_END (my name.get())
200 }
201
202 FORM (NEW1_Distributions_to_Transition_noise_adj, U"To Transition (noise)", nullptr) {
203 NATURAL (environment, U"Environment", U"1")
204 BOOLEAN (greedy, U"Greedy", true)
205 OK
206 DO
207 CONVERT_TWO_AND_ONE_TO_ONE (Distributions, Transition)
208 autoTransition result = Distributions_to_Transition (me, you, environment, him, greedy);
209 CONVERT_TWO_AND_ONE_TO_ONE_END (my name.get())
210 }
211
212 // MARK: - DISTRIBUTIONS & TRANSITION
213
214 DIRECT (NEW1_Distributions_Transition_map) {
215 CONVERT_ONE_AND_ONE_TO_ONE (Distributions, Transition)
216 autoDistributions result = Distributions_Transition_map (me, you);
217 CONVERT_ONE_AND_ONE_TO_ONE_END (U"surface")
218 }
219
220 // MARK: - EXCITATION
221
222 // MARK: Help
223
224 DIRECT (HELP_Excitation_help) {
225 HELP (U"Excitation")
226 }
227
228 // MARK: Draw
229
230 FORM (GRAPHICS_Excitation_draw, U"Draw Excitation", nullptr) {
231 REAL (fromFrequency, U"From frequency (Bark)", U"0.0")
232 REAL (toFrequency, U"To frequency (Bark)", U"25.6")
233 REAL (minimum, U"Minimum (phon)", U"0.0")
234 REAL (maximum, U"Maximum (phon)", U"100.0")
235 BOOLEAN (garnish, U"Garnish", true)
236 OK
237 DO
238 GRAPHICS_EACH (Excitation)
239 Excitation_draw (me, GRAPHICS, fromFrequency, toFrequency, minimum, maximum, garnish);
240 GRAPHICS_EACH_END
241 }
242
243 // MARK: Query
244
245 DIRECT (REAL_Excitation_getLoudness) {
246 QUERY_ONE_FOR_REAL (Excitation)
247 const double result = Excitation_getLoudness (me);
248 QUERY_ONE_FOR_REAL_END (U" sones")
249 }
250
251 // MARK: Modify
252
253 FORM (MODIFY_Excitation_formula, U"Excitation Formula", U"Excitation: Formula...") {
254 COMMENT (U"`x` is the place in Bark, `col` is the bin number")
255 COMMENT (U"x := 0; for col := 1 to ncol do { self [1, col] := `formula` ; x := x + dx }")
256 FORMULA (formula, U"Formula", U"self")
257 OK
258 DO
259 MODIFY_EACH_WEAK (Excitation)
260 Matrix_formula (me, formula, interpreter, nullptr);
261 MODIFY_EACH_WEAK_END
262 }
263
264 // MARK: Convert
265
266 FORM (NEW_Excitation_to_Formant, U"From Excitation to Formant", 0) {
267 NATURAL (maximumNumberOfFormants, U"Maximum number of formants", U"20")
268 OK
269 DO
270 CONVERT_EACH_TO_ONE (Excitation)
271 autoFormant result = Excitation_to_Formant (me, maximumNumberOfFormants);
272 CONVERT_EACH_TO_ONE_END (my name.get())
273 }
274
275 DIRECT (NEW_Excitation_to_Matrix) {
276 CONVERT_EACH_TO_ONE (Excitation)
277 autoMatrix result = Excitation_to_Matrix (me);
278 CONVERT_EACH_TO_ONE_END (my name.get())
279 }
280
281 // MARK: - FORMANT
282
283 // MARK: Help
284
285 DIRECT (HELP_Formant_help) {
286 HELP (U"Formant")
287 }
288
289 // MARK: Draw
290
291 FORM (GRAPHICS_Formant_drawSpeckles, U"Draw Formant", U"Formant: Draw speckles...") {
292 praat_TimeFunction_RANGE (fromTime, toTime)
293 POSITIVE (maximumFrequency, U"Maximum frequency (Hz)", U"5500.0")
294 REAL (dynamicRange, U"Dynamic range (dB)", U"30.0")
295 BOOLEAN (garnish, U"Garnish", 1)
296 OK
297 DO
298 GRAPHICS_EACH (Formant)
299 Formant_drawSpeckles (me, GRAPHICS, fromTime, toTime, maximumFrequency, dynamicRange, garnish);
300 GRAPHICS_EACH_END
301 }
302
303 FORM (GRAPHICS_Formant_drawTracks, U"Draw formant tracks", U"Formant: Draw tracks...") {
304 praat_TimeFunction_RANGE (fromTime, toTime)
305 POSITIVE (maximumFrequency, U"Maximum frequency (Hz)", U"5500.0")
306 BOOLEAN (garnish, U"Garnish", 1)
307 OK
308 DO
309 GRAPHICS_EACH (Formant)
310 Formant_drawTracks (me, GRAPHICS, fromTime, toTime, maximumFrequency, garnish);
311 GRAPHICS_EACH_END
312 }
313
314 FORM (GRAPHICS_Formant_scatterPlot, U"Formant: Scatter plot", nullptr) {
315 praat_TimeFunction_RANGE (fromTime, toTime)
316 NATURAL (horizontalFormantNumber, U"Horizontal formant number", U"2")
317 REAL (left, U"left Horizontal range (Hz)", U"3000.0")
318 REAL (right, U"right Horizontal range (Hz)", U"400.0")
319 NATURAL (verticalFormantNumber, U"Vertical formant number", U"1")
320 REAL (bottom, U"left Vertical range (Hz)", U"1500.0")
321 REAL (top, U"right Vertical range (Hz)", U"100.0")
322 POSITIVE (markSize, U"Mark size (mm)", U"1.0")
323 BOOLEAN (garnish, U"Garnish", true)
324 SENTENCE (markString, U"Mark string (+xo.)", U"+")
325 OK
326 DO
327 GRAPHICS_EACH (Formant)
328 Formant_scatterPlot (me, GRAPHICS, fromTime, toTime,
329 horizontalFormantNumber, left, right, verticalFormantNumber, bottom, top,
330 markSize, markString, garnish
331 );
332 GRAPHICS_EACH_END
333 }
334
335 // MARK: Tabulate
336
337 FORM (LIST_Formant_list, U"Formant: List", nullptr) {
338 BOOLEAN (includeFrameNumber, U"Include frame number", false)
339 BOOLEAN (includeTime, U"Include time", true)
340 NATURAL (numberOfTimeDecimals, U"Number of time decimals", U"6")
341 BOOLEAN (includeIntensity, U"Include intensity", false)
342 NATURAL (numberOfIntensityDecimals, U"Number of intensity decimals", U"3")
343 BOOLEAN (includeNumberOfFormants, U"Include number of formants", true)
344 NATURAL (numberOfFrequencyDecimals, U"Number of frequency decimals", U"3")
345 BOOLEAN (includeBandwidths, U"Include bandwidths", true)
346 OK
347 DO
348 INFO_ONE (Formant)
349 Formant_list (me, includeFrameNumber,
350 includeTime, numberOfTimeDecimals,
351 includeIntensity, numberOfIntensityDecimals,
352 includeNumberOfFormants, numberOfFrequencyDecimals, includeBandwidths
353 );
354 INFO_ONE_END
355 }
356
357 FORM (NEW_Formant_downto_Table, U"Formant: Down to Table", nullptr) {
358 BOOLEAN (includeFrameNumber, U"Include frame number", false)
359 BOOLEAN (includeTime, U"Include time", true)
360 NATURAL (numberOfTimeDecimals, U"Number of time decimals", U"6")
361 BOOLEAN (includeIntensity, U"Include intensity", false)
362 NATURAL (numberOfIntensityDecimals, U"Number of intensity decimals", U"3")
363 BOOLEAN (includeNumberOfFormants, U"Include number of formants", true)
364 NATURAL (numberOfFrequencyDecimals, U"Number of frequency decimals", U"3")
365 BOOLEAN (includeBandwidths, U"Include bandwidths", true)
366 OK
367 DO
368 CONVERT_EACH_TO_ONE (Formant)
369 autoTable result = Formant_downto_Table (me, includeFrameNumber, includeTime, numberOfTimeDecimals,
370 includeIntensity, numberOfIntensityDecimals, includeNumberOfFormants, numberOfFrequencyDecimals,
371 includeBandwidths
372 );
373 CONVERT_EACH_TO_ONE_END (my name.get())
374 }
375
376 // MARK: Query
377
378 FORM (REAL_Formant_getValueAtTime, U"Formant: Get value", U"Formant: Get value at time...") {
379 NATURAL (formantNumber, U"Formant number", U"1")
380 REAL (time, U"Time (s)", U"0.5")
381 CHOICE_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
382 CHOICE (interpolation, U"Interpolation", 1) // ignored
383 OPTION (U"linear")
384 OK
385 DO
386 QUERY_ONE_FOR_REAL (Formant)
387 const double result = Formant_getValueAtTime (me, formantNumber, time, unit);
388 QUERY_ONE_FOR_REAL_END (U" ", kFormant_unit_getText (unit))
389 }
390
391 FORM (REAL_Formant_getBandwidthAtTime, U"Formant: Get bandwidth", U"Formant: Get bandwidth at time...") {
392 NATURAL (formantNumber, U"Formant number", U"1")
393 REAL (time, U"Time (s)", U"0.5")
394 CHOICE_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
395 CHOICE (interpolation, U"Interpolation", 1) // ignored
396 OPTION (U"linear")
397 OK
398 DO
399 QUERY_ONE_FOR_REAL (Formant)
400 const double result = Formant_getBandwidthAtTime (me, formantNumber, time, unit);
401 QUERY_ONE_FOR_REAL_END (U" ", kFormant_unit_getText (unit))
402 }
403
404 FORM (REAL_Formant_getMinimum, U"Formant: Get minimum", U"Formant: Get minimum...") {
405 NATURAL (formantNumber, U"Formant number", U"1")
406 praat_TimeFunction_RANGE (fromTime, toTime)
407 CHOICE_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
408 CHOICEx (interpolation, U"Interpolation", 2, 0)
409 OPTION (U"none")
410 OPTION (U"parabolic")
411 OK
412 DO
413 QUERY_ONE_FOR_REAL (Formant)
414 const double result = Formant_getMinimum (me, formantNumber, fromTime, toTime, unit, interpolation);
415 QUERY_ONE_FOR_REAL_END (U" ", kFormant_unit_getText (unit))
416 }
417
418 FORM (REAL_Formant_getMaximum, U"Formant: Get maximum", U"Formant: Get maximum...") {
419 NATURAL (formantNumber, U"Formant number", U"1")
420 praat_TimeFunction_RANGE (fromTime, toTime)
421 CHOICE_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
422 CHOICEx (interpolation, U"Interpolation", 2, 0)
423 OPTION (U"none")
424 OPTION (U"parabolic")
425 OK
426 DO
427 QUERY_ONE_FOR_REAL (Formant)
428 const double result = Formant_getMaximum (me, formantNumber, fromTime, toTime, unit, interpolation);
429 QUERY_ONE_FOR_REAL_END (U" ", kFormant_unit_getText (unit))
430 }
431
432 FORM (REAL_Formant_getTimeOfMinimum, U"Formant: Get time of minimum", U"Formant: Get time of minimum...") {
433 NATURAL (formantNumber, U"Formant number", U"1")
434 praat_TimeFunction_RANGE (fromTime, toTime)
435 CHOICE_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
436 CHOICEx (interpolation, U"Interpolation", 2, 0)
437 OPTION (U"none")
438 OPTION (U"parabolic")
439 OK
440 DO
441 QUERY_ONE_FOR_REAL (Formant)
442 const double result = Formant_getTimeOfMinimum (me, formantNumber, fromTime, toTime, unit, interpolation);
443 QUERY_ONE_FOR_REAL_END (U" seconds")
444 }
445
446 FORM (REAL_Formant_getTimeOfMaximum, U"Formant: Get time of maximum", U"Formant: Get time of maximum...") {
447 NATURAL (formantNumber, U"Formant number", U"1")
448 praat_TimeFunction_RANGE (fromTime, toTime)
449 CHOICE_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
450 CHOICEx (interpolation, U"Interpolation", 2, 0)
451 OPTION (U"none")
452 OPTION (U"parabolic")
453 OK
454 DO
455 QUERY_ONE_FOR_REAL (Formant)
456 const double result = Formant_getTimeOfMaximum (me, formantNumber, fromTime, toTime, unit, interpolation);
457 QUERY_ONE_FOR_REAL_END (U" seconds")
458 }
459
460 DIRECT (INTEGER_Formant_getMaximumNumberOfFormants) {
461 QUERY_ONE_FOR_REAL (Formant)
462 const integer result = Formant_getMaxNumFormants (me);
463 QUERY_ONE_FOR_REAL_END (U" (there are at most this many formants in every frame)")
464 }
465
466 FORM (REAL_Formant_getMean, U"Formant: Get mean", U"Formant: Get mean...") {
467 NATURAL (formantNumber, U"Formant number", U"1")
468 praat_TimeFunction_RANGE (fromTime, toTime)
469 CHOICE_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
470 OK
471 DO
472 QUERY_ONE_FOR_REAL (Formant)
473 const double result = Formant_getMean (me, formantNumber, fromTime, toTime, unit);
474 QUERY_ONE_FOR_REAL_END (U" ", kFormant_unit_getText (unit))
475 }
476
477 DIRECT (INTEGER_Formant_getMinimumNumberOfFormants) {
478 QUERY_ONE_FOR_REAL (Formant)
479 const integer result = Formant_getMinNumFormants (me);
480 QUERY_ONE_FOR_REAL_END (U" (there are at least this many formants in every frame)");
481 }
482
483 FORM (INTEGER_Formant_getNumberOfFormants, U"Formant: Get number of formants", U"Formant: Get number of formants...") {
484 NATURAL (frameNumber, U"Frame number", U"1")
485 OK
486 DO
487 QUERY_ONE_FOR_REAL (Formant)
488 if (frameNumber > my nx)
489 Melder_throw (U"There is no frame ", frameNumber, U" in a Formant with only ", my nx, U" frames.");
490 const integer result = my frames [frameNumber]. numberOfFormants;
491 QUERY_ONE_FOR_REAL_END (U" formants")
492 }
493
494 FORM (REAL_Formant_getQuantile, U"Formant: Get quantile", nullptr) {
495 NATURAL (formantNumber, U"Formant number", U"1")
496 praat_TimeFunction_RANGE (fromTime, toTime)
497 CHOICE_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
498 REAL (quantile, U"Quantile", U"0.50 (= median)")
499 OK
500 DO
501 QUERY_ONE_FOR_REAL (Formant)
502 const double result = Formant_getQuantile (me, formantNumber, quantile, fromTime, toTime, unit);
503 QUERY_ONE_FOR_REAL_END (U" ", kFormant_unit_getText (unit))
504 }
505
506 FORM (REAL_Formant_getQuantileOfBandwidth, U"Formant: Get quantile of bandwidth", nullptr) {
507 NATURAL (formantNumber, U"Formant number", U"1")
508 praat_TimeFunction_RANGE (fromTime, toTime)
509 CHOICE_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
510 REAL (quantile, U"Quantile", U"0.50 (= median)")
511 OK
512 DO
513 QUERY_ONE_FOR_REAL (Formant)
514 const double result = Formant_getQuantileOfBandwidth (me, formantNumber, quantile, fromTime, toTime, unit);
515 QUERY_ONE_FOR_REAL_END (U" ", kFormant_unit_getText (unit))
516 }
517
518 FORM (REAL_Formant_getStandardDeviation, U"Formant: Get standard deviation", nullptr) {
519 NATURAL (formantNumber, U"Formant number", U"1")
520 praat_TimeFunction_RANGE (fromTime, toTime)
521 CHOICE_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
522 OK
523 DO
524 QUERY_ONE_FOR_REAL (Formant)
525 const double result = Formant_getStandardDeviation (me, formantNumber, fromTime, toTime, unit);
526 QUERY_ONE_FOR_REAL_END (U" ", kFormant_unit_getText (unit))
527 }
528
529 // MARK: Modify
530
531 DIRECT (MODIFY_Formant_sort) {
532 MODIFY_EACH (Formant)
533 Formant_sort (me);
534 MODIFY_EACH_END
535 }
536
537 FORM (MODIFY_Formant_formula_frequencies, U"Formant: Formula (frequencies)", U"Formant: Formula (frequencies)...") {
538 COMMENT (U"row is formant number, col is frame number: for row from 1 to nrow do for col from 1 to ncol do F (row, col) :=")
539 FORMULA (formula, U"Formula", U"if row = 2 then self + 200 else self fi")
540 OK
541 DO
542 MODIFY_EACH_WEAK (Formant)
543 Formant_formula_frequencies (me, formula, interpreter);
544 MODIFY_EACH_WEAK_END
545 }
546
547 FORM (MODIFY_Formant_formula_bandwidths, U"Formant: Formula (bandwidths)", U"Formant: Formula (bandwidths)...") {
548 COMMENT (U"row is formant number, col is frame number: for row from 1 to nrow do for col from 1 to ncol do B (row, col) :=")
549 FORMULA (formula, U"Formula", U"self / 2 ; sharpen all peaks")
550 OK
551 DO
552 MODIFY_EACH_WEAK (Formant)
553 Formant_formula_bandwidths (me, formula, interpreter);
554 MODIFY_EACH_WEAK_END
555 }
556
557 // MARK: Convert
558
559 FORM (NEW_Formant_tracker, U"Formant tracker", U"Formant: Track...") {
560 NATURAL (numberOfTracks, U"Number of tracks (1-5)", U"3")
561 REAL (referenceF1, U"Reference F1 (Hz)", U"550")
562 REAL (referenceF2, U"Reference F2 (Hz)", U"1650")
563 REAL (referenceF3, U"Reference F3 (Hz)", U"2750")
564 REAL (referenceF4, U"Reference F4 (Hz)", U"3850")
565 REAL (referenceF5, U"Reference F5 (Hz)", U"4950")
566 REAL (frequencyCost, U"Frequency cost (/kHz)", U"1.0")
567 REAL (bandwidthCost, U"Bandwidth cost", U"1.0")
568 REAL (transitionCost, U"Transition cost (/octave)", U"1.0")
569 OK
570 DO
571 if (numberOfTracks > 5) Melder_throw (U"Your number of tracks should not be more than 5.");
572 CONVERT_EACH_TO_ONE (Formant)
573 autoFormant result = Formant_tracker (me, numberOfTracks,
574 referenceF1, referenceF2, referenceF3, referenceF4, referenceF5,
575 frequencyCost, bandwidthCost, transitionCost
576 );
577 CONVERT_EACH_TO_ONE_END (my name.get())
578 }
579
580 DIRECT (NEW_Formant_downto_FormantGrid) {
581 CONVERT_EACH_TO_ONE (Formant)
582 autoFormantGrid result = Formant_downto_FormantGrid (me);
583 CONVERT_EACH_TO_ONE_END (my name.get())
584 }
585
586 DIRECT (NEW_Formant_downto_FormantTier) {
587 CONVERT_EACH_TO_ONE (Formant)
588 autoFormantTier result = Formant_downto_FormantTier (me);
589 CONVERT_EACH_TO_ONE_END (my name.get())
590 }
591
592 FORM (NEW_Formant_to_Matrix, U"From Formant to Matrix", nullptr) {
593 INTEGER (formantNumber, U"Formant number", U"1")
594 OK
595 DO
596 CONVERT_EACH_TO_ONE (Formant)
597 autoMatrix result = Formant_to_Matrix (me, formantNumber);
598 CONVERT_EACH_TO_ONE_END (my name.get())
599 }
600
601 // MARK: - FORMANT & POINTPROCESS
602
603 DIRECT (NEW1_Formant_PointProcess_to_FormantTier) {
604 CONVERT_ONE_AND_ONE_TO_ONE (Formant, PointProcess)
605 autoFormantTier result = Formant_PointProcess_to_FormantTier (me, you);
606 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
607 }
608
609 // MARK: - FORMANT & SOUND
610
611 DIRECT (NEW1_Sound_Formant_filter) {
612 CONVERT_ONE_AND_ONE_TO_ONE (Sound, Formant)
613 autoSound result = Sound_Formant_filter (me, you);
614 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_filt")
615 }
616
617 DIRECT (NEW1_Sound_Formant_filter_noscale) {
618 CONVERT_ONE_AND_ONE_TO_ONE (Sound, Formant)
619 autoSound result = Sound_Formant_filter_noscale (me, you);
620 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_filt")
621 }
622
623 // MARK: - HARMONICITY
624
625 // MARK: Help
626
627 DIRECT (HELP_Harmonicity_help) {
628 HELP (U"Harmonicity")
629 }
630
631 // MARK: Draw
632
633 FORM (GRAPHICS_Harmonicity_draw, U"Draw harmonicity", nullptr) {
634 praat_TimeFunction_RANGE (fromTime, toTime)
635 REAL (minimum, U"Minimum", U"0.0")
636 REAL (maximum, U"Maximum", U"0.0 (= auto)")
637 OK
638 DO
639 GRAPHICS_EACH (Harmonicity);
640 Matrix_drawRows (me, GRAPHICS, fromTime, toTime, 0.0, 0.0, minimum, maximum);
641 GRAPHICS_EACH_END
642 }
643
644 // MARK: Query
645
646 FORM (REAL_Harmonicity_getMaximum, U"Harmonicity: Get maximum", U"Harmonicity: Get maximum...") {
647 praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
648 OK
649 DO
650 QUERY_ONE_FOR_REAL (Harmonicity)
651 const double result = Vector_getMaximum (me, fromTime, toTime, interpolation);
652 QUERY_ONE_FOR_REAL_END (U" dB")
653 }
654
655 FORM (REAL_Harmonicity_getMean, U"Harmonicity: Get mean", U"Harmonicity: Get mean...") {
656 praat_TimeFunction_RANGE (fromTime, toTime)
657 OK
658 DO
659 QUERY_ONE_FOR_REAL (Harmonicity)
660 const double result = Harmonicity_getMean (me, fromTime, toTime);
661 QUERY_ONE_FOR_REAL_END (U" dB")
662 }
663
664 FORM (REAL_Harmonicity_getMinimum, U"Harmonicity: Get minimum", U"Harmonicity: Get minimum...") {
665 praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
666 OK
667 DO
668 QUERY_ONE_FOR_REAL (Harmonicity)
669 const double result = Vector_getMinimum (me, fromTime, toTime, interpolation);
670 QUERY_ONE_FOR_REAL_END (U" dB")
671 }
672
673 FORM (REAL_Harmonicity_getStandardDeviation, U"Harmonicity: Get standard deviation", U"Harmonicity: Get standard deviation...") {
674 praat_TimeFunction_RANGE (fromTime, toTime)
675 OK
676 DO
677 QUERY_ONE_FOR_REAL (Harmonicity)
678 const double result = Harmonicity_getStandardDeviation (me, fromTime, toTime);
679 QUERY_ONE_FOR_REAL_END (U" dB")
680 }
681
682 FORM (REAL_Harmonicity_getTimeOfMaximum, U"Harmonicity: Get time of maximum", U"Harmonicity: Get time of maximum...") {
683 praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
684 OK
685 DO
686 QUERY_ONE_FOR_REAL (Harmonicity)
687 const double result = Vector_getXOfMaximum (me, fromTime, toTime, interpolation);
688 QUERY_ONE_FOR_REAL_END (U" seconds")
689 }
690
691 FORM (REAL_Harmonicity_getTimeOfMinimum, U"Harmonicity: Get time of minimum", U"Harmonicity: Get time of minimum...") {
692 praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
693 OK
694 DO
695 QUERY_ONE_FOR_REAL (Harmonicity)
696 const double result = Vector_getXOfMinimum (me, fromTime, toTime, interpolation);
697 QUERY_ONE_FOR_REAL_END (U" seconds")
698 }
699
700 FORM (REAL_Harmonicity_getValueAtTime, U"Harmonicity: Get value", U"Harmonicity: Get value at time...") {
701 praat_TimeVector_INTERPOLATED_VALUE (time, interpolation)
702 OK
703 DO
704 QUERY_ONE_FOR_REAL (Harmonicity)
705 const double result = Vector_getValueAtX (me, time, 1, interpolation);
706 QUERY_ONE_FOR_REAL_END (U" dB")
707 }
708
709 FORM (REAL_Harmonicity_getValueInFrame, U"Get value in frame", U"Harmonicity: Get value in frame...") {
710 INTEGER (frameNumber, U"Frame number", U"10")
711 OK
712 DO
713 QUERY_ONE_FOR_REAL (Harmonicity)
714 const double result = ( frameNumber < 1 || frameNumber > my nx ? undefined : my z [1] [frameNumber] );
715 QUERY_ONE_FOR_REAL_END (U" dB")
716 }
717
718 // MARK: Modify
719
720 FORM (MODIFY_Harmonicity_formula, U"Harmonicity Formula", U"Harmonicity: Formula...") {
721 COMMENT (U"`x` is time")
722 COMMENT (U"for col := 1 to ncol do { self [col] := `formula` ; x := x + dx }")
723 FORMULA (formula, U"Formula", U"self")
724 OK
725 DO
726 MODIFY_EACH_WEAK (Harmonicity)
727 Matrix_formula (me, formula, interpreter, nullptr);
728 MODIFY_EACH_WEAK_END
729 }
730
731 // MARK: Convert
732
733 DIRECT (NEW_Harmonicity_to_Matrix) {
734 CONVERT_EACH_TO_ONE (Harmonicity)
735 autoMatrix result = Harmonicity_to_Matrix (me);
736 CONVERT_EACH_TO_ONE_END (my name.get())
737 }
738
739 // MARK: - INTENSITY
740
741 // MARK: Help
742
743 DIRECT (HELP_Intensity_help) {
744 HELP (U"Intensity")
745 }
746
747 // MARK: Draw
748
749 FORM (GRAPHICS_Intensity_draw, U"Draw Intensity", nullptr) {
750 praat_TimeFunction_RANGE (fromTime, toTime)
751 REAL (minimum, U"Minimum (dB)", U"0.0")
752 REAL (maximum, U"Maximum (dB)", U"0.0 (= auto)")
753 BOOLEAN (garnish, U"Garnish", true)
754 OK
755 DO
756 GRAPHICS_EACH (Intensity)
757 Intensity_draw (me, GRAPHICS, fromTime, toTime, minimum, maximum, garnish);
758 GRAPHICS_EACH_END
759 }
760
761 // MARK: Query
762
763 FORM (REAL_Intensity_getValueAtTime, U"Intensity: Get value", U"Intensity: Get value at time...") {
764 praat_TimeVector_INTERPOLATED_VALUE (time, interpolation)
765 OK
766 DO
767 QUERY_ONE_FOR_REAL (Intensity)
768 const double result = Vector_getValueAtX (me, time, 1, interpolation);
769 QUERY_ONE_FOR_REAL_END (U" dB")
770 }
771
772 FORM (REAL_Intensity_getValueInFrame, U"Get value in frame", U"Intensity: Get value in frame...") {
773 INTEGER (frameNumber, U"Frame number", U"10")
774 OK
775 DO
776 QUERY_ONE_FOR_REAL (Intensity)
777 const double result = ( frameNumber < 1 || frameNumber > my nx ? undefined : my z [1] [frameNumber] );
778 QUERY_ONE_FOR_REAL_END (U" dB")
779 }
780
781 FORM (REAL_Intensity_getMinimum, U"Intensity: Get minimum", U"Intensity: Get minimum...") {
782 praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
783 OK
784 DO
785 QUERY_ONE_FOR_REAL (Intensity)
786 const double result = Vector_getMinimum (me, fromTime, toTime, interpolation);
787 QUERY_ONE_FOR_REAL_END (U" dB")
788 }
789
790 FORM (REAL_Intensity_getTimeOfMinimum, U"Intensity: Get time of minimum", U"Intensity: Get time of minimum...") {
791 praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
792 OK
793 DO
794 QUERY_ONE_FOR_REAL (Intensity)
795 const double result = Vector_getXOfMinimum (me, fromTime, toTime, interpolation);
796 QUERY_ONE_FOR_REAL_END (U" seconds")
797 }
798
799 FORM (REAL_Intensity_getMaximum, U"Intensity: Get maximum", U"Intensity: Get maximum...") {
800 praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
801 OK
802 DO
803 QUERY_ONE_FOR_REAL (Intensity)
804 const double result = Vector_getMaximum (me, fromTime, toTime, interpolation);
805 QUERY_ONE_FOR_REAL_END (U" dB")
806 }
807
808 FORM (REAL_Intensity_getTimeOfMaximum, U"Intensity: Get time of maximum", U"Intensity: Get time of maximum...") {
809 praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
810 OK
811 DO
812 QUERY_ONE_FOR_REAL (Intensity)
813 const double result = Vector_getXOfMaximum (me, fromTime, toTime, interpolation);
814 QUERY_ONE_FOR_REAL_END (U" seconds")
815 }
816
817 FORM (REAL_Intensity_getQuantile, U"Intensity: Get quantile", 0) {
818 praat_TimeFunction_RANGE (fromTime, toTime)
819 REAL (quantile, U"Quantile (0-1)", U"0.50")
820 OK
821 DO
822 QUERY_ONE_FOR_REAL (Intensity)
823 const double result = Intensity_getQuantile (me, fromTime, toTime, quantile);
824 QUERY_ONE_FOR_REAL_END (U" dB")
825 }
826
827 FORM (REAL_old_Intensity_getMean, U"Intensity: Get mean", U"Intensity: Get mean...") {
828 praat_TimeFunction_RANGE (fromTime, toTime)
829 OK
830 DO
831 QUERY_ONE_FOR_REAL (Intensity)
832 const double result = Sampled_getMean_standardUnit (me, fromTime, toTime, 0, 0, true);
833 QUERY_ONE_FOR_REAL_END (U" dB")
834 }
835
836 FORM (REAL_Intensity_getMean, U"Intensity: Get mean", U"Intensity: Get mean...") {
837 praat_TimeFunction_RANGE (fromTime, toTime)
838 CHOICE (averagingMethod, U"Averaging method", 1)
839 OPTION (U"energy")
840 OPTION (U"sones")
841 OPTION (U"dB")
842 OK
843 DO_ALTERNATIVE (REAL_old_Intensity_getMean)
844 QUERY_ONE_FOR_REAL (Intensity)
845 const double result = Sampled_getMean_standardUnit (me, fromTime, toTime, 0, averagingMethod, true);
846 QUERY_ONE_FOR_REAL_END (U" dB")
847 }
848
849 FORM (REAL_Intensity_getStandardDeviation, U"Intensity: Get standard deviation", U"Intensity: Get standard deviation...") {
850 praat_TimeFunction_RANGE (fromTime, toTime)
851 OK
852 DO
853 QUERY_ONE_FOR_REAL (Intensity)
854 const double result = Vector_getStandardDeviation (me, fromTime, toTime, 1);
855 QUERY_ONE_FOR_REAL_END (U" dB")
856 }
857
858 // MARK: Modify
859
860 FORM (MODIFY_Intensity_formula, U"Intensity Formula", nullptr) {
861 COMMENT (U"`x` is the time in seconds, `col` is the frame number, `self` is in dB")
862 COMMENT (U"x := x1; for col := 1 to ncol do { self [col] := `formula` ; x := x + dx }")
863 FORMULA (formula, U"Formula", U"0")
864 OK
865 DO
866 MODIFY_EACH_WEAK (Intensity)
867 Matrix_formula (me, formula, interpreter, nullptr);
868 MODIFY_EACH_WEAK_END
869 }
870
871 // MARK: Analyse
872
873 DIRECT (NEW_Intensity_to_IntensityTier_peaks) {
874 CONVERT_EACH_TO_ONE (Intensity)
875 autoIntensityTier result = Intensity_to_IntensityTier_peaks (me);
876 CONVERT_EACH_TO_ONE_END (my name.get())
877 }
878
879 DIRECT (NEW_Intensity_to_IntensityTier_valleys) {
880 CONVERT_EACH_TO_ONE (Intensity)
881 autoIntensityTier result = Intensity_to_IntensityTier_valleys (me);
882 CONVERT_EACH_TO_ONE_END (my name.get())
883 }
884
885 // MARK: Convert
886
887 DIRECT (NEW_Intensity_downto_IntensityTier) {
888 CONVERT_EACH_TO_ONE (Intensity)
889 autoIntensityTier result = Intensity_downto_IntensityTier (me);
890 CONVERT_EACH_TO_ONE_END (my name.get())
891 }
892
893 DIRECT (NEW_Intensity_downto_Matrix) {
894 CONVERT_EACH_TO_ONE (Intensity)
895 autoMatrix result = Intensity_to_Matrix (me);
896 CONVERT_EACH_TO_ONE_END (my name.get())
897 }
898
899 // MARK: - INTENSITY & PITCH
900
901 FORM (GRAPHICS_Pitch_Intensity_draw, U"Plot intensity by pitch", nullptr) {
902 REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
903 REAL (toFrequency, U"To frequency (Hz)", U"0.0 (= auto)")
904 REAL (fromIntensity, U"From intensity (dB)", U"0.0")
905 REAL (toIntensity, U"To intensity (dB)", U"100.0")
906 BOOLEAN (garnish, U"Garnish", true)
907 CHOICE (drawingMethod, U"Drawing method", 1)
908 OPTION (U"speckles")
909 OPTION (U"curve")
910 OPTION (U"speckles and curve")
911 OK
912 DO
913 GRAPHICS_ONE_AND_ONE (Pitch, Intensity)
914 Pitch_Intensity_draw (me, you, GRAPHICS,
915 fromFrequency, toFrequency, fromIntensity, toIntensity, garnish, drawingMethod);
916 GRAPHICS_ONE_AND_ONE_END
917 }
918
919 DIRECT (REAL_Pitch_Intensity_getMean) {
920 QUERY_ONE_AND_ONE_FOR_REAL (Pitch, Intensity)
921 const double result = Pitch_Intensity_getMean (me, you);
922 QUERY_ONE_AND_ONE_FOR_REAL_END (U" dB")
923 }
924
925 DIRECT (REAL_Pitch_Intensity_getMeanAbsoluteSlope) {
926 QUERY_ONE_AND_ONE_FOR_REAL (Pitch, Intensity)
927 const double result = Pitch_Intensity_getMeanAbsoluteSlope (me, you);
928 QUERY_ONE_AND_ONE_FOR_REAL_END (U" dB/second")
929 }
930
931 // MARK: - INTENSITY & POINTPROCESS
932
933 DIRECT (NEW1_Intensity_PointProcess_to_IntensityTier) {
934 CONVERT_ONE_AND_ONE_TO_ONE (Intensity, PointProcess)
935 autoIntensityTier result = Intensity_PointProcess_to_IntensityTier (me, you);
936 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get())
937 }
938
939 // MARK: - LTAS
940
941 DIRECT (NEW1_Ltases_average) {
942 COMBINE_ALL_LISTED_TO_ONE (Ltas, LtasBag)
943 autoLtas result = Ltases_average (list.get());
944 COMBINE_ALL_LISTED_TO_ONE_END (U"averaged")
945 }
946
947 FORM (NEW_Ltas_computeTrendLine, U"Ltas: Compute trend line", U"Ltas: Compute trend line...") {
948 REAL (fromFrequency, U"left Frequency range (Hz)", U"600.0")
949 POSITIVE (toFrequency, U"right Frequency range (Hz)", U"4000.0")
950 OK
951 DO
952 CONVERT_EACH_TO_ONE (Ltas)
953 autoLtas result = Ltas_computeTrendLine (me, fromFrequency, toFrequency);
954 CONVERT_EACH_TO_ONE_END (my name.get(), U"_trend")
955 }
956
957 FORM (GRAPHICS_old_Ltas_draw, U"Ltas: Draw", nullptr) {
958 REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
959 REAL (toFrequency, U"right Frequency range (Hz)", U"0.0 (= all)")
960 REAL (fromPower, U"left Power range (dB/Hz)", U"-20.0")
961 REAL (toPower, U"right Power range (dB/Hz)", U"80.0")
962 BOOLEAN (garnish, U"Garnish", true)
963 OK
964 DO
965 GRAPHICS_EACH (Ltas)
966 Ltas_draw (me, GRAPHICS, fromFrequency, toFrequency, fromPower, toPower, garnish, U"Bars");
967 GRAPHICS_EACH_END
968 }
969
970 FORM (GRAPHICS_Ltas_draw, U"Ltas: Draw", nullptr) {
971 REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
972 REAL (toFrequency, U"right Frequency range (Hz)", U"0.0 (= all)")
973 REAL (fromPower, U"left Power range (dB/Hz)", U"-20.0")
974 REAL (toPower, U"right Power range (dB/Hz)", U"80.0")
975 BOOLEAN (garnish, U"Garnish", true)
976 COMMENT (U"")
977 OPTIONMENUSTR (drawingMethod, U"Drawing method", 2)
978 OPTION (U"curve")
979 OPTION (U"bars")
980 OPTION (U"poles")
981 OPTION (U"speckles")
982 OK
983 DO_ALTERNATIVE (GRAPHICS_old_Ltas_draw)
984 GRAPHICS_EACH (Ltas)
985 Ltas_draw (me, GRAPHICS, fromFrequency, toFrequency, fromPower, toPower, garnish, drawingMethod);
986 GRAPHICS_EACH_END
987 }
988
989 FORM (MODIFY_Ltas_formula, U"Ltas Formula", nullptr) {
990 COMMENT (U"`x` is the frequency in hertz, `col` is the bin number")
991 COMMENT (U"x := x1; for col := 1 to ncol do { self [1, col] := `formula` ; x := x + dx }")
992 FORMULA (formula, U"Formula", U"0")
993 OK
994 DO
995 MODIFY_EACH_WEAK (Ltas)
996 Matrix_formula (me, formula, interpreter, nullptr);
997 MODIFY_EACH_WEAK_END
998 }
999
1000 DIRECT (REAL_Ltas_getLowestFrequency) {
1001 QUERY_ONE_FOR_REAL (Ltas)
1002 const double result = my xmin;
1003 QUERY_ONE_FOR_REAL_END (U" hertz")
1004 }
1005
1006 DIRECT (REAL_Ltas_getHighestFrequency) {
1007 QUERY_ONE_FOR_REAL (Ltas)
1008 const double result = my xmax;
1009 QUERY_ONE_FOR_REAL_END (U" hertz")
1010 }
1011
1012 DIRECT (REAL_Ltas_getBinWidth) {
1013 QUERY_ONE_FOR_REAL (Ltas)
1014 const double result = my dx;
1015 QUERY_ONE_FOR_REAL_END (U" hertz")
1016 }
1017
1018 FORM (REAL_Ltas_getFrequencyFromBinNumber, U"Ltas: Get frequency from bin number", U"Ltas: Get frequency from bin number...") {
1019 NATURAL (binNumber, U"Bin number", U"1")
1020 OK
1021 DO
1022 QUERY_ONE_FOR_REAL (Ltas)
1023 const double result = Sampled_indexToX (me, binNumber);
1024 QUERY_ONE_FOR_REAL_END (U" hertz")
1025 }
1026
1027 FORM (REAL_Ltas_getBinNumberFromFrequency, U"Ltas: Get band from frequency", U"Ltas: Get band from frequency...") {
1028 REAL (frequency, U"Frequency (Hz)", U"2000.0")
1029 OK
1030 DO
1031 QUERY_ONE_FOR_REAL (Ltas)
1032 const double result = Sampled_xToIndex (me, frequency);
1033 QUERY_ONE_FOR_REAL_END (U"")
1034 }
1035
1036 FORM (REAL_Ltas_getFrequencyOfMinimum, U"Ltas: Get frequency of minimum", U"Ltas: Get frequency of minimum...") {
1037 REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
1038 REAL (toFrequency, U"To frequency (Hz)", U"0.0 (= all)")
1039 CHOICE_ENUM (kVector_peakInterpolation, peakInterpolationType,
1040 U"Interpolation", kVector_peakInterpolation::NONE)
1041 OK
1042 DO
1043 QUERY_ONE_FOR_REAL (Ltas)
1044 const double result = Vector_getXOfMinimum (me, fromFrequency, toFrequency, peakInterpolationType);
1045 QUERY_ONE_FOR_REAL_END (U" hertz");
1046 }
1047
1048 FORM (REAL_Ltas_getFrequencyOfMaximum, U"Ltas: Get frequency of maximum", U"Ltas: Get frequency of maximum...") {
1049 REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
1050 REAL (toFrequency, U"To frequency (Hz)", U"0.0 (= all)")
1051 CHOICE_ENUM (kVector_peakInterpolation, peakInterpolationType,
1052 U"Interpolation", kVector_peakInterpolation::NONE)
1053 OK
1054 DO
1055 QUERY_ONE_FOR_REAL (Ltas)
1056 const double result = Vector_getXOfMaximum (me, fromFrequency, toFrequency, peakInterpolationType);
1057 QUERY_ONE_FOR_REAL_END (U" hertz");
1058 }
1059
1060 FORM (REAL_Ltas_getLocalPeakHeight, U"Ltas: Get local peak height", nullptr) {
1061 REAL (environmentMin, U"left Environment (Hz)", U"1700.0")
1062 REAL (environmentMax, U"right Environment (Hz)", U"4200.0")
1063 REAL (peakMin, U"left Peak (Hz)", U"2400.0")
1064 REAL (peakMax, U"right Peak (Hz)", U"3200.0")
1065 CHOICE (averagingMethod, U"Averaging method", 1)
1066 OPTION (U"energy")
1067 OPTION (U"sones")
1068 OPTION (U"dB")
1069 OK
1070 DO
1071 QUERY_ONE_FOR_REAL (Ltas)
1072 if (environmentMin >= peakMin)
1073 Melder_throw (U"The beginning of the environment must lie before the peak.");
1074 if (peakMin >= peakMax)
1075 Melder_throw (U"The end of the peak must lie after its beginning.");
1076 if (environmentMax <= peakMax)
1077 Melder_throw (U"The end of the environment must lie after the peak.");
1078 double result = Ltas_getLocalPeakHeight (me, environmentMin, environmentMax, peakMin, peakMax, averagingMethod);
1079 QUERY_ONE_FOR_REAL_END (U" dB")
1080 }
1081
1082 FORM (REAL_Ltas_getMaximum, U"Ltas: Get maximum", U"Ltas: Get maximum...") {
1083 REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
1084 REAL (toFrequency, U"To frequency (Hz)", U"0.0 (= all)")
1085 CHOICE_ENUM (kVector_peakInterpolation, peakInterpolationType,
1086 U"Interpolation", kVector_peakInterpolation::NONE)
1087 OK
1088 DO
1089 QUERY_ONE_FOR_REAL (Ltas)
1090 const double result = Vector_getMaximum (me, fromFrequency, toFrequency, peakInterpolationType);
1091 QUERY_ONE_FOR_REAL_END (U" dB")
1092 }
1093
1094 FORM (REAL_Ltas_getMean, U"Ltas: Get mean", U"Ltas: Get mean...") {
1095 REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
1096 REAL (toFrequency, U"To frequency (Hz)", U"0.0 (= all)")
1097 CHOICE (averagingMethod, U"Averaging method", 1)
1098 OPTION (U"energy")
1099 OPTION (U"sones")
1100 OPTION (U"dB")
1101 OK
1102 DO
1103 QUERY_ONE_FOR_REAL (Ltas)
1104 const double result = Sampled_getMean_standardUnit (me, fromFrequency, toFrequency,
1105 0, averagingMethod, false);
1106 QUERY_ONE_FOR_REAL_END (U" dB")
1107 }
1108
1109 FORM (REAL_Ltas_getMinimum, U"Ltas: Get minimum", U"Ltas: Get minimum...") {
1110 REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
1111 REAL (toFrequency, U"To frequency (Hz)", U"0.0 (= all)")
1112 CHOICE_ENUM (kVector_peakInterpolation, peakInterpolationType,
1113 U"Interpolation", kVector_peakInterpolation::NONE)
1114 OK
1115 DO
1116 QUERY_ONE_FOR_REAL (Ltas)
1117 const double result = Vector_getMinimum (me, fromFrequency, toFrequency, peakInterpolationType);
1118 QUERY_ONE_FOR_REAL_END (U" dB")
1119 }
1120
1121 DIRECT (INTEGER_Ltas_getNumberOfBins) {
1122 QUERY_ONE_FOR_REAL (Ltas)
1123 const integer result = my nx;
1124 QUERY_ONE_FOR_REAL_END (U" bins")
1125 }
1126
1127 FORM (REAL_Ltas_getSlope, U"Ltas: Get slope", 0) {
1128 REAL (lowBandFrom, U"left Low band (Hz)", U"0.0")
1129 REAL (lowBandTo, U"right Low band (Hz)", U"1000.0")
1130 REAL (highBandFrom, U"left High band (Hz)", U"1000.0")
1131 REAL (highBandTo, U"right High band (Hz)", U"4000.0")
1132 CHOICE (averagingMethod, U"Averaging method", 1)
1133 OPTION (U"energy")
1134 OPTION (U"sones")
1135 OPTION (U"dB")
1136 OK
1137 DO
1138 QUERY_ONE_FOR_REAL (Ltas)
1139 const double result = Ltas_getSlope (me, lowBandFrom, lowBandTo, highBandFrom, highBandTo, averagingMethod);
1140 QUERY_ONE_FOR_REAL_END (U" dB")
1141 }
1142
1143 FORM (REAL_Ltas_getStandardDeviation, U"Ltas: Get standard deviation", U"Ltas: Get standard deviation...") {
1144 REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
1145 REAL (toFrequency, U"To frequency (Hz)", U"0.0 (= all)")
1146 CHOICE (averagingMethod, U"Averaging method", 1)
1147 OPTION (U"energy")
1148 OPTION (U"sones")
1149 OPTION (U"dB")
1150 OK
1151 DO
1152 QUERY_ONE_FOR_REAL (Ltas)
1153 const double result = Sampled_getStandardDeviation_standardUnit (me, fromFrequency, toFrequency,
1154 0, // level (irrelevant)
1155 averagingMethod,
1156 false // interpolate (don't)
1157 );
1158 QUERY_ONE_FOR_REAL_END (U" dB")
1159 }
1160
1161 FORM (REAL_Ltas_getValueAtFrequency, U"Ltas: Get value", U"Ltas: Get value at frequency...") {
1162 REAL (frequency, U"Frequency (Hz)", U"1500.0")
1163 CHOICE_ENUM (kVector_valueInterpolation, valueInterpolationType,
1164 U"Interpolation", kVector_valueInterpolation :: NEAREST)
1165 OK
1166 DO
1167 QUERY_ONE_FOR_REAL (Ltas)
1168 const double result = Vector_getValueAtX (me, frequency,
1169 1, // level
1170 valueInterpolationType
1171 );
1172 QUERY_ONE_FOR_REAL_END (U" dB")
1173 }
1174
1175 FORM (REAL_Ltas_getValueInBin, U"Get value in bin", U"Ltas: Get value in bin...") {
1176 INTEGER (binNumber, U"Bin number", U"100")
1177 OK
1178 DO
1179 QUERY_ONE_FOR_REAL (Ltas)
1180 const double result = binNumber < 1 || binNumber > my nx ? undefined : my z [1] [binNumber];
1181 QUERY_ONE_FOR_REAL_END (U" dB")
1182 }
1183
1184 DIRECT (HELP_Ltas_help) {
1185 HELP (U"Ltas")
1186 }
1187
1188 DIRECT (NEW1_Ltases_merge) {
1189 COMBINE_ALL_LISTED_TO_ONE (Ltas, LtasBag)
1190 autoLtas result = Ltases_merge (list.get());
1191 COMBINE_ALL_LISTED_TO_ONE_END (U"merged")
1192 }
1193
1194 FORM (NEW_Ltas_subtractTrendLine, U"Ltas: Subtract trend line", U"Ltas: Subtract trend line...") {
1195 REAL (fromFrequency, U"left Frequency range (Hz)", U"600.0")
1196 POSITIVE (toFrequency, U"right Frequency range (Hz)", U"4000.0")
1197 OK
1198 DO
1199 CONVERT_EACH_TO_ONE (Ltas)
1200 autoLtas result = Ltas_subtractTrendLine (me, fromFrequency, toFrequency);
1201 CONVERT_EACH_TO_ONE_END (my name.get(), U"_fit")
1202 }
1203
1204 DIRECT (NEW_Ltas_to_Matrix) {
1205 CONVERT_EACH_TO_ONE (Ltas)
1206 autoMatrix result = Ltas_to_Matrix (me);
1207 CONVERT_EACH_TO_ONE_END (my name.get())
1208 }
1209
1210 DIRECT (NEW_Ltas_to_SpectrumTier_peaks) {
1211 CONVERT_EACH_TO_ONE (Ltas)
1212 autoSpectrumTier result = Ltas_to_SpectrumTier_peaks (me);
1213 CONVERT_EACH_TO_ONE_END (my name.get())
1214 }
1215
1216 // MARK: - MANIPULATION
1217
1218 static void cb_ManipulationEditor_publication (Editor /* editor */, autoDaata publication) {
1219 try {
1220 praat_new (publication.move(), U"fromManipulationEditor");
1221 praat_updateSelection ();
1222 } catch (MelderError) {
1223 Melder_flushError ();
1224 }
1225 }
1226 DIRECT (EDITOR_ONE_Manipulation_viewAndEdit) {
1227 EDITOR_ONE (a,Manipulation)
1228 autoManipulationEditor editor = ManipulationEditor_create (ID_AND_FULL_NAME, me);
1229 Editor_setPublicationCallback (editor.get(), cb_ManipulationEditor_publication);
1230 EDITOR_ONE_END
1231 }
1232
1233 DIRECT (NEW_Manipulation_extractDurationTier) {
1234 CONVERT_EACH_TO_ONE (Manipulation)
1235 if (! my duration)
1236 Melder_throw (me, U": I don't contain a DurationTier.");
1237 autoDurationTier result = Data_copy (my duration.get());
1238 CONVERT_EACH_TO_ONE_END (my name.get())
1239 }
1240
1241 DIRECT (NEW_Manipulation_extractOriginalSound) {
1242 CONVERT_EACH_TO_ONE (Manipulation)
1243 if (! my sound)
1244 Melder_throw (me, U": I don't contain a Sound.");
1245 autoSound result = Data_copy (my sound.get());
1246 CONVERT_EACH_TO_ONE_END (my name.get())
1247 }
1248
1249 DIRECT (NEW_Manipulation_extractPitchTier) {
1250 CONVERT_EACH_TO_ONE (Manipulation)
1251 if (! my pitch)
1252 Melder_throw (me, U": I don't contain a PitchTier.");
1253 autoPitchTier result = Data_copy (my pitch.get());
1254 CONVERT_EACH_TO_ONE_END (my name.get())
1255 }
1256
1257 DIRECT (NEW_Manipulation_extractPulses) {
1258 CONVERT_EACH_TO_ONE (Manipulation)
1259 if (! my pulses)
1260 Melder_throw (me, U": I don't contain a PointProcess.");
1261 autoPointProcess result = Data_copy (my pulses.get());
1262 CONVERT_EACH_TO_ONE_END (my name.get())
1263 }
1264
1265 DIRECT (NEW_Manipulation_getResynthesis_lpc) {
1266 CONVERT_EACH_TO_ONE (Manipulation)
1267 autoSound result = Manipulation_to_Sound (me, Manipulation_PITCH_LPC);
1268 CONVERT_EACH_TO_ONE_END (my name.get())
1269 }
1270
1271 DIRECT (NEW_Manipulation_getResynthesis_overlapAdd) {
1272 CONVERT_EACH_TO_ONE (Manipulation)
1273 autoSound result = Manipulation_to_Sound (me, Manipulation_OVERLAPADD);
1274 CONVERT_EACH_TO_ONE_END (my name.get())
1275 }
1276
1277 DIRECT (HELP_Manipulation_help) {
1278 HELP (U"Manipulation")
1279 }
1280
1281 DIRECT (PLAY_Manipulation_play_lpc) {
1282 PLAY_EACH (Manipulation)
1283 Manipulation_play (me, Manipulation_PITCH_LPC);
1284 PLAY_EACH_END
1285 }
1286
1287 DIRECT (PLAY_Manipulation_play_overlapAdd) {
1288 PLAY_EACH (Manipulation)
1289 Manipulation_play (me, Manipulation_OVERLAPADD);
1290 PLAY_EACH_END
1291 }
1292
1293 DIRECT (MODIFY_Manipulation_removeDuration) {
1294 MODIFY_EACH (Manipulation)
1295 my duration = autoDurationTier();
1296 MODIFY_EACH_END
1297 }
1298
1299 DIRECT (MODIFY_Manipulation_removeOriginalSound) {
1300 MODIFY_EACH (Manipulation)
1301 my sound = autoSound();
1302 MODIFY_EACH_END
1303 }
1304
1305 FORM_SAVE (SAVE_Manipulation_writeToBinaryFileWithoutSound, U"Binary file without Sound", nullptr, nullptr) {
1306 SAVE_ONE (Manipulation, U"save the selected Manipulation object to the sound-less binary file")
1307 Manipulation_writeToBinaryFileWithoutSound (me, file);
1308 SAVE_ONE_END
1309 }
1310
1311 FORM_SAVE (SAVE_Manipulation_writeToTextFileWithoutSound, U"Text file without Sound", nullptr, nullptr) {
1312 SAVE_ONE (Manipulation, U"save the selected Manipulation object to the sound-less text file")
1313 Manipulation_writeToTextFileWithoutSound (me, file);
1314 SAVE_ONE_END
1315 }
1316
1317 // MARK: - MANIPULATION & DURATIONTIER
1318
1319 DIRECT (MODIFY_Manipulation_replaceDurationTier) {
1320 MODIFY_FIRST_OF_ONE_AND_ONE (Manipulation, DurationTier)
1321 Manipulation_replaceDurationTier (me, you);
1322 MODIFY_FIRST_OF_ONE_AND_ONE_END
1323 }
1324
1325 DIRECT (HELP_Manipulation_replaceDurationTier_help) {
1326 HELP (U"Manipulation: Replace duration tier")
1327 }
1328
1329 // MARK: - MANIPULATION & PITCHTIER
1330
1331 DIRECT (MODIFY_Manipulation_replacePitchTier) {
1332 MODIFY_FIRST_OF_ONE_AND_ONE (Manipulation, PitchTier)
1333 Manipulation_replacePitchTier (me, you);
1334 MODIFY_FIRST_OF_ONE_AND_ONE_END
1335 }
1336
1337 DIRECT (HELP_Manipulation_replacePitchTier_help) {
1338 HELP (U"Manipulation: Replace pitch tier")
1339 }
1340
1341 // MARK: - MANIPULATION & POINTPROCESS
1342
1343 DIRECT (MODIFY_Manipulation_replacePulses) {
1344 MODIFY_FIRST_OF_ONE_AND_ONE (Manipulation, PointProcess)
1345 Manipulation_replacePulses (me, you);
1346 MODIFY_FIRST_OF_ONE_AND_ONE_END
1347 }
1348
1349 // MARK: - MANIPULATION & SOUND
1350
1351 DIRECT (MODIFY_Manipulation_replaceOriginalSound) {
1352 MODIFY_FIRST_OF_ONE_AND_ONE (Manipulation, Sound)
1353 Manipulation_replaceOriginalSound (me, you);
1354 MODIFY_FIRST_OF_ONE_AND_ONE_END
1355 }
1356
1357 // MARK: - MANIPULATION & TEXTTIER
1358
1359 DIRECT (NEW1_Manipulation_TextTier_to_Manipulation) {
1360 CONVERT_ONE_AND_ONE_TO_ONE (Manipulation, TextTier)
1361 autoManipulation result = Manipulation_AnyTier_to_Manipulation (me, reinterpret_cast <AnyTier> (you));
1362 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get())
1363 }
1364
1365 // MARK: - PARAMCURVE
1366
1367 FORM (GRAPHICS_ParamCurve_draw, U"Draw parametrized curve", nullptr) {
1368 REAL (tmin, U"Tmin", U"0.0")
1369 REAL (tmax, U"Tmax", U"0.0")
1370 REAL (step, U"Step", U"0.0")
1371 REAL (xmin, U"Xmin", U"0.0")
1372 REAL (xmax, U"Xmax", U"0.0")
1373 REAL (ymin, U"Ymin", U"0.0")
1374 REAL (ymax, U"Ymax", U"0.0")
1375 BOOLEAN (garnish, U"Garnish", true)
1376 OK
1377 DO
1378 GRAPHICS_EACH (ParamCurve)
1379 ParamCurve_draw (me, GRAPHICS, tmin, tmax, step, xmin, xmax, ymin, ymax, garnish);
1380 GRAPHICS_EACH_END
1381 }
1382
1383 DIRECT (HELP_ParamCurve_help) {
1384 HELP (U"ParamCurve")
1385 }
1386
1387 // MARK: - PITCH
1388
1389 DIRECT (INTEGER_Pitch_getNumberOfVoicedFrames) {
1390 QUERY_ONE_FOR_REAL (Pitch)
1391 integer result = Pitch_countVoicedFrames (me);
1392 QUERY_ONE_FOR_REAL_END (U" voiced frames")
1393 }
1394
1395 DIRECT (INFO_Pitch_difference) {
1396 INFO_TWO (Pitch)
1397 Pitch_difference (me, you);
1398 INFO_TWO_END
1399 }
1400
1401 FORM (GRAPHICS_Pitch_draw, U"Pitch: Draw", U"Pitch: Draw...") {
1402 praat_TimeFunction_RANGE (fromTime, toTime)
1403 REAL (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"0.0")
1404 POSITIVE (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0")
1405 BOOLEAN (garnish, U"Garnish", true)
1406 OK
1407 DO
1408 if (toFrequency <= fromFrequency)
1409 Melder_throw (U"Maximum frequency must be greater than minimum frequency.");
1410 GRAPHICS_EACH (Pitch)
1411 Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
1412 garnish, Pitch_speckle_NO, kPitch_unit::HERTZ);
1413 GRAPHICS_EACH_END
1414 }
1415
1416 FORM (GRAPHICS_Pitch_drawErb, U"Pitch: Draw erb", U"Pitch: Draw...") {
1417 praat_TimeFunction_RANGE (fromTime, toTime)
1418 REAL (fromFrequency, U"left Frequency range (ERB)", U"0")
1419 REAL (toFrequency, U"right Frequency range (ERB)", U"10.0")
1420 BOOLEAN (garnish, U"Garnish", true)
1421 OK
1422 DO
1423 GRAPHICS_EACH (Pitch)
1424 Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
1425 garnish, Pitch_speckle_NO, kPitch_unit::ERB);
1426 GRAPHICS_EACH_END
1427 }
1428
1429 FORM (GRAPHICS_Pitch_drawLogarithmic, U"Pitch: Draw logarithmic", U"Pitch: Draw...") {
1430 praat_TimeFunction_RANGE (fromTime, toTime)
1431 POSITIVE (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"50.0")
1432 POSITIVE (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0")
1433 BOOLEAN (garnish, U"Garnish", true)
1434 OK
1435 DO
1436 if (toFrequency <= fromFrequency)
1437 Melder_throw (U"Maximum frequency must be greater than minimum frequency.");
1438 GRAPHICS_EACH (Pitch)
1439 Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
1440 garnish, Pitch_speckle_NO, kPitch_unit::HERTZ_LOGARITHMIC);
1441 GRAPHICS_EACH_END
1442 }
1443
1444 FORM (GRAPHICS_Pitch_drawMel, U"Pitch: Draw mel", U"Pitch: Draw...") {
1445 praat_TimeFunction_RANGE (fromTime, toTime)
1446 REAL (fromFrequency, U"left Frequency range (mel)", U"0.0")
1447 REAL (toFrequency, U"right Frequency range (mel)", U"500.0")
1448 BOOLEAN (garnish, U"Garnish", true)
1449 OK
1450 DO
1451 GRAPHICS_EACH (Pitch)
1452 Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
1453 garnish, Pitch_speckle_NO, kPitch_unit::MEL);
1454 GRAPHICS_EACH_END
1455 }
1456
1457 FORM (GRAPHICS_Pitch_drawSemitones100, U"Pitch: Draw semitones (re 100 Hz)", U"Pitch: Draw...") {
1458 praat_TimeFunction_RANGE (fromTime, toTime)
1459 COMMENT (U"Range in semitones re 100 Hz:")
1460 REAL (fromFrequency, U"left Frequency range (st)", U"-12.0")
1461 REAL (toFrequency, U"right Frequency range (st)", U"30.0")
1462 BOOLEAN (garnish, U"Garnish", true)
1463 OK
1464 DO
1465 GRAPHICS_EACH (Pitch)
1466 Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
1467 garnish, Pitch_speckle_NO, kPitch_unit::SEMITONES_100);
1468 GRAPHICS_EACH_END
1469 }
1470
1471 FORM (GRAPHICS_Pitch_drawSemitones200, U"Pitch: Draw semitones (re 200 Hz)", U"Pitch: Draw...") {
1472 praat_TimeFunction_RANGE (fromTime, toTime)
1473 COMMENT (U"Range in semitones re 200 Hz:")
1474 REAL (fromFrequency, U"left Frequency range (st)", U"-24.0")
1475 REAL (toFrequency, U"right Frequency range (st)", U"18.0")
1476 BOOLEAN (garnish, U"Garnish", true)
1477 OK
1478 DO
1479 GRAPHICS_EACH (Pitch)
1480 Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
1481 garnish, Pitch_speckle_NO, kPitch_unit::SEMITONES_200);
1482 GRAPHICS_EACH_END
1483 }
1484
1485 FORM (GRAPHICS_Pitch_drawSemitones440, U"Pitch: Draw semitones (re 440 Hz)", U"Pitch: Draw...") {
1486 praat_TimeFunction_RANGE (fromTime, toTime)
1487 COMMENT (U"Range in semitones re 440 Hz:")
1488 REAL (fromFrequency, U"left Frequency range (st)", U"-36.0")
1489 REAL (toFrequency, U"right Frequency range (st)", U"6.0")
1490 BOOLEAN (garnish, U"Garnish", true)
1491 OK
1492 DO
1493 GRAPHICS_EACH (Pitch)
1494 Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
1495 garnish, Pitch_speckle_NO, kPitch_unit::SEMITONES_440);
1496 GRAPHICS_EACH_END
1497 }
1498
1499 DIRECT (EDITOR_ONE_Pitch_viewAndEdit) {
1500 EDITOR_ONE (a,Pitch)
1501 autoPitchEditor editor = PitchEditor_create (ID_AND_FULL_NAME, me);
1502 EDITOR_ONE_END
1503 }
1504
1505 FORM (MODIFY_Pitch_formula, U"Pitch: Formula", U"Formula...") {
1506 COMMENT (U"`x` is time; `col` is frame number; `row` = candidate (1 = current path); frequency (time, candidate) :=")
1507 FORMULA (formula, U"Formula", U"self*2 ; example: octave jump up")
1508 OK
1509 DO
1510 MODIFY_EACH_WEAK (Pitch)
1511 Pitch_formula (me, formula, interpreter);
1512 MODIFY_EACH_WEAK_END
1513 }
1514
1515 FORM (NUMMAT_Pitch_getAllCandidatesInFrame, U"Pitch: Get all candidates in frame", nullptr) {
1516 NATURAL (frameNumber, U"Frame number", U"1")
1517 OK
1518 DO
1519 QUERY_ONE_FOR_MATRIX (Pitch)
1520 autoMAT result = Pitch_getAllCandidatesInFrame (me, frameNumber);
1521 QUERY_ONE_FOR_MATRIX_END
1522 }
1523
1524 FORM (NEW_Pitch_tabulateCandidatesInFrame, U"Pitch: Tabulate candidates in frame", nullptr) {
1525 NATURAL (frameNumber, U"Frame number", U"1")
1526 OK
1527 DO
1528 CONVERT_EACH_TO_ONE (Pitch)
1529 autoTable result = Pitch_tabulateCandidatesInFrame (me, frameNumber);
1530 CONVERT_EACH_TO_ONE_END (my name.get(), U"_", frameNumber)
1531 }
1532
1533 DIRECT (NEW_Pitch_tabulateCandidates) {
1534 CONVERT_EACH_TO_ONE (Pitch)
1535 autoTable result = Pitch_tabulateCandidates (me);
1536 CONVERT_EACH_TO_ONE_END (my name.get())
1537 }
1538
1539 FORM (REAL_Pitch_getMinimum, U"Pitch: Get minimum", nullptr) {
1540 praat_TimeFunction_RANGE (fromTime, toTime)
1541 OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
1542 CHOICEx (interpolation, U"Interpolation", 2, 0)
1543 OPTION (U"none")
1544 OPTION (U"parabolic")
1545 OK
1546 DO
1547 QUERY_ONE_FOR_REAL (Pitch)
1548 double result = Pitch_getMinimum (me, fromTime, toTime, unit, interpolation);
1549 result = Function_convertToNonlogarithmic (me, result, Pitch_LEVEL_FREQUENCY, (int) unit);
1550 QUERY_ONE_FOR_REAL_END (U" ", Function_getUnitText (me, Pitch_LEVEL_FREQUENCY, (int) unit, 0))
1551 }
1552
1553 FORM (REAL_Pitch_getMaximum, U"Pitch: Get maximum", nullptr) {
1554 praat_TimeFunction_RANGE (fromTime, toTime)
1555 OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
1556 CHOICEx (interpolation, U"Interpolation", 2, 0)
1557 OPTION (U"none")
1558 OPTION (U"parabolic")
1559 OK
1560 DO
1561 QUERY_ONE_FOR_REAL (Pitch)
1562 double result = Pitch_getMaximum (me, fromTime, toTime, unit, interpolation);
1563 result = Function_convertToNonlogarithmic (me, result, Pitch_LEVEL_FREQUENCY, (int) unit);
1564 QUERY_ONE_FOR_REAL_END (U" ", Function_getUnitText (me, Pitch_LEVEL_FREQUENCY, (int) unit, 0))
1565 }
1566
1567 FORM (REAL_Pitch_getMean, U"Pitch: Get mean", nullptr) {
1568 praat_TimeFunction_RANGE (fromTime, toTime)
1569 OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
1570 OK
1571 DO
1572 QUERY_ONE_FOR_REAL (Pitch)
1573 double result = Pitch_getMean (me, fromTime, toTime, unit);
1574 result = Function_convertToNonlogarithmic (me, result, Pitch_LEVEL_FREQUENCY, (int) unit);
1575 QUERY_ONE_FOR_REAL_END (U" ", Function_getUnitText (me, Pitch_LEVEL_FREQUENCY, (int) unit, 0));
1576 }
1577
1578 FORM (REAL_Pitch_getMeanAbsoluteSlope, U"Pitch: Get mean absolute slope", 0) {
1579 CHOICE (unit, U"Unit", 1)
1580 OPTION (U"Hertz")
1581 OPTION (U"mel")
1582 OPTION (U"semitones")
1583 OPTION (U"ERB")
1584 OK
1585 DO
1586 QUERY_ONE_FOR_REAL (Pitch)
1587 double slope;
1588 const integer nVoiced = (unit == 1 ? Pitch_getMeanAbsSlope_hertz : unit == 2 ? Pitch_getMeanAbsSlope_mel : unit == 3 ? Pitch_getMeanAbsSlope_semitones : Pitch_getMeanAbsSlope_erb)
1589 (me, & slope);
1590 const double result = ( nVoiced < 2 ? undefined : slope );
1591 QUERY_ONE_FOR_REAL_END (U" ", ( unit == 1 ? U"Hz" : unit == 2 ? U"mel" : unit == 3 ? U"semitones" : U"ERB" ), U"/s");
1592 }
1593
1594 DIRECT (REAL_Pitch_getMeanAbsSlope_noOctave) {
1595 QUERY_ONE_FOR_REAL (Pitch)
1596 double result;
1597 (void) Pitch_getMeanAbsSlope_noOctave (me, & result);
1598 QUERY_ONE_FOR_REAL_END (U" semitones/s")
1599 }
1600
1601 FORM (REAL_Pitch_getQuantile, U"Pitch: Get quantile", nullptr) {
1602 praat_TimeFunction_RANGE (fromTime, toTime)
1603 REAL (quantile, U"Quantile", U"0.50 (= median)")
1604 OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
1605 OK
1606 DO
1607 QUERY_ONE_FOR_REAL (Pitch)
1608 double result = Sampled_getQuantile (me, fromTime, toTime, quantile, Pitch_LEVEL_FREQUENCY, (int) unit);
1609 result = Function_convertToNonlogarithmic (me, result, Pitch_LEVEL_FREQUENCY, (int) unit);
1610 QUERY_ONE_FOR_REAL_END (U" ", Function_getUnitText (me, Pitch_LEVEL_FREQUENCY, (int) unit, 0))
1611 }
1612
1613 FORM (REAL_Pitch_getStandardDeviation, U"Pitch: Get standard deviation", nullptr) {
1614 praat_TimeFunction_RANGE (fromTime, toTime)
1615 OPTIONMENU (unit_i, U"Unit", 1)
1616 OPTION (U"Hertz")
1617 OPTION (U"mel")
1618 OPTION (U"logHertz")
1619 OPTION (U"semitones")
1620 OPTION (U"ERB")
1621 OK
1622 DO
1623 const kPitch_unit unit =
1624 unit_i == 1 ? kPitch_unit::HERTZ :
1625 unit_i == 2 ? kPitch_unit::MEL :
1626 unit_i == 3 ? kPitch_unit::LOG_HERTZ :
1627 unit_i == 4 ? kPitch_unit::SEMITONES_1 :
1628 kPitch_unit::ERB;
1629 QUERY_ONE_FOR_REAL (Pitch)
1630 const double result = Pitch_getStandardDeviation (me, fromTime, toTime, unit);
1631 conststring32 unitText =
1632 unit == kPitch_unit::HERTZ ? U"Hz" :
1633 unit == kPitch_unit::MEL ? U"mel" :
1634 unit == kPitch_unit::LOG_HERTZ ? U"logHz" :
1635 unit == kPitch_unit::SEMITONES_1 ? U"semitones" :
1636 U"ERB";
1637 QUERY_ONE_FOR_REAL_END (U" ", unitText)
1638 }
1639
1640 FORM (REAL_Pitch_getTimeOfMaximum, U"Pitch: Get time of maximum", nullptr) {
1641 praat_TimeFunction_RANGE (fromTime, toTime)
1642 OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
1643 CHOICEx (interpolation, U"Interpolation", 2, 0)
1644 OPTION (U"none")
1645 OPTION (U"parabolic")
1646 OK
1647 DO
1648 QUERY_ONE_FOR_REAL (Pitch)
1649 const double result = Pitch_getTimeOfMaximum (me, fromTime, toTime, unit, interpolation);
1650 QUERY_ONE_FOR_REAL_END (U" seconds")
1651 }
1652
1653 FORM (REAL_Pitch_getTimeOfMinimum, U"Pitch: Get time of minimum", nullptr) {
1654 praat_TimeFunction_RANGE (fromTime, toTime)
1655 OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
1656 CHOICEx (interpolation, U"Interpolation", 2, 0)
1657 OPTION (U"none")
1658 OPTION (U"parabolic")
1659 OK
1660 DO
1661 QUERY_ONE_FOR_REAL (Pitch)
1662 const double result = Pitch_getTimeOfMinimum (me, fromTime, toTime, unit, interpolation);
1663 QUERY_ONE_FOR_REAL_END (U" seconds")
1664 }
1665
1666 FORM (REAL_Pitch_getValueAtTime, U"Pitch: Get value at time", U"Pitch: Get value at time...") {
1667 REAL (time, U"Time (s)", U"0.5")
1668 OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
1669 CHOICEx (interpolation, U"Interpolation", 2, 0)
1670 OPTION (U"nearest")
1671 OPTION (U"linear")
1672 OK
1673 DO
1674 QUERY_ONE_FOR_REAL (Pitch)
1675 double result = Sampled_getValueAtX (me, time, Pitch_LEVEL_FREQUENCY, (int) unit, interpolation);
1676 result = Function_convertToNonlogarithmic (me, result, Pitch_LEVEL_FREQUENCY, (int) unit);
1677 QUERY_ONE_FOR_REAL_END (U" ", Function_getUnitText (me, Pitch_LEVEL_FREQUENCY, (int) unit, 0))
1678 }
1679
1680 FORM (REAL_Pitch_getValueInFrame, U"Pitch: Get value in frame", U"Pitch: Get value in frame...") {
1681 INTEGER (frameNumber, U"Frame number", U"10")
1682 OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
1683 OK
1684 DO
1685 QUERY_ONE_FOR_REAL (Pitch)
1686 double result = Sampled_getValueAtSample (me, frameNumber, Pitch_LEVEL_FREQUENCY, (int) unit);
1687 result = Function_convertToNonlogarithmic (me, result, Pitch_LEVEL_FREQUENCY, (int) unit);
1688 QUERY_ONE_FOR_REAL_END (U" ", Function_getUnitText (me, Pitch_LEVEL_FREQUENCY, (int) unit, 0));
1689 }
1690
1691 DIRECT (HELP_Pitch_help) {
1692 HELP (U"Pitch")
1693 }
1694
1695 DIRECT (PLAY_Pitch_hum) {
1696 PLAY_EACH (Pitch)
1697 Pitch_hum (me, 0.0, 0.0, nullptr, nullptr);
1698 PLAY_EACH_END
1699 }
1700
1701 DIRECT (NEW_Pitch_interpolate) {
1702 CONVERT_EACH_TO_ONE (Pitch)
1703 autoPitch result = Pitch_interpolate (me);
1704 CONVERT_EACH_TO_ONE_END (my name.get())
1705 }
1706
1707 DIRECT (NEW_Pitch_killOctaveJumps) {
1708 CONVERT_EACH_TO_ONE (Pitch)
1709 autoPitch result = Pitch_killOctaveJumps (me);
1710 CONVERT_EACH_TO_ONE_END (my name.get())
1711 }
1712
1713 FORM (NUMVEC_Pitch_listValuesAtTimes, U"Pitch: List values at times", U"Pitch: List values at times...") {
1714 REALVECTOR (times, U"Times (s)", WHITESPACE_SEPARATED_, U"0.5 0.7 2.0")
1715 OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
1716 CHOICEx (interpolation, U"Interpolation", 2, 0)
1717 OPTION (U"nearest")
1718 OPTION (U"linear")
1719 OK
1720 DO
1721 QUERY_ONE_FOR_REAL_VECTOR (Pitch)
1722 autoVEC result = Sampled_listValuesAtXes (me, times, Pitch_LEVEL_FREQUENCY, (int) unit, interpolation);
1723 for (integer iframe = 1; iframe <= result.size; iframe ++)
1724 result [iframe] = Function_convertToNonlogarithmic (me, result [iframe], Pitch_LEVEL_FREQUENCY, (int) unit);
1725 QUERY_ONE_FOR_REAL_VECTOR_END
1726 }
1727
1728 FORM (NUMVEC_Pitch_listValuesInAllFrames, U"Pitch: List values in all frames", U"Pitch: List values in all frames...") {
1729 OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
1730 OK
1731 DO
1732 QUERY_ONE_FOR_REAL_VECTOR (Pitch)
1733 autoVEC result = Sampled_listValuesOfAllSamples (me, Pitch_LEVEL_FREQUENCY, (int) unit);
1734 for (integer iframe = 1; iframe <= result.size; iframe ++)
1735 result [iframe] = Function_convertToNonlogarithmic (me, result [iframe], Pitch_LEVEL_FREQUENCY, (int) unit);
1736 QUERY_ONE_FOR_REAL_VECTOR_END
1737 }
1738
1739 DIRECT (PLAY_Pitch_play) {
1740 PLAY_EACH (Pitch)
1741 Pitch_play (me, 0.0, 0.0);
1742 PLAY_EACH_END
1743 }
1744
1745 FORM (NEW_Pitch_smooth, U"Pitch: Smooth", U"Pitch: Smooth...") {
1746 REAL (bandwidth, U"Bandwidth (Hz)", U"10.0")
1747 OK
1748 DO
1749 CONVERT_EACH_TO_ONE (Pitch)
1750 autoPitch result = Pitch_smooth (me, bandwidth);
1751 CONVERT_EACH_TO_ONE_END (my name.get())
1752 }
1753
1754 FORM (GRAPHICS_Pitch_speckle, U"Pitch: Speckle", U"Pitch: Draw...") {
1755 praat_TimeFunction_RANGE (fromTime, toTime)
1756 REAL (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"0.0")
1757 POSITIVE (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0")
1758 BOOLEAN (garnish, U"Garnish", true)
1759 OK
1760 DO
1761 if (toFrequency <= fromFrequency)
1762 Melder_throw (U"Maximum frequency should be greater than minimum frequency.");
1763 GRAPHICS_EACH (Pitch)
1764 Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, Pitch_speckle_YES, kPitch_unit::HERTZ);
1765 GRAPHICS_EACH_END
1766 }
1767
1768 FORM (GRAPHICS_Pitch_speckleErb, U"Pitch: Speckle erb", U"Pitch: Draw...") {
1769 praat_TimeFunction_RANGE (fromTime, toTime)
1770 REAL (fromFrequency, U"left Frequency range (ERB)", U"0.0")
1771 REAL (toFrequency, U"right Frequency range (ERB)", U"10.0")
1772 BOOLEAN (garnish, U"Garnish", true)
1773 OK
1774 DO
1775 GRAPHICS_EACH (Pitch)
1776 Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, Pitch_speckle_YES, kPitch_unit::ERB);
1777 GRAPHICS_EACH_END
1778 }
1779
1780 FORM (GRAPHICS_Pitch_speckleLogarithmic, U"Pitch: Speckle logarithmic", U"Pitch: Draw...") {
1781 praat_TimeFunction_RANGE (fromTime, toTime)
1782 POSITIVE (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"50.0")
1783 POSITIVE (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0")
1784 BOOLEAN (garnish, U"Garnish", true)
1785 OK
1786 DO
1787 if (toFrequency <= fromFrequency)
1788 Melder_throw (U"Maximum frequency must be greater than minimum frequency.");
1789 GRAPHICS_EACH (Pitch)
1790 Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, Pitch_speckle_YES, kPitch_unit::HERTZ_LOGARITHMIC);
1791 GRAPHICS_EACH_END
1792 }
1793
1794 FORM (GRAPHICS_Pitch_speckleMel, U"Pitch: Speckle mel", U"Pitch: Draw...") {
1795 praat_TimeFunction_RANGE (fromTime, toTime)
1796 REAL (fromFrequency, U"left Frequency range (mel)", U"0.0")
1797 REAL (toFrequency, U"right Frequency range (mel)", U"500.0")
1798 BOOLEAN (garnish, U"Garnish", true)
1799 OK
1800 DO
1801 GRAPHICS_EACH (Pitch)
1802 Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, Pitch_speckle_YES, kPitch_unit::MEL);
1803 GRAPHICS_EACH_END
1804 }
1805
1806 FORM (GRAPHICS_Pitch_speckleSemitones100, U"Pitch: Speckle semitones (re 100 Hz)", U"Pitch: Draw...") {
1807 praat_TimeFunction_RANGE (fromTime, toTime)
1808 COMMENT (U"Range in semitones re 100 hertz:")
1809 REAL (fromFrequency, U"left Frequency range (st)", U"-12.0")
1810 REAL (toFrequency, U"right Frequency range (st)", U"30.0")
1811 BOOLEAN (garnish, U"Garnish", true)
1812 OK
1813 DO
1814 GRAPHICS_EACH (Pitch)
1815 Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, Pitch_speckle_YES, kPitch_unit::SEMITONES_100);
1816 GRAPHICS_EACH_END
1817 }
1818
1819 FORM (GRAPHICS_Pitch_speckleSemitones200, U"Pitch: Speckle semitones (re 200 Hz)", U"Pitch: Draw...") {
1820 praat_TimeFunction_RANGE (fromTime, toTime)
1821 COMMENT (U"Range in semitones re 200 hertz:")
1822 REAL (fromFrequency, U"left Frequency range (st)", U"-24.0")
1823 REAL (toFrequency, U"right Frequency range (st)", U"18.0")
1824 BOOLEAN (garnish, U"Garnish", true)
1825 OK
1826 DO
1827 GRAPHICS_EACH (Pitch)
1828 Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, Pitch_speckle_YES, kPitch_unit::SEMITONES_200);
1829 GRAPHICS_EACH_END
1830 }
1831
1832 FORM (GRAPHICS_Pitch_speckleSemitones440, U"Pitch: Speckle semitones (re 440 Hz)", U"Pitch: Draw...") {
1833 praat_TimeFunction_RANGE (fromTime, toTime)
1834 COMMENT (U"Range in semitones re 440 hertz:")
1835 REAL (fromFrequency, U"left Frequency range (st)", U"-36.0")
1836 REAL (toFrequency, U"right Frequency range (st)", U"6.0")
1837 BOOLEAN (garnish, U"Garnish", true)
1838 OK
1839 DO
1840 GRAPHICS_EACH (Pitch)
1841 Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, Pitch_speckle_YES, kPitch_unit::SEMITONES_440);
1842 GRAPHICS_EACH_END
1843 }
1844
1845 FORM (NEW_Pitch_subtractLinearFit, U"Pitch: subtract linear fit", nullptr) {
1846 OPTIONMENU (unit_i, U"Unit", 1)
1847 OPTION (U"Hertz")
1848 OPTION (U"mel")
1849 OPTION (U"logHertz")
1850 OPTION (U"semitones")
1851 OPTION (U"ERB")
1852 OK
1853 DO
1854 const kPitch_unit unit =
1855 unit_i == 1 ? kPitch_unit::HERTZ :
1856 unit_i == 2 ? kPitch_unit::MEL :
1857 unit_i == 3 ? kPitch_unit::LOG_HERTZ :
1858 unit_i == 4 ? kPitch_unit::SEMITONES_1 :
1859 kPitch_unit::ERB;
1860 CONVERT_EACH_TO_ONE (Pitch)
1861 autoPitch result = Pitch_subtractLinearFit (me, unit);
1862 CONVERT_EACH_TO_ONE_END (my name.get())
1863 }
1864
1865 DIRECT (NEW_Pitch_to_IntervalTier) {
1866 CONVERT_EACH_TO_ONE (Pitch)
1867 autoIntervalTier result = IntervalTier_create (my xmin, my xmax);
1868 CONVERT_EACH_TO_ONE_END (my name.get())
1869 }
1870
1871 DIRECT (NEW_Pitch_to_Matrix) {
1872 CONVERT_EACH_TO_ONE (Pitch)
1873 autoMatrix result = Pitch_to_Matrix (me);
1874 CONVERT_EACH_TO_ONE_END (my name.get())
1875 }
1876
1877 DIRECT (NEW_Pitch_downto_PitchTier) {
1878 CONVERT_EACH_TO_ONE (Pitch)
1879 autoPitchTier result = Pitch_to_PitchTier (me);
1880 CONVERT_EACH_TO_ONE_END (my name.get())
1881 }
1882
1883 DIRECT (NEW_Pitch_to_PointProcess) {
1884 CONVERT_EACH_TO_ONE (Pitch)
1885 autoPointProcess result = Pitch_to_PointProcess (me);
1886 CONVERT_EACH_TO_ONE_END (my name.get())
1887 }
1888
1889 DIRECT (NEW_Pitch_to_Sound_pulses) {
1890 CONVERT_EACH_TO_ONE (Pitch)
1891 autoSound result = Pitch_to_Sound (me, 0.0, 0.0, false);
1892 CONVERT_EACH_TO_ONE_END (my name.get())
1893 }
1894
1895 DIRECT (NEW_Pitch_to_Sound_hum) {
1896 CONVERT_EACH_TO_ONE (Pitch)
1897 autoSound result = Pitch_to_Sound (me, 0.0, 0.0, true);
1898 CONVERT_EACH_TO_ONE_END (my name.get())
1899 }
1900
1901 FORM (NEW_Pitch_to_Sound_sine, U"Pitch: To Sound (sine)", nullptr) {
1902 POSITIVE (samplingFrequency, U"Sampling frequency (Hz)", U"44100.0")
1903 CHOICEx (cutVoicelessStretches, U"Cut voiceless stretches", 2, 0)
1904 OPTION (U"exactly")
1905 OPTION (U"at nearest zero crossings")
1906 OK
1907 DO
1908 CONVERT_EACH_TO_ONE (Pitch)
1909 autoSound result = Pitch_to_Sound_sine (me, 0.0, 0.0, samplingFrequency, cutVoicelessStretches);
1910 CONVERT_EACH_TO_ONE_END (my name.get())
1911 }
1912
1913 FORM (NEW_Pitch_to_TextGrid, U"To TextGrid...", U"Pitch: To TextGrid...") {
1914 SENTENCE (tierNames, U"Tier names", U"Mary John bell")
1915 SENTENCE (pointTiers, U"Point tiers", U"bell")
1916 OK
1917 DO
1918 CONVERT_EACH_TO_ONE (Pitch)
1919 autoTextGrid result = TextGrid_create (my xmin, my xmax, tierNames, pointTiers);
1920 CONVERT_EACH_TO_ONE_END (my name.get())
1921 }
1922
1923 DIRECT (NEW_Pitch_to_TextTier) {
1924 CONVERT_EACH_TO_ONE (Pitch)
1925 autoTextTier result = TextTier_create (my xmin, my xmax);
1926 CONVERT_EACH_TO_ONE_END (my name.get())
1927 }
1928
1929 // MARK: - PITCH & PITCHTIER
1930
1931 FORM (GRAPHICS_old_PitchTier_Pitch_draw, U"PitchTier & Pitch: Draw", nullptr) {
1932 praat_TimeFunction_RANGE (fromTime, toTime)
1933 REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
1934 REAL (toFrequency, U"To frequency (Hz)", U"500.0")
1935 CHOICEx (lineTypeForNonperiodicIntervals, U"Line type for non-periodic intervals", 2, 0)
1936 OPTION (U"normal")
1937 OPTION (U"dotted")
1938 OPTION (U"blank")
1939 BOOLEAN (garnish, U"Garnish", true)
1940 OK
1941 DO
1942 GRAPHICS_ONE_AND_ONE (PitchTier, Pitch)
1943 PitchTier_Pitch_draw (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
1944 lineTypeForNonperiodicIntervals, garnish, U"lines and speckles");
1945 GRAPHICS_ONE_AND_ONE_END
1946 }
1947
1948 FORM (GRAPHICS_PitchTier_Pitch_draw, U"PitchTier & Pitch: Draw", nullptr) {
1949 praat_TimeFunction_RANGE (fromTime, toTime)
1950 REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
1951 REAL (toFrequency, U"To frequency (Hz)", U"500.0")
1952 CHOICEx (lineTypeForNonperiodicIntervals, U"Line type for non-periodic intervals", 2, 0)
1953 OPTION (U"normal")
1954 OPTION (U"dotted")
1955 OPTION (U"blank")
1956 BOOLEAN (garnish, U"Garnish", true)
1957 COMMENT (U"")
1958 OPTIONMENUSTR (drawingMethod, U"Drawing method", 1)
1959 OPTION (U"lines")
1960 OPTION (U"speckles")
1961 OPTION (U"lines and speckles")
1962 OK
1963 DO_ALTERNATIVE (GRAPHICS_old_PitchTier_Pitch_draw)
1964 GRAPHICS_ONE_AND_ONE (PitchTier, Pitch)
1965 PitchTier_Pitch_draw (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
1966 lineTypeForNonperiodicIntervals, garnish, drawingMethod);
1967 GRAPHICS_ONE_AND_ONE_END
1968 }
1969
1970 DIRECT (NEW1_Pitch_PitchTier_to_Pitch) {
1971 CONVERT_ONE_AND_ONE_TO_ONE (Pitch, PitchTier)
1972 autoPitch result = Pitch_PitchTier_to_Pitch (me, you);
1973 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_stylized");
1974 }
1975
1976 // MARK: - PITCH & POINTPROCESS
1977
1978 DIRECT (NEW1_Pitch_PointProcess_to_PitchTier) {
1979 CONVERT_ONE_AND_ONE_TO_ONE (Pitch, PointProcess)
1980 autoPitchTier result = Pitch_PointProcess_to_PitchTier (me, you);
1981 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get());
1982 }
1983
1984 // MARK: - PITCH & SOUND
1985
1986 DIRECT (NEW1_Sound_Pitch_to_Manipulation) {
1987 CONVERT_ONE_AND_ONE_TO_ONE (Sound, Pitch)
1988 autoManipulation result = Sound_Pitch_to_Manipulation (me, you);
1989 CONVERT_ONE_AND_ONE_TO_ONE_END (your name.get());
1990 }
1991
1992 DIRECT (NEW1_Sound_Pitch_to_PointProcess_cc) {
1993 CONVERT_ONE_AND_ONE_TO_ONE (Sound, Pitch)
1994 autoPointProcess result = Sound_Pitch_to_PointProcess_cc (me, you);
1995 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get());
1996 }
1997
1998 FORM (NEW1_Sound_Pitch_to_PointProcess_peaks, U"Sound & Pitch: To PointProcess (peaks)", 0) {
1999 BOOLEAN (includeMaxima, U"Include maxima", true)
2000 BOOLEAN (includeMinima, U"Include minima", false)
2001 OK
2002 DO
2003 CONVERT_ONE_AND_ONE_TO_ONE (Sound, Pitch)
2004 autoPointProcess result = Sound_Pitch_to_PointProcess_peaks (me, you, includeMaxima, includeMinima);
2005 CONVERT_ONE_AND_ONE_TO_ONE_END (my name.get(), U"_", your name.get())
2006 }
2007
2008 // MARK: - POLYGON
2009
2010 FORM (NEW1_Polygon_createFromValues, U"Create Polygon from values", U"Create Polygon from values...") {
2011 WORD (name, U"Name", U"triangle")
2012 REALVECTOR (xValues, U"X values", WHITESPACE_SEPARATED_, U"0 50 20")
2013 REALVECTOR (yValues, U"Y values", WHITESPACE_SEPARATED_, U"0 10 80")
2014 OK
2015 DO
2016 CREATE_ONE
2017 Melder_require (xValues.size == yValues.size,
2018 U"The number of x values should equal the number of y values.");
2019 autoPolygon result = Polygon_create (xValues.size);
2020 result -> x.all() <<= xValues;
2021 result -> y.all() <<= yValues;
2022 CREATE_ONE_END (name);
2023 }
2024
2025 FORM (GRAPHICS_Polygon_draw, U"Polygon: Draw", nullptr) {
2026 REAL (xmin, U"Xmin", U"0.0")
2027 REAL (xmax, U"Xmax", U"0.0 (= all)")
2028 REAL (ymin, U"Ymin", U"0.0")
2029 REAL (ymax, U"Ymax", U"0.0 (= all)")
2030 OK
2031 DO
2032 GRAPHICS_EACH (Polygon)
2033 Polygon_draw (me, GRAPHICS, xmin, xmax, ymin, ymax);
2034 GRAPHICS_EACH_END
2035 }
2036
2037 FORM (GRAPHICS_Polygon_drawCircles, U"Polygon: Draw circles", nullptr) {
2038 REAL (xmin, U"Xmin", U"0.0")
2039 REAL (xmax, U"Xmax", U"0.0 (= all)")
2040 REAL (ymin, U"Ymin", U"0.0")
2041 REAL (ymax, U"Ymax", U"0.0 (= all)")
2042 POSITIVE (diameter, U"Diameter (mm)", U"3.0")
2043 OK
2044 DO
2045 GRAPHICS_EACH (Polygon)
2046 Polygon_drawCircles (me, GRAPHICS, xmin, xmax, ymin, ymax, diameter);
2047 GRAPHICS_EACH_END
2048 }
2049
2050 FORM (GRAPHICS_Polygon_drawClosed, U"Polygon: Draw", nullptr) {
2051 REAL (xmin, U"Xmin", U"0.0")
2052 REAL (xmax, U"Xmax", U"0.0 (= all)")
2053 REAL (ymin, U"Ymin", U"0.0")
2054 REAL (ymax, U"Ymax", U"0.0 (= all)")
2055 OK
2056 DO
2057 GRAPHICS_EACH (Polygon)
2058 Polygon_drawClosed (me, GRAPHICS, xmin, xmax, ymin, ymax);
2059 GRAPHICS_EACH_END
2060 }
2061
2062 FORM (GRAPHICS_Polygons_drawConnection, U"Polygons: Draw connection", nullptr) {
2063 REAL (xmin, U"Xmin", U"0.0")
2064 REAL (xmax, U"Xmax", U"0.0 (= all)")
2065 REAL (ymin, U"Ymin", U"0.0")
2066 REAL (ymax, U"Ymax", U"0.0 (= all)")
2067 BOOLEAN (arrow, U"Arrow", false)
2068 POSITIVE (relativeLength, U"Relative length", U"0.9")
2069 OK
2070 DO
2071 GRAPHICS_TWO (Polygon)
2072 Polygons_drawConnection (me, you, GRAPHICS, xmin, xmax, ymin, ymax, arrow, relativeLength);
2073 GRAPHICS_TWO_END
2074 }
2075
2076 DIRECT (HELP_Polygon_help) {
2077 HELP (U"Polygon")
2078 }
2079
2080 FORM (GRAPHICS_Polygon_paint, U"Polygon: Paint", nullptr) {
2081 COLOUR (colour, U"Colour (0-1, name, or {r,g,b})", U"0.5")
2082 REAL (xmin, U"Xmin", U"0.0")
2083 REAL (xmax, U"Xmax", U"0.0 (= all)")
2084 REAL (ymin, U"Ymin", U"0.0")
2085 REAL (ymax, U"Ymax", U"0.0 (= all)")
2086 OK
2087 DO
2088 GRAPHICS_EACH (Polygon)
2089 Polygon_paint (me, GRAPHICS, colour, xmin, xmax, ymin, ymax);
2090 GRAPHICS_EACH_END
2091 }
2092
2093 FORM (GRAPHICS_Polygon_paintCircles, U"Polygon: Paint circles", nullptr) {
2094 REAL (xmin, U"Xmin", U"0.0")
2095 REAL (xmax, U"Xmax", U"0.0 (= all)")
2096 REAL (ymin, U"Ymin", U"0.0")
2097 REAL (ymax, U"Ymax", U"0.0 (= all)")
2098 POSITIVE (diameter, U"Diameter (mm)", U"3.0")
2099 OK
2100 DO
2101 GRAPHICS_EACH (Polygon)
2102 Polygon_paintCircles (me, GRAPHICS, xmin, xmax, ymin, ymax, diameter);
2103 GRAPHICS_EACH_END
2104 }
2105
2106 DIRECT (MODIFY_Polygon_randomize) {
2107 MODIFY_EACH (Polygon)
2108 Polygon_randomize (me);
2109 MODIFY_EACH_END
2110 }
2111
2112 FORM (MODIFY_Polygon_salesperson, U"Polygon: Find shortest path", nullptr) {
2113 NATURAL (numberOfIterations, U"Number of iterations", U"1")
2114 OK
2115 DO
2116 MODIFY_EACH (Polygon)
2117 Polygon_salesperson (me, numberOfIterations);
2118 MODIFY_EACH_END
2119 }
2120
2121 DIRECT (NEW_Polygon_to_Matrix) {
2122 CONVERT_EACH_TO_ONE (Polygon)
2123 autoMatrix result = Polygon_to_Matrix (me);
2124 CONVERT_EACH_TO_ONE_END (my name.get())
2125 }
2126
2127 // MARK: - SOUND & PITCH & POINTPROCESS
2128
2129 FORM (INFO_Sound_Pitch_PointProcess_voiceReport, U"Voice report", U"Voice") {
2130 praat_TimeFunction_RANGE (fromTime, toTime)
2131 POSITIVE (fromPitch, U"left Pitch range (Hz)", U"75.0")
2132 POSITIVE (toPitch, U"right Pitch range (Hz)", U"600.0")
2133 POSITIVE (maximumPeriodFactor, U"Maximum period factor", U"1.3")
2134 POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", U"1.6")
2135 REAL (silenceThreshold, U"Silence threshold", U"0.03")
2136 REAL (voicingThreshold, U"Voicing threshold", U"0.45")
2137 OK
2138 DO
2139 INFO_ONE_AND_ONE_AND_ONE (Sound, Pitch, PointProcess)
2140 MelderInfo_open ();
2141 Sound_Pitch_PointProcess_voiceReport (me, you, him, fromTime, toTime, fromPitch, toPitch,
2142 maximumPeriodFactor, maximumAmplitudeFactor, silenceThreshold, voicingThreshold);
2143 MelderInfo_close ();
2144 INFO_ONE_AND_ONE_AND_ONE_END
2145 }
2146
2147 // MARK: - SOUND & POINTPROCESS & PITCHTIER & DURATIONTIER
2148
2149 FORM (NEW1_Sound_Point_Pitch_Duration_to_Sound, U"To Sound", nullptr) {
2150 POSITIVE (longestPeriod, U"Longest period (s)", U"0.02")
2151 OK
2152 DO
2153 CONVERT_ONE_AND_ONE_AND_ONE_AND_ONE_TO_ONE (Sound, PointProcess, PitchTier, DurationTier)
2154 autoSound result = Sound_Point_Pitch_Duration_to_Sound (me, you, him, she, longestPeriod);
2155 CONVERT_ONE_AND_ONE_AND_ONE_AND_ONE_TO_ONE_END (U"manip");
2156 }
2157
2158 // MARK: - SPECTROGRAM
2159
2160 FORM (GRAPHICS_Spectrogram_paint, U"Spectrogram: Paint", U"Spectrogram: Paint...") {
2161 praat_TimeFunction_RANGE (fromTime, toTime)
2162 REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
2163 REAL (toFrequency, U"right Frequency range (Hz)", U"0.0 (= all)")
2164 REAL (maximum, U"Maximum (dB/Hz)", U"100.0")
2165 BOOLEAN (autoscaling, U"Autoscaling", 1)
2166 POSITIVE (dynamicRange, U"Dynamic range (dB)", U"50.0")
2167 REAL (preEmphasis, U"Pre-emphasis (dB/oct)", U"6.0")
2168 REAL (dynamicCompression, U"Dynamic compression (0-1)", U"0.0")
2169 BOOLEAN (garnish, U"Garnish", 1)
2170 OK
2171 DO
2172 GRAPHICS_EACH (Spectrogram)
2173 Spectrogram_paint (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
2174 maximum, autoscaling, dynamicRange, preEmphasis, dynamicCompression,
2175 kSpectrogram_colourMap::GREY, false,
2176 garnish
2177 );
2178 GRAPHICS_EACH_END
2179 }
2180
2181 FORM (MODIFY_Spectrogram_formula, U"Spectrogram: Formula", U"Spectrogram: Formula...") {
2182 COMMENT (U"Do for all times and frequencies:")
2183 COMMENT (U" `x` is the time in seconds")
2184 COMMENT (U" `y` is the frequency in hertz")
2185 COMMENT (U" `self` is the current value in Pa\u00B2/Hz")
2186 FORMULA (formula, U" Replace all values with", U"self * exp (- x / 0.1)")
2187 OK
2188 DO
2189 MODIFY_EACH_WEAK (Spectrogram)
2190 Matrix_formula (me, formula, interpreter, nullptr);
2191 MODIFY_EACH_WEAK_END
2192 }
2193
2194 FORM (REAL_Spectrogram_getPowerAt, U"Spectrogram: Get power at (time, frequency)", nullptr) {
2195 REAL (time, U"Time (s)", U"0.5")
2196 REAL (frequency, U"Frequency (Hz)", U"1000")
2197 OK
2198 DO
2199 QUERY_ONE_FOR_REAL (Spectrogram)
2200 const double result = Matrix_getValueAtXY (me, time, frequency);
2201 QUERY_ONE_FOR_REAL_END (U" Pa2/Hz (at time = ", time, U" seconds and frequency = ", frequency, U" Hz)")
2202 }
2203
2204 DIRECT (HELP_Spectrogram_help) {
2205 HELP (U"Spectrogram")
2206 }
2207
2208 DIRECT (MOVIE_Spectrogram_playMovie) {
2209 MOVIE_ONE (Spectrogram, U"Spectrogram movie", 300, 300)
2210 Matrix_playMovie (me, graphics);
2211 MOVIE_ONE_END
2212 }
2213
2214 DIRECT (NEW_Spectrogram_to_Matrix) {
2215 CONVERT_EACH_TO_ONE (Spectrogram)
2216 autoMatrix result = Spectrogram_to_Matrix (me);
2217 CONVERT_EACH_TO_ONE_END (my name.get())
2218 }
2219
2220 FORM (NEW_Spectrogram_to_Sound, U"Spectrogram: To Sound", nullptr) {
2221 REAL (samplingFrequency, U"Sampling frequency (Hz)", U"44100.0")
2222 OK
2223 DO
2224 CONVERT_EACH_TO_ONE (Spectrogram)
2225 autoSound result = Spectrogram_to_Sound (me, samplingFrequency);
2226 CONVERT_EACH_TO_ONE_END (my name.get())
2227 }
2228
2229 FORM (NEW_Spectrogram_to_Spectrum, U"Spectrogram: To Spectrum (slice)", nullptr) {
2230 REAL (time, U"Time (seconds)", U"0.0")
2231 OK
2232 DO
2233 CONVERT_EACH_TO_ONE (Spectrogram)
2234 autoSpectrum result = Spectrogram_to_Spectrum (me, time);
2235 CONVERT_EACH_TO_ONE_END (my name.get())
2236 }
2237
2238 DIRECT (EDITOR_ONE_Spectrogram_view) {
2239 EDITOR_ONE (a,Spectrogram)
2240 autoSpectrogramEditor editor = SpectrogramEditor_create (ID_AND_FULL_NAME, me);
2241 EDITOR_ONE_END
2242 }
2243
2244 // MARK: - SPECTRUM
2245
2246 // MARK: - Help
2247
2248 DIRECT (HELP_Spectrum_help) {
2249 HELP (U"Spectrum")
2250 }
2251
2252 // MARK: View & Edit
2253
2254 DIRECT (EDITOR_ONE_Spectrum_viewAndEdit) {
2255 EDITOR_ONE (a,Spectrum)
2256 autoSpectrumEditor editor = SpectrumEditor_create (ID_AND_FULL_NAME, me);
2257 EDITOR_ONE_END
2258 }
2259
2260 // MARK: Draw
2261
2262 FORM (GRAPHICS_Spectrum_draw, U"Spectrum: Draw", nullptr) {
2263 REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
2264 REAL (toFrequency, U"right Frequency range (Hz)", U"0.0 (= all)")
2265 REAL (minimumPower, U"Minimum power (dB/Hz)", U"0 (= auto)")
2266 REAL (maximumPower, U"Maximum power (dB/Hz)", U"0 (= auto)")
2267 BOOLEAN (garnish, U"Garnish", true)
2268 OK
2269 DO
2270 GRAPHICS_EACH (Spectrum)
2271 Spectrum_draw (me, GRAPHICS, fromFrequency, toFrequency, minimumPower, maximumPower, garnish);
2272 GRAPHICS_EACH_END
2273 }
2274
2275 FORM (GRAPHICS_Spectrum_drawLogFreq, U"Spectrum: Draw (log freq)", nullptr) {
2276 POSITIVE (fromFrequency, U"left Frequency range (Hz)", U"10.0")
2277 POSITIVE (toFrequency, U"right Frequency range (Hz)", U"10000.0")
2278 REAL (minimumPower, U"Minimum power (dB/Hz)", U"0 (= auto)")
2279 REAL (maximumPower, U"Maximum power (dB/Hz)", U"0 (= auto)")
2280 BOOLEAN (garnish, U"Garnish", true)
2281 OK
2282 DO
2283 GRAPHICS_EACH (Spectrum)
2284 Spectrum_drawLogFreq (me, GRAPHICS, fromFrequency, toFrequency, minimumPower, maximumPower, garnish);
2285 GRAPHICS_EACH_END
2286 }
2287
2288 // MARK: Tabulate
2289
2290 FORM (NEW_Spectrum_tabulate, U"Spectrum: Tabulate", 0) {
2291 BOOLEAN (includeBinNumber, U"Include bin number", false)
2292 BOOLEAN (includeFrequency, U"Include frequency", true)
2293 BOOLEAN (includeRealPart, U"Include real part", false)
2294 BOOLEAN (includeImaginaryPart, U"Include imaginary part", false)
2295 BOOLEAN (includeEnergyDensity, U"Include energy density", false)
2296 BOOLEAN (includePowerDensity, U"Include power density", true)
2297 OK
2298 DO
2299 CONVERT_EACH_TO_ONE (Spectrum)
2300 autoTable result = Spectrum_tabulate (me, includeBinNumber, includeFrequency, includeRealPart, includeImaginaryPart,
2301 includeEnergyDensity, includePowerDensity);
2302 CONVERT_EACH_TO_ONE_END (my name.get())
2303 }
2304
2305 DIRECT (NEW_Spectrum_tabulate_verbose) {
2306 CONVERT_EACH_TO_ONE (Spectrum)
2307 autoTable result = Spectrum_tabulate_verbose (me);
2308 CONVERT_EACH_TO_ONE_END (my name.get())
2309 }
2310
2311 // MARK: Query
2312
2313 FORM (REAL_Spectrum_getBandDensity, U"Spectrum: Get band density", nullptr) {
2314 REAL (bandFloor, U"Band floor (Hz)", U"200.0")
2315 REAL (bandCeiling, U"Band ceiling (Hz)", U"1000.0")
2316 OK
2317 DO
2318 QUERY_ONE_FOR_REAL (Spectrum)
2319 const double result = Spectrum_getBandDensity (me, bandFloor, bandCeiling);
2320 QUERY_ONE_FOR_REAL_END (U" Pa2 / Hz2")
2321 }
2322
2323 FORM (REAL_Spectrum_getBandDensityDifference, U"Spectrum: Get band density difference", nullptr) {
2324 REAL (lowBandFloor, U"Low band floor (Hz)", U"0.0")
2325 REAL (lowBandCeiling, U"Low band ceiling (Hz)", U"500.0")
2326 REAL (highBandFloor, U"High band floor (Hz)", U"500.0")
2327 REAL (highBandCeiling, U"High band ceiling (Hz)", U"4000.0")
2328 OK
2329 DO
2330 QUERY_ONE_FOR_REAL (Spectrum)
2331 const double result = Spectrum_getBandDensityDifference (me,
2332 lowBandFloor, lowBandCeiling, highBandFloor, highBandCeiling);
2333 QUERY_ONE_FOR_REAL_END (U" dB")
2334 }
2335
2336 FORM (REAL_Spectrum_getBandEnergy, U"Spectrum: Get band energy", nullptr) {
2337 REAL (bandFloor, U"Band floor (Hz)", U"200.0")
2338 REAL (bandCeiling, U"Band ceiling (Hz)", U"1000.0")
2339 OK
2340 DO
2341 QUERY_ONE_FOR_REAL (Spectrum)
2342 const double result = Spectrum_getBandEnergy (me, bandFloor, bandCeiling);
2343 QUERY_ONE_FOR_REAL_END (U" Pa2 sec")
2344 }
2345
2346 FORM (REAL_Spectrum_getBandEnergyDifference, U"Spectrum: Get band energy difference", nullptr) {
2347 REAL (lowBandFloor, U"Low band floor (Hz)", U"0.0")
2348 REAL (lowBandCeiling, U"Low band ceiling (Hz)", U"500.0")
2349 REAL (highBandFloor, U"High band floor (Hz)", U"500.0")
2350 REAL (highBandCeiling, U"High band ceiling (Hz)", U"4000.0")
2351 OK
2352 DO
2353 QUERY_ONE_FOR_REAL (Spectrum)
2354 const double result = Spectrum_getBandEnergyDifference (me,
2355 lowBandFloor, lowBandCeiling, highBandFloor, highBandCeiling);
2356 QUERY_ONE_FOR_REAL_END (U" dB")
2357 }
2358
2359 FORM (REAL_Spectrum_getBinNumberFromFrequency, U"Spectrum: Get bin number from frequency", nullptr) {
2360 REAL (frequency, U"Frequency (Hz)", U"2000.0")
2361 OK
2362 DO
2363 QUERY_ONE_FOR_REAL (Spectrum)
2364 const double result = Sampled_xToIndex (me, frequency);
2365 QUERY_ONE_FOR_REAL_END (U" (bin number as a real value)")
2366 }
2367
2368 DIRECT (REAL_Spectrum_getBinWidth) {
2369 QUERY_ONE_FOR_REAL (Spectrum)
2370 const double result = my dx;
2371 QUERY_ONE_FOR_REAL_END (U" hertz")
2372 }
2373
2374 FORM (REAL_Spectrum_getCentralMoment, U"Spectrum: Get central moment", U"Spectrum: Get central moment...") {
2375 POSITIVE (moment, U"Moment", U"3.0")
2376 POSITIVE (power, U"Power", U"2.0")
2377 OK
2378 DO
2379 QUERY_ONE_FOR_REAL (Spectrum)
2380 const double result = Spectrum_getCentralMoment (me, moment, power);
2381 QUERY_ONE_FOR_REAL_END (U" hertz to the power ", moment)
2382 }
2383
2384 FORM (REAL_Spectrum_getCentreOfGravity, U"Spectrum: Get centre of gravity", U"Spectrum: Get centre of gravity...") {
2385 POSITIVE (power, U"Power", U"2.0")
2386 OK
2387 DO
2388 QUERY_ONE_FOR_REAL (Spectrum)
2389 const double result = Spectrum_getCentreOfGravity (me, power);
2390 QUERY_ONE_FOR_REAL_END (U" hertz")
2391 }
2392
2393 FORM (REAL_Spectrum_getFrequencyFromBin, U"Spectrum: Get frequency from bin", nullptr) {
2394 NATURAL (bandNumber, U"Band number", U"1")
2395 OK
2396 DO
2397 QUERY_ONE_FOR_REAL (Spectrum)
2398 const double result = Sampled_indexToX (me, bandNumber);
2399 QUERY_ONE_FOR_REAL_END (U" hertz")
2400 }
2401
2402 DIRECT (REAL_Spectrum_getLowestFrequency) {
2403 QUERY_ONE_FOR_REAL (Spectrum)
2404 const double result = my xmin;
2405 QUERY_ONE_FOR_REAL_END (U" hertz")
2406 }
2407
2408 DIRECT (REAL_Spectrum_getHighestFrequency) {
2409 QUERY_ONE_FOR_REAL (Spectrum)
2410 const double result = my xmax;
2411 QUERY_ONE_FOR_REAL_END (U" hertz");
2412 }
2413
2414 FORM (REAL_Spectrum_getRealValueInBin, U"Spectrum: Get real value in bin", nullptr) {
2415 NATURAL (binNumber, U"Bin number", U"100")
2416 OK
2417 DO
2418 QUERY_ONE_FOR_REAL (Spectrum)
2419 if (binNumber > my nx)
2420 Melder_throw (U"Bin number should not exceed number of bins.");
2421 const double result = my z [1] [binNumber];
2422 QUERY_ONE_FOR_REAL_END (U" (real value in bin ", binNumber, U")")
2423 }
2424
2425 FORM (REAL_Spectrum_getImaginaryValueInBin, U"Spectrum: Get imaginary value in bin", nullptr) {
2426 NATURAL (binNumber, U"Bin number", U"100")
2427 OK
2428 DO
2429 QUERY_ONE_FOR_REAL (Spectrum)
2430 if (binNumber > my nx)
2431 Melder_throw (U"The bin number should not exceed the number of bins.");
2432 const double result = my z [2] [binNumber];
2433 QUERY_ONE_FOR_REAL_END (U" (imaginary value in bin ", binNumber, U")")
2434 }
2435
2436 FORM (REAL_Spectrum_getKurtosis, U"Spectrum: Get kurtosis", U"Spectrum: Get kurtosis...") {
2437 POSITIVE (power, U"Power", U"2.0")
2438 OK
2439 DO
2440 QUERY_ONE_FOR_REAL (Spectrum)
2441 const double result = Spectrum_getKurtosis (me, power);
2442 QUERY_ONE_FOR_REAL_END (U" (kurtosis)")
2443 }
2444
2445 FORM (REAL_Spectrum_getSoundPressureLevelOfNearestMaximum, U"Spectrum: Get sound pressure level of nearest maximum", U"Spectrum: Get sound pressure level of nearest maximum...") {
2446 POSITIVE (frequency, U"Frequency (Hz)", U"1000.0")
2447 OK
2448 DO
2449 QUERY_ONE_FOR_REAL (Spectrum)
2450 const MelderPoint maximum = Spectrum_getNearestMaximum (me, frequency);
2451 const double result = maximum. y;
2452 QUERY_ONE_FOR_REAL_END (U" \"dB/Hz\"")
2453 }
2454
2455 FORM (REAL_Spectrum_getFrequencyOfNearestMaximum, U"Spectrum: Get frequency of nearest maximum", U"Spectrum: Get frequency of nearest maximum...") {
2456 POSITIVE (frequency, U"Frequency (Hz)", U"1000.0")
2457 OK
2458 DO
2459 QUERY_ONE_FOR_REAL (Spectrum)
2460 const MelderPoint maximum = Spectrum_getNearestMaximum (me, frequency);
2461 const double result = maximum. x;
2462 QUERY_ONE_FOR_REAL_END (U" Hz")
2463 }
2464
2465 DIRECT (INTEGER_Spectrum_getNumberOfBins) {
2466 QUERY_ONE_FOR_REAL (Spectrum)
2467 const integer result = my nx;
2468 QUERY_ONE_FOR_REAL_END (U" bins")
2469 }
2470
2471 FORM (REAL_Spectrum_getSkewness, U"Spectrum: Get skewness", U"Spectrum: Get skewness...") {
2472 POSITIVE (power, U"Power", U"2.0")
2473 OK
2474 DO
2475 QUERY_ONE_FOR_REAL (Spectrum)
2476 const double result = Spectrum_getSkewness (me, power);
2477 QUERY_ONE_FOR_REAL_END (U" (skewness)")
2478 }
2479
2480 FORM (REAL_Spectrum_getStandardDeviation, U"Spectrum: Get standard deviation", U"Spectrum: Get standard deviation...") {
2481 POSITIVE (power, U"Power", U"2.0")
2482 OK
2483 DO
2484 QUERY_ONE_FOR_REAL (Spectrum)
2485 const double result = Spectrum_getStandardDeviation (me, power);
2486 QUERY_ONE_FOR_REAL_END (U" hertz")
2487 }
2488
2489 // MARK: Modify
2490
2491 FORM (MODIFY_Spectrum_formula, U"Spectrum: Formula", U"Spectrum: Formula...") {
2492 COMMENT (U"`x` is the frequency in hertz, `col` is the bin number; "
2493 "`y' = `row' is 1 (real part) or 2 (imaginary part)")
2494 COMMENT (U"y := 1; row := 1; "
2495 "x := 0; for col := 1 to ncol do { self [1, col] := `formula` ; x := x + dx }")
2496 COMMENT (U"y := 2; row := 2; "
2497 "x := 0; for col := 1 to ncol do { self [2, col] := `formula` ; x := x + dx }")
2498 FORMULA (formula, U"Formula", U"0")
2499 OK
2500 DO
2501 MODIFY_EACH_WEAK (Spectrum)
2502 Matrix_formula (me, formula, interpreter, nullptr);
2503 MODIFY_EACH_WEAK_END
2504 }
2505
2506 FORM (MODIFY_Spectrum_passHannBand, U"Spectrum: Filter (pass Hann band)", U"Spectrum: Filter (pass Hann band)...") {
2507 REAL (fromFrequency, U"From frequency (Hz)", U"500.0")
2508 REAL (toFrequency, U"To frequency (Hz)", U"1000.0")
2509 POSITIVE (smoothing, U"Smoothing (Hz)", U"100.0")
2510 OK
2511 DO
2512 MODIFY_EACH (Spectrum)
2513 Spectrum_passHannBand (me, fromFrequency, toFrequency, smoothing);
2514 MODIFY_EACH_END
2515 }
2516
2517 FORM (MODIFY_Spectrum_stopHannBand, U"Spectrum: Filter (stop Hann band)", U"Spectrum: Filter (stop Hann band)...") {
2518 REAL (fromFrequency, U"From frequency (Hz)", U"500.0")
2519 REAL (toFrequency, U"To frequency (Hz)", U"1000.0")
2520 POSITIVE (smoothing, U"Smoothing (Hz)", U"100.0")
2521 OK
2522 DO
2523 MODIFY_EACH (Spectrum)
2524 Spectrum_stopHannBand (me, fromFrequency, toFrequency, smoothing);
2525 MODIFY_EACH_END
2526 }
2527
2528 // MARK: Convert
2529
2530 FORM (NEW_Spectrum_cepstralSmoothing, U"Spectrum: Cepstral smoothing", nullptr) {
2531 POSITIVE (bandwidth, U"Bandwidth (Hz)", U"500.0")
2532 OK
2533 DO
2534 CONVERT_EACH_TO_ONE (Spectrum)
2535 autoSpectrum result = Spectrum_cepstralSmoothing (me, bandwidth);
2536 CONVERT_EACH_TO_ONE_END (my name.get())
2537 }
2538
2539 FORM (NEW_Spectrum_lpcSmoothing, U"Spectrum: LPC smoothing", 0) {
2540 NATURAL (numberOfPeaks, U"Number of peaks", U"5")
2541 POSITIVE (preEmphasisFrom, U"Pre-emphasis from (Hz)", U"50.0")
2542 OK
2543 DO
2544 CONVERT_EACH_TO_ONE (Spectrum)
2545 autoSpectrum result = Spectrum_lpcSmoothing (me, numberOfPeaks, preEmphasisFrom);
2546 CONVERT_EACH_TO_ONE_END (my name.get())
2547 }
2548
2549 FORM (NEW_Spectrum_to_Excitation, U"Spectrum: To Excitation", nullptr) {
2550 POSITIVE (frequencyResolution, U"Frequency resolution (Bark)", U"0.1")
2551 OK
2552 DO
2553 CONVERT_EACH_TO_ONE (Spectrum)
2554 autoExcitation result = Spectrum_to_Excitation (me, frequencyResolution);
2555 CONVERT_EACH_TO_ONE_END (my name.get())
2556 }
2557
2558 FORM (NEW_Spectrum_to_Formant_peaks, U"Spectrum: To Formant (peaks)", nullptr) {
2559 COMMENT (U"Warning: this simply picks peaks from 0 Hz up!")
2560 NATURAL (maximumNumberOfFormants, U"Maximum number of formants", U"1000")
2561 OK
2562 DO
2563 CONVERT_EACH_TO_ONE (Spectrum)
2564 autoFormant result = Spectrum_to_Formant (me, maximumNumberOfFormants);
2565 CONVERT_EACH_TO_ONE_END (my name.get())
2566 }
2567
2568 FORM (NEW_Spectrum_to_Ltas, U"Spectrum: To Long-term average spectrum", nullptr) {
2569 POSITIVE (bandwidth, U"Bandwidth (Hz)", U"1000.0")
2570 OK
2571 DO
2572 CONVERT_EACH_TO_ONE (Spectrum)
2573 autoLtas result = Spectrum_to_Ltas (me, bandwidth);
2574 CONVERT_EACH_TO_ONE_END (my name.get())
2575 }
2576
2577 DIRECT (NEW_Spectrum_to_Ltas_1to1) {
2578 CONVERT_EACH_TO_ONE (Spectrum)
2579 autoLtas result = Spectrum_to_Ltas_1to1 (me);
2580 CONVERT_EACH_TO_ONE_END (my name.get())
2581 }
2582
2583 DIRECT (NEW_Spectrum_to_Matrix) {
2584 CONVERT_EACH_TO_ONE (Spectrum)
2585 autoMatrix result = Spectrum_to_Matrix (me);
2586 CONVERT_EACH_TO_ONE_END (my name.get())
2587 }
2588
2589 DIRECT (NEW_Spectrum_to_Sound) {
2590 CONVERT_EACH_TO_ONE (Spectrum)
2591 autoSound result = Spectrum_to_Sound (me);
2592 CONVERT_EACH_TO_ONE_END (my name.get())
2593 }
2594
2595 DIRECT (NEW_Spectrum_to_Spectrogram) {
2596 CONVERT_EACH_TO_ONE (Spectrum)
2597 autoSpectrogram result = Spectrum_to_Spectrogram (me);
2598 CONVERT_EACH_TO_ONE_END (my name.get())
2599 }
2600
2601 DIRECT (NEW_Spectrum_to_SpectrumTier_peaks) {
2602 CONVERT_EACH_TO_ONE (Spectrum)
2603 autoSpectrumTier result = Spectrum_to_SpectrumTier_peaks (me);
2604 CONVERT_EACH_TO_ONE_END (my name.get())
2605 }
2606
2607 // MARK: - STRINGS
2608
2609 // MARK: New
2610
2611 FORM (NEW1_Strings_createFromTexts, U"Create Strings from texts", nullptr) {
2612 WORD (name, U"Name", U"texts")
2613 STRINGARRAY_LINES (10, texts, U"Texts", { U"one line", U"another line", U"yet another line" })
2614 OK
2615 DO
2616 CREATE_ONE
2617 autoStrings result = Strings_createFromTexts (texts);
2618 CREATE_ONE_END (name);
2619 }
2620
2621 FORM (NEW1_Strings_createAsFileList, U"Create Strings as file list", U"Create Strings as file list...") {
2622 SENTENCE (name, U"Name", U"fileList")
2623 static structMelderFolder homeFolder { };
2624 Melder_getHomeDir (& homeFolder);
2625 static conststring32 homeFolderPath = MelderFolder_peekPath (& homeFolder);
2626 static char32 defaultGlob [kMelder_MAXPATH+1];
2627 #if defined (UNIX)
2628 Melder_sprint (defaultGlob,kMelder_MAXPATH+1, homeFolderPath, U"/*.wav");
2629 #elif defined (_WIN32)
2630 {
2631 static integer len = Melder_length (homeFolderPath);
2632 Melder_sprint (defaultGlob,kMelder_MAXPATH+1, homeFolderPath,
2633 len == 0 || homeFolderPath [len - 1] != U'\\' ? U"\\" : U"", U"*.wav");
2634 }
2635 #else
2636 Melder_sprint (defaultGlob,kMelder_MAXPATH+1, homeFolderPath, U"/*.wav");
2637 #endif
2638 FOLDER (path, U"File path", defaultGlob)
2639 OK
2640 DO
2641 CREATE_ONE
2642 autoStrings result = Strings_createAsFileList (path);
2643 CREATE_ONE_END (name)
2644 }
2645
2646 FORM (NEW1_Strings_createAsFolderList, U"Create Strings as folder list", U"Create Strings as folder list...") {
2647 SENTENCE (name, U"Name", U"folderList")
2648 static structMelderFolder homeFolder { };
2649 Melder_getHomeDir (& homeFolder);
2650 static conststring32 homeFolderPath = MelderFolder_peekPath (& homeFolder);
2651 static char32 defaultGlob [kMelder_MAXPATH+1];
2652 #if defined (UNIX)
2653 Melder_sprint (defaultGlob,kMelder_MAXPATH+1, homeFolderPath, U"/*");
2654 #elif defined (_WIN32)
2655 {
2656 const integer len = Melder_length (homeFolderPath);
2657 Melder_sprint (defaultGlob,kMelder_MAXPATH+1, homeFolderPath,
2658 len == 0 || homeFolderPath [len - 1] != U'\\' ? U"\\" : U"");
2659 }
2660 #else
2661 Melder_sprint (defaultGlob,kMelder_MAXPATH+1, homeFolderPath, U"/*");
2662 #endif
2663 FOLDER (path, U"Path", defaultGlob)
2664 OK
2665 DO
2666 CREATE_ONE
2667 autoStrings result = Strings_createAsFolderList (path);
2668 CREATE_ONE_END (name)
2669 }
2670
2671 // MARK: Open
2672
2673 FORM_READ (READ_ONE__Strings_readFromRawTextFile, U"Read Strings from raw text file", nullptr, true) {
2674 READ_ONE
2675 autoStrings result = Strings_readFromRawTextFile (file);
2676 READ_ONE_END
2677 }
2678
2679 // MARK: Save
2680
2681 FORM_SAVE (SAVE_Strings_writeToRawTextFile, U"Save Strings as raw text file", nullptr, U"txt") {
2682 SAVE_ONE (Strings, U"save the selected Strings object to the raw text file")
2683 Strings_writeToRawTextFile (me, file);
2684 SAVE_ONE_END
2685 }
2686
2687 // MARK: Help
2688
2689 DIRECT (HELP_Strings_help) {
2690 HELP (U"Strings")
2691 }
2692
2693 // MARK: View & Edit
2694
2695 DIRECT (EDITOR_ONE_Strings_viewAndEdit) {
2696 EDITOR_ONE (a,Strings)
2697 autoStringsEditor editor = StringsEditor_create (ID_AND_FULL_NAME, me);
2698 EDITOR_ONE_END
2699 }
2700
2701 // MARK: Query
2702
2703 DIRECT (BOOLEAN_Strings_equal) {
2704 QUERY_TWO_FOR_REAL (Strings)
2705 const integer result = (integer) Data_equal (me, you); // cast bool to 0 or 1
2706 QUERY_TWO_FOR_REAL_END (result ? U" (equal)" : U" (unequal)")
2707 }
2708
2709 DIRECT (INTEGER_Strings_getNumberOfStrings) {
2710 QUERY_ONE_FOR_REAL (Strings)
2711 const integer result = my numberOfStrings;
2712 QUERY_ONE_FOR_REAL_END (U" strings")
2713 }
2714
2715 FORM (STRING_Strings_getString, U"Get string", nullptr) {
2716 NATURAL (position, U"Position", U"1")
2717 OK
2718 DO
2719 QUERY_ONE_FOR_STRING (Strings)
2720 const conststring32 result = position > my numberOfStrings ? U"" : my strings [position].get(); // TODO
2721 QUERY_ONE_FOR_STRING_END
2722 }
2723
2724 DIRECT (STRVEC_Strings_listAllStrings) {
2725 QUERY_ONE_FOR_STRING_ARRAY (Strings)
2726 autoSTRVEC result = copy_STRVEC (my strings.get());
2727 QUERY_ONE_FOR_STRING_ARRAY_END
2728 }
2729
2730 // MARK: Modify
2731
2732 FORM (MODIFY_Strings_insertString, U"Strings: Insert string", nullptr) {
2733 INTEGER (atPosition, U"At position", U"0 (= at end)")
2734 TEXTFIELD (string, U"String", U"", 10)
2735 OK
2736 DO
2737 MODIFY_EACH (Strings)
2738 Strings_insert (me, atPosition, string);
2739 MODIFY_EACH_END
2740 }
2741
2742 DIRECT (MODIFY_Strings_nativize) {
2743 MODIFY_EACH_WEAK (Strings)
2744 Strings_nativize (me);
2745 MODIFY_EACH_WEAK_END
2746 }
2747
2748 DIRECT (MODIFY_Strings_genericize) {
2749 MODIFY_EACH_WEAK (Strings)
2750 Strings_genericize (me);
2751 MODIFY_EACH_WEAK_END
2752 }
2753
2754 DIRECT (MODIFY_Strings_randomize) {
2755 MODIFY_EACH (Strings)
2756 Strings_randomize (me);
2757 MODIFY_EACH_END
2758 }
2759
2760 FORM (MODIFY_Strings_removeString, U"Strings: Remove string", nullptr) {
2761 NATURAL (position, U"Position", U"1")
2762 OK
2763 DO
2764 MODIFY_EACH (Strings)
2765 Strings_remove (me, position);
2766 MODIFY_EACH_END
2767 }
2768
2769 FORM (MODIFY_Strings_setString, U"Strings: Set string", nullptr) {
2770 NATURAL (position, U"Position", U"1")
2771 TEXTFIELD (newString, U"New string", U"", 10)
2772 OK
2773 DO
2774 MODIFY_EACH (Strings)
2775 Strings_replace (me, position, newString);
2776 MODIFY_EACH_END
2777 }
2778
2779 DIRECT (MODIFY_Strings_sort) {
2780 MODIFY_EACH (Strings)
2781 Strings_sort (me);
2782 MODIFY_EACH_END
2783 }
2784
2785 // MARK: Convert
2786
2787 FORM (NEW_Strings_replaceAll, U"Strings: Replace all", nullptr) {
2788 SENTENCE (find, U"Find", U"a")
2789 SENTENCE (replaceWith, U"Replace with", U"b")
2790 INTEGER (replaceLimitPerString, U"Replace limit per string", U"0 (= unlimited)")
2791 CHOICEx (findAndReplaceStringsAre, U"Find and replace strings are", 1, 0)
2792 OPTION (U"literals")
2793 OPTION (U"regular expressions")
2794 OK
2795 DO
2796 CONVERT_EACH_TO_ONE (Strings)
2797 integer numberOfMatches, numberOfStringMatches;
2798 autoStrings result = Strings_change (me, find, replaceWith,
2799 replaceLimitPerString, & numberOfMatches, & numberOfStringMatches, findAndReplaceStringsAre); // FIXME: boolean inappropriate
2800 CONVERT_EACH_TO_ONE_END (my name.get(), U"_replaced")
2801 }
2802
2803 DIRECT (NEW_Strings_to_Distributions) {
2804 CONVERT_EACH_TO_ONE (Strings)
2805 autoDistributions result = Strings_to_Distributions (me);
2806 CONVERT_EACH_TO_ONE_END (my name.get())
2807 }
2808
2809 DIRECT (NEW_Strings_to_WordList) {
2810 CONVERT_EACH_TO_ONE (Strings)
2811 autoWordList result = Strings_to_WordList (me);
2812 CONVERT_EACH_TO_ONE_END (my name.get())
2813 }
2814
2815 // MARK: - TEXTGRID; the remainder is in praat_TextGrid_init.cpp
2816
2817 FORM (NEW1_TextGrid_create, U"Create TextGrid", U"Create TextGrid...") {
2818 COMMENT (U"Hint: to label or segment an existing Sound,")
2819 COMMENT (U"select that Sound and choose \"To TextGrid...\".")
2820 REAL (startTime, U"Start time (s)", U"0.0")
2821 REAL (endTime, U"End time (s)", U"1.0")
2822 SENTENCE (allTierNames, U"All tier names", U"Mary John bell")
2823 SENTENCE (whichOfTheseArePointTiers, U"Which of these are point tiers?", U"bell")
2824 OK
2825 DO
2826 if (endTime <= startTime)
2827 Melder_throw (U"The end time should be greater than the start time");
2828 CREATE_ONE
2829 autoTextGrid result = TextGrid_create (startTime, endTime, allTierNames, whichOfTheseArePointTiers);
2830 CREATE_ONE_END (allTierNames)
2831 }
2832
2833 FORM (READ_ONE__TextGrid_readFromEspsLabelFile, U"Read TextGrid from ESPS label file", U"Read TextGrid from ESPS label file...") {
2834 INFILE (soundFilePath, U"Sound file path", U"")
2835 BOOLEAN (tiersArePointTiers, U"Tiers are point tiers", false)
2836 INTEGER (overrideNumberOfTiers, U"Override number of tiers", U"0 (= don't override)")
2837 OK
2838 DO
2839 CREATE_ONE
2840 structMelderFile file { };
2841 Melder_relativePathToFile (soundFilePath, & file);
2842 autoTextGrid result = TextGrid_readFromEspsLabelFile (& file, tiersArePointTiers, overrideNumberOfTiers);
2843 CREATE_ONE_END (U"")
2844 }
2845
2846 FORM (NEW_Sound_readWithAdjacentAnnotationFiles_buckeye, U"Read with adjacent annotations (Buckeye)", U"Read with adjacent annotation files (Buckeye)...") {
2847 INFILE (soundFileName, U"Sound file name", U"/Volumes/Buckeye/s01/s0101a/s0101a.wav")
2848 OK
2849 DO
2850 CREATE_MULTIPLE
2851 autoTextGrid textgrid;
2852 autoSound sound = Sound_readWithAdjacentAnnotationFiles_buckeye (soundFileName, & textgrid);
2853 praat_new (sound.move());
2854 praat_new (textgrid.move());
2855 CREATE_MULTIPLE_END
2856 }
2857
2858 FORM (NEW_Sound_readWithAdjacentAnnotationFiles_timit, U"Read with adjacent annotations (TIMIT)", U"Read with adjacent annotation files (TIMIT)...") {
2859 INFILE (soundFileName, U"Sound file name", U"/Volumes/TIMIT/train/dr1/fcjf0/sa1.wav")
2860 OK
2861 DO
2862 CREATE_MULTIPLE
2863 autoTextGrid textgrid;
2864 autoSound sound = Sound_readWithAdjacentAnnotationFiles_timit (soundFileName, & textgrid);
2865 praat_newWithFile (sound.move(), nullptr, soundFileName);
2866 praat_newWithFile (textgrid.move(), nullptr, soundFileName);
2867 CREATE_MULTIPLE_END
2868 }
2869
2870 FORM (NEW_Sound_readWithAdjacentAnnotationFiles_cgn, U"Read with adjacent annotations (CGN)", U"Read with adjacent annotation files (CGN)...") {
2871 INFILE (soundFileName, U"Sound file name", U"/Volumes/CGN/comp-a/vl/fv400061.wav")
2872 OK
2873 DO
2874 CREATE_MULTIPLE
2875 autoSound sound;
2876 autoTextGrid textgrid = TextGrid_Sound_readFromCorpusGesprokenNederlands (soundFileName, & sound);
2877 praat_newWithFile (sound.move(), nullptr, soundFileName);
2878 praat_newWithFile (textgrid.move(), nullptr, soundFileName);
2879 CREATE_MULTIPLE_END
2880 }
2881
2882 FORM (NEW_Corpus_readFromCGN, U"Read Corpus from CGN", U"Read Corpus from CGN...") {
2883 FOLDER (folderName, U"CGN folder name", U"/Volumes/CGN")
2884 OK
2885 DO
2886 CREATE_ONE
2887 autoCorpus result = Corpus_readFromCGN (folderName);
2888 CREATE_ONE_END (U"CGN")
2889 }
2890
2891 // MARK: - TRANSITION
2892
2893 DIRECT (NEW_Transition_conflate) {
2894 CONVERT_EACH_TO_ONE (Transition)
2895 autoDistributions result = Transition_to_Distributions_conflate (me);
2896 CONVERT_EACH_TO_ONE_END (my name.get())
2897 }
2898
2899 FORM (GRAPHICS_Transition_drawAsNumbers, U"Draw as numbers", nullptr) {
2900 CHOICE (format, U"Format", 1)
2901 OPTION (U"decimal")
2902 OPTION (U"exponential")
2903 OPTION (U"free")
2904 OPTION (U"rational")
2905 NATURAL (precision, U"Precision", U"2")
2906 OK
2907 DO
2908 GRAPHICS_EACH (Transition)
2909 Transition_drawAsNumbers (me, GRAPHICS, format, precision);
2910 GRAPHICS_EACH_END
2911 }
2912
2913 DIRECT (NEWTIMES2_Transition_eigen) {
2914 CONVERT_EACH_TO_MULTIPLE (Transition)
2915 autoMatrix vectors, values;
2916 Transition_eigen (me, & vectors, & values);
2917 praat_new (vectors.move(), U"eigenvectors");
2918 praat_new (values.move(), U"eigenvalues");
2919 CONVERT_EACH_TO_MULTIPLE_END
2920 }
2921
2922 DIRECT (HELP_Transition_help) {
2923 HELP (U"Transition")
2924 }
2925
2926 FORM (NEW_Transition_power, U"Transition: Power...", nullptr) {
2927 NATURAL (power, U"Power", U"2")
2928 OK
2929 DO
2930 CONVERT_EACH_TO_ONE (Transition)
2931 autoTransition result = Transition_power (me, power);
2932 CONVERT_EACH_TO_ONE_END (my name.get())
2933 }
2934
2935 DIRECT (NEW_Transition_to_Matrix) {
2936 CONVERT_EACH_TO_ONE (Transition)
2937 autoMatrix result = Transition_to_Matrix (me);
2938 CONVERT_EACH_TO_ONE_END (my name.get())
2939 }
2940
2941 // MARK: - Praat menu
2942
2943 FORM (INFO_Praat_test, U"Praat test", 0) {
2944 OPTIONMENU_ENUM (kPraatTests, test, U"Test", kPraatTests::DEFAULT)
2945 SENTENCE (arg1, U"arg1", U"1000000")
2946 SENTENCE (arg2, U"arg2", U"")
2947 SENTENCE (arg3, U"arg3", U"")
2948 SENTENCE (arg4, U"arg4", U"")
2949 OK
2950 DO
2951 INFO_NONE
2952 Praat_tests ((kPraatTests) test, arg1, arg2, arg3, arg4);
2953 INFO_NONE_END
2954 }
2955
2956 // MARK: - Help menu
2957
2958 DIRECT (HELP_PraatIntro) { HELP (U"Intro") }
2959 DIRECT (HELP_ObjectWindow) { HELP (U"Objects window") }
2960 DIRECT (HELP_FrequentlyAskedQuestions) { HELP (U"FAQ (Frequently Asked Questions)") }
2961 DIRECT (HELP_TypesOfObjects) { HELP (U"Types of objects") }
2962 DIRECT (HELP_Editors) { HELP (U"Editors") }
2963 DIRECT (HELP_WhatsNew) { HELP (U"What's new?") }
2964 DIRECT (HELP_Acknowledgments) { HELP (U"Acknowledgments") }
2965 DIRECT (HELP_License) { HELP (U"License") }
2966 DIRECT (HELP_PrivacyAndSecurity) { HELP (U"Privacy and security") }
2967 DIRECT (HELP_CheckingForUpdates) { HELP (U"Checking for updates") }
2968 DIRECT (HELP_ReportingAProblem) { HELP (U"Reporting a problem") }
2969 DIRECT (HELP_FormulasTutorial) { HELP (U"Formulas") }
2970 DIRECT (HELP_ScriptingTutorial) { HELP (U"Scripting") }
2971 DIRECT (HELP_Functions) { HELP (U"Functions") }
2972 DIRECT (HELP_DemoWindow) { HELP (U"Demo window") }
2973 DIRECT (HELP_Interoperability) { HELP (U"Interoperability") }
2974 DIRECT (HELP_Programming) { HELP (U"Programming with Praat") }
2975 DIRECT (HELP_SearchManual_Fon) { Melder_search (); END_NO_NEW_DATA }
2976
2977 // MARK: - file recognizers
2978
2979 static autoDaata cgnSyntaxFileRecognizer (integer nread, const char *header, MelderFile file) {
2980 if (nread < 57)
2981 return autoDaata ();
2982 if (! strnequ (& header [0], "<?xml version=\"1.0\"?>", 21) ||
2983 (! strnequ (& header [22], "<!DOCTYPE ttext SYSTEM \"ttext.dtd\">", 35) &&
2984 ! strnequ (& header [23], "<!DOCTYPE ttext SYSTEM \"ttext.dtd\">", 35))
2985 )
2986 return autoDaata ();
2987 return TextGrid_readFromCgnSyntaxFile (file);
2988 }
2989
2990 static autoDaata chronologicalTextGridTextFileRecognizer (integer nread, const char *header, MelderFile file) {
2991 if (nread < 100)
2992 return autoDaata ();
2993 if (strnequ (& header [0], "\"Praat chronological TextGrid text file\"", 40))
2994 return TextGrid_readFromChronologicalTextFile (file);
2995 char headerCopy [101];
2996 memcpy (headerCopy, header, 100);
2997 headerCopy [100] = '\0';
2998 for (int i = 0; i < 100; i ++)
2999 if (headerCopy [i] == '\0')
3000 headerCopy [i] = '\001';
3001 //if (strstr (headerCopy, "\"\001P\001r\001a\001a\001t\001 \001c\001h\001r\001o\001n\001o\001l\001o\001g\001i\001c\001a\001l\001"
3002 // " \001T\001e\001x\001t\001G\001r\001i\001d\001 t\001"))
3003 if (strstr (headerCopy, "\"\001P\001r\001a\001a\001t\001 \001c\001h\001r\001o\001n\001o\001l\001o\001g\001i\001c\001a\001l\001"
3004 " \001T\001e\001x\001t\001G\001r\001i\001d\001 \001t\001e\001x\001t\001 \001f\001i\001l\001e\001\""))
3005 {
3006 return TextGrid_readFromChronologicalTextFile (file);
3007 }
3008 return autoDaata ();
3009 }
3010
3011 // MARK: - extension to praat_stat_init
3012
3013 static bool isTabSeparated_8bit (integer nread, const char *header) {
3014 for (integer i = 0; i < nread; i ++) {
3015 if (header [i] == '\t')
3016 return true;
3017 if (header [i] == '\n' || header [i] == '\r')
3018 return false;
3019 }
3020 return false;
3021 }
3022
3023 static bool isTabSeparated_utf16be (integer nread, const char *header) {
3024 for (integer i = 2; i < nread; i += 2) {
3025 if (header [i] == '\0' && header [i + 1] == '\t')
3026 return true;
3027 if (header [i] == '\0' && (header [i + 1] == '\n' || header [i + 1] == '\r'))
3028 return false;
3029 }
3030 return false;
3031 }
3032
3033 static bool isTabSeparated_utf16le (integer nread, const char *header) {
3034 for (integer i = 2; i < nread; i += 2) {
3035 if (header [i + 1] == '\0' && header [i] == '\t')
3036 return true;
3037 if (header [i + 1] == '\0' && (header [i] == '\n' || header [i] == '\r'))
3038 return false;
3039 }
3040 return false;
3041 }
3042
3043 static autoDaata tabSeparatedFileRecognizer (integer nread, const char *header, MelderFile file) {
3044 /*
3045 A table is recognized if it has at least one tab symbol,
3046 which must be before the first newline symbol (if any).
3047 */
3048 unsigned char *uheader = (unsigned char *) header;
3049 const bool isTabSeparated =
3050 uheader [0] == 0xef && uheader [1] == 0xff ? isTabSeparated_utf16be (nread, header) :
3051 uheader [0] == 0xff && uheader [1] == 0xef ? isTabSeparated_utf16le (nread, header) :
3052 isTabSeparated_8bit (nread, header)
3053 ;
3054 if (! isTabSeparated)
3055 return autoDaata ();
3056 return Table_readFromCharacterSeparatedTextFile (file, U'\t', false);
3057 }
3058
3059
3060 // MARK: - buttons
3061
3062 void praat_uvafon_init () {
3063 Thing_recognizeClassesByName (classPolygon, classParamCurve,
3064 classSpectrum, classLtas, classSpectrogram, classFormant,
3065 classExcitation, classCochleagram, classVocalTract,
3066 classLabel, classTier, classAutosegment, // three obsolete classes (pre-1997)
3067 classIntensity, classPitch, classHarmonicity,
3068 classTransition,
3069 classManipulation, classTextPoint, classTextInterval, classTextTier,
3070 classIntervalTier, classTextGrid, classWordList, classSpellingChecker,
3071 classCorpus
3072 );
3073 Thing_recognizeClassByOtherName (classManipulation, U"Psola"); // obsolete name (pre-1997)
3074 Thing_recognizeClassByOtherName (classManipulation, U"Analysis"); // obsolete name (pre-2001)
3075 Thing_recognizeClassByOtherName (classPitchTier, U"StylPitch"); // obsolete name (pre-1996)
3076
3077 Data_recognizeFileType (cgnSyntaxFileRecognizer);
3078 Data_recognizeFileType (chronologicalTextGridTextFileRecognizer);
3079 Data_recognizeFileType (IDXFormattedMatrixFileRecognizer);
3080
3081 structFunctionArea :: f_preferences ();
3082 structSpectrumArea :: f_preferences ();
3083 structPointArea :: f_preferences ();
3084 structRealTierArea :: f_preferences ();
3085 structPitchTierArea :: f_preferences ();
3086 structIntensityTierArea :: f_preferences ();
3087 structDurationTierArea :: f_preferences ();
3088 structAmplitudeTierArea :: f_preferences ();
3089 structFormantGridArea :: f_preferences ();
3090 structManipulationPitchTierArea :: f_preferences ();
3091
3092 structSpectrumEditor :: f_preferences ();
3093
3094 praat_addMenuCommand (U"Objects", U"Technical", U"Praat test...", nullptr, 0, INFO_Praat_test);
3095
3096 /*
3097 The user interfaces for the classes are included in the order
3098 in which they have to appear in the New menu:
3099 */
3100 praat_Sound_init ();
3101
3102 praat_addMenuCommand (U"Objects", U"New", U"-- new textgrid --",
3103 nullptr, 0, nullptr);
3104 praat_addMenuCommand (U"Objects", U"New", U"Create TextGrid...",
3105 nullptr, 0, NEW1_TextGrid_create);
3106 praat_uvafon_TextGrid_init ();
3107 praat_Tiers_init ();
3108 praat_addMenuCommand (U"Objects", U"New", U"Create Corpus...",
3109 nullptr, 0, NEW1_Corpus_create);
3110
3111 praat_addMenuCommand (U"Objects", U"New", U"-- new stats --",
3112 nullptr, 0, nullptr);
3113 INCLUDE_LIBRARY (praat_uvafon_stat_init) // from stat
3114 praat_addMenuCommand (U"Objects", U"New", U"Stats", nullptr, 0, nullptr);
3115 INCLUDE_LIBRARY (praat_MDS_new_init) // from dwtools
3116
3117 praat_addMenuCommand (U"Objects", U"New", U"Generics", nullptr, 0, nullptr);
3118 praat_Matrix_init ();
3119 praat_addMenuCommand (U"Objects", U"New", U"Polygon", nullptr, 1, nullptr);
3120 praat_addMenuCommand (U"Objects", U"New", U"Create Polygon from values...",
3121 nullptr, 2, NEW1_Polygon_createFromValues);
3122 praat_addMenuCommand (U"Objects", U"New", U"-- new strings --",
3123 nullptr, 1, nullptr);
3124 praat_addMenuCommand (U"Objects", U"New", U"Strings", nullptr, 1, nullptr);
3125 praat_addMenuCommand (U"Objects", U"New", U"Create Strings from texts...",
3126 nullptr, 2, NEW1_Strings_createFromTexts);
3127 praat_addMenuCommand (U"Objects", U"New", U"Create Strings as file list...",
3128 nullptr, 2, NEW1_Strings_createAsFileList);
3129 praat_addMenuCommand (U"Objects", U"New", U"Create Strings as folder list... || Create Strings as directory list...",
3130 nullptr, 2, NEW1_Strings_createAsFolderList);
3131 praat_addMenuCommand (U"Objects", U"New", U"-- new David generics --",
3132 nullptr, 1, nullptr);
3133 INCLUDE_LIBRARY (praat_David_generics_new_init)
3134
3135 praat_addMenuCommand (U"Objects", U"Open", U"Read Strings from raw text file...",
3136 nullptr, 0, READ_ONE__Strings_readFromRawTextFile);
3137
3138 praat_addMenuCommand (U"Objects", U"Open", U"-- read tier --", nullptr, 0, nullptr);
3139 praat_addMenuCommand (U"Objects", U"Open", U"Read from special annotation file...", nullptr, 0, nullptr);
3140 praat_addMenuCommand (U"Objects", U"Open", U"Read TextGrid from Xwaves... || Read TextGrid from ESPS label file...",
3141 nullptr, 1, READ_ONE__TextGrid_readFromEspsLabelFile);
3142 praat_addMenuCommand (U"Objects", U"Open", U"Read Sound with adjacent annotation files...", nullptr, 0, nullptr);
3143 praat_addMenuCommand (U"Objects", U"Open", U"Read Sound with adjacent annotation files (Buckeye)...",
3144 nullptr, 1, NEW_Sound_readWithAdjacentAnnotationFiles_buckeye);
3145 praat_addMenuCommand (U"Objects", U"Open", U"Read Sound with adjacent annotation files (TIMIT)...",
3146 nullptr, 1, NEW_Sound_readWithAdjacentAnnotationFiles_timit);
3147 praat_addMenuCommand (U"Objects", U"Open", U"Read Sound with adjacent annotation files (Corpus Gesproken Nederlands)...",
3148 nullptr, 1, NEW_Sound_readWithAdjacentAnnotationFiles_cgn);
3149 praat_addMenuCommand (U"Objects", U"Open", U"Open Corpus...", nullptr, 0, nullptr);
3150 praat_addMenuCommand (U"Objects", U"Open", U"Read Corpus from CGN...",
3151 nullptr, 1, NEW_Corpus_readFromCGN);
3152
3153 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Praat Intro", nullptr, '?', HELP_PraatIntro);
3154 #ifndef macintosh
3155 praat_addMenuCommand (U"Objects", U"Help", U"Objects window", nullptr, 0, HELP_ObjectWindow);
3156 #endif
3157 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Frequently asked questions",
3158 nullptr, 0, HELP_FrequentlyAskedQuestions);
3159 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"-- reference help --",
3160 nullptr, 0, nullptr);
3161 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Types of objects",
3162 nullptr, 0, HELP_TypesOfObjects);
3163 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Editors",
3164 nullptr, 0, HELP_Editors);
3165 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"-- version help --",
3166 nullptr, 0, nullptr);
3167 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"What’s new?",
3168 nullptr, 0, HELP_WhatsNew);
3169 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Acknowledgments",
3170 nullptr, 0, HELP_Acknowledgments);
3171 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"License",
3172 nullptr, 0, HELP_License);
3173 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"-- privacy help --",
3174 nullptr, 0, nullptr);
3175 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Privacy and security",
3176 nullptr, 0, HELP_PrivacyAndSecurity);
3177 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Checking for updates?",
3178 nullptr, 0, HELP_CheckingForUpdates);
3179 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Reporting a problem?",
3180 nullptr, 0, HELP_ReportingAProblem);
3181 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"-- shell help --",
3182 nullptr, 0, nullptr);
3183 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Formulas tutorial",
3184 nullptr, 0, HELP_FormulasTutorial);
3185 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Scripting tutorial",
3186 nullptr, 0, HELP_ScriptingTutorial);
3187 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Functions",
3188 nullptr, 0, HELP_Functions);
3189 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"-- control help --",
3190 nullptr, 0, nullptr);
3191 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Demo window",
3192 nullptr, 0, HELP_DemoWindow);
3193 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Interoperability",
3194 nullptr, 0, HELP_Interoperability);
3195 praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Programming",
3196 nullptr, 0, HELP_Programming);
3197 #ifdef macintosh
3198 praat_addMenuCommand (U"Objects", U"Help", U"Praat Intro",
3199 nullptr, '?', HELP_PraatIntro);
3200 praat_addMenuCommand (U"Objects", U"Help", U"Objects window help",
3201 nullptr, 0, HELP_ObjectWindow);
3202 praat_addMenuCommand (U"Objects", U"Help", U"-- manual --",
3203 nullptr, 0, nullptr);
3204 praat_addMenuCommand (U"Objects", U"Help", U"Search Praat manual...",
3205 nullptr, 'M', HELP_SearchManual_Fon);
3206 #endif
3207
3208 praat_addAction1 (classCochleagram, 0, U"Cochleagram help",
3209 nullptr, 0, HELP_Cochleagram_help);
3210 praat_addAction1 (classCochleagram, 1, U"Play movie || Movie",
3211 nullptr, 0, MOVIE_Cochleagram_playMovie);
3212 praat_addAction1 (classCochleagram, 0, U"Info", nullptr, 0, nullptr);
3213 praat_addAction1 (classCochleagram, 2, U"Difference...",
3214 nullptr, 0, REAL_Cochleagram_difference);
3215 praat_addAction1 (classCochleagram, 0, U"Draw", nullptr, 0, nullptr);
3216 praat_addAction1 (classCochleagram, 0, U"Paint...",
3217 nullptr, 0, GRAPHICS_Cochleagram_paint);
3218 praat_addAction1 (classCochleagram, 0, U"Modify", nullptr, 0, nullptr);
3219 praat_addAction1 (classCochleagram, 0, U"Formula...",
3220 nullptr, 0, MODIFY_Cochleagram_formula);
3221 praat_addAction1 (classCochleagram, 0, U"Analyse", nullptr, 0, nullptr);
3222 praat_addAction1 (classCochleagram, 0, U"To Excitation (slice)...",
3223 nullptr, 0, NEW_Cochleagram_to_Excitation);
3224 praat_addAction1 (classCochleagram, 0, U"Hack", nullptr, 0, nullptr);
3225 praat_addAction1 (classCochleagram, 0, U"To Matrix",
3226 nullptr, 0, NEW_Cochleagram_to_Matrix);
3227
3228 praat_addAction1 (classCorpus, 1, U"View & Edit", nullptr, GuiMenu_ATTRACTIVE, EDITOR_ONE_Corpus_edit);
3229
3230 praat_addAction1 (classDistributions, 0, U"Learn", nullptr, 0, nullptr);
3231 praat_addAction1 (classDistributions, 1, U"To Transition...",
3232 nullptr, 0, NEW_Distributions_to_Transition);
3233 praat_addAction1 (classDistributions, 2, U"To Transition (noise)...",
3234 nullptr, 0, NEW1_Distributions_to_Transition_noise);
3235
3236 praat_addAction1 (classExcitation, 0, U"Excitation help",
3237 nullptr, 0, HELP_Excitation_help);
3238 praat_addAction1 (classExcitation, 0, U"Draw", nullptr, 0, nullptr);
3239 praat_addAction1 (classExcitation, 0, U"Draw...",
3240 nullptr, 0, GRAPHICS_Excitation_draw);
3241 praat_addAction1 (classExcitation, 0, U"Analyse", nullptr, 0, nullptr);
3242 praat_addAction1 (classExcitation, 0, U"To Formant...",
3243 nullptr, 0, NEW_Excitation_to_Formant);
3244 praat_addAction1 (classExcitation, 1, U"Query -", nullptr, 0, nullptr);
3245 praat_addAction1 (classExcitation, 1, U"Get loudness",
3246 nullptr, 0, REAL_Excitation_getLoudness);
3247 praat_addAction1 (classExcitation, 0, U"Modify", nullptr, 0, nullptr);
3248 praat_addAction1 (classExcitation, 0, U"Formula...",
3249 nullptr, 0, MODIFY_Excitation_formula);
3250 praat_addAction1 (classExcitation, 0, U"Hack", nullptr, 0, nullptr);
3251 praat_addAction1 (classExcitation, 0, U"To Matrix",
3252 nullptr, 0, NEW_Excitation_to_Matrix);
3253
3254 praat_addAction1 (classFormant, 0, U"Formant help",
3255 nullptr, 0, HELP_Formant_help);
3256 praat_addAction1 (classFormant, 0, U"Draw -", nullptr, 0, nullptr);
3257 praat_addAction1 (classFormant, 0, U"Speckle...",
3258 nullptr, 1, GRAPHICS_Formant_drawSpeckles);
3259 praat_addAction1 (classFormant, 0, U"Draw tracks...",
3260 nullptr, 1, GRAPHICS_Formant_drawTracks);
3261 praat_addAction1 (classFormant, 0, U"Scatter plot...",
3262 nullptr, 1, GRAPHICS_Formant_scatterPlot);
3263 praat_addAction1 (classFormant, 0, U"Tabulate -", nullptr, 0, nullptr);
3264 praat_addAction1 (classFormant, 1, U"List...",
3265 nullptr, 1, LIST_Formant_list);
3266 praat_addAction1 (classFormant, 0, U"Down to Table...",
3267 nullptr, 1, NEW_Formant_downto_Table);
3268 praat_addAction1 (classFormant, 0, U"Query -", nullptr, 0, nullptr);
3269 praat_TimeFrameSampled_query_init (classFormant);
3270 praat_addAction1 (classFormant, 1, U"Get number of formants...",
3271 nullptr, 1, INTEGER_Formant_getNumberOfFormants);
3272 praat_addAction1 (classFormant, 1, U"Get minimum number of formants",
3273 nullptr, 1, INTEGER_Formant_getMinimumNumberOfFormants);
3274 praat_addAction1 (classFormant, 1, U"Get maximum number of formants",
3275 nullptr, 1, INTEGER_Formant_getMaximumNumberOfFormants);
3276 praat_addAction1 (classFormant, 1, U"-- get value --",
3277 nullptr, 1, nullptr);
3278 praat_addAction1 (classFormant, 1, U"Get value at time...",
3279 nullptr, 1, REAL_Formant_getValueAtTime);
3280 praat_addAction1 (classFormant, 1, U"Get bandwidth at time...",
3281 nullptr, 1, REAL_Formant_getBandwidthAtTime);
3282 praat_addAction1 (classFormant, 1, U"-- get extreme --",
3283 nullptr, 1, nullptr);
3284 praat_addAction1 (classFormant, 1, U"Get minimum...",
3285 nullptr, 1, REAL_Formant_getMinimum);
3286 praat_addAction1 (classFormant, 1, U"Get time of minimum...",
3287 nullptr, 1, REAL_Formant_getTimeOfMinimum);
3288 praat_addAction1 (classFormant, 1, U"Get maximum...",
3289 nullptr, 1, REAL_Formant_getMaximum);
3290 praat_addAction1 (classFormant, 1, U"Get time of maximum...",
3291 nullptr, 1, REAL_Formant_getTimeOfMaximum);
3292 praat_addAction1 (classFormant, 1, U"-- get distribution --",
3293 nullptr, 1, nullptr);
3294 praat_addAction1 (classFormant, 1, U"Get quantile...",
3295 nullptr, 1, REAL_Formant_getQuantile);
3296 praat_addAction1 (classFormant, 1, U"Get quantile of bandwidth...",
3297 nullptr, 1, REAL_Formant_getQuantileOfBandwidth);
3298 praat_addAction1 (classFormant, 1, U"Get mean...",
3299 nullptr, 1, REAL_Formant_getMean);
3300 praat_addAction1 (classFormant, 1, U"Get standard deviation...",
3301 nullptr, 1, REAL_Formant_getStandardDeviation);
3302 praat_addAction1 (classFormant, 0, U"Modify -", nullptr, 0, nullptr);
3303 praat_TimeFunction_modify_init (classFormant);
3304 praat_addAction1 (classFormant, 0, U"Sort",
3305 nullptr, 1, MODIFY_Formant_sort);
3306 praat_addAction1 (classFormant, 0, U"Formula (frequencies)...",
3307 nullptr, 1, MODIFY_Formant_formula_frequencies);
3308 praat_addAction1 (classFormant, 0, U"Formula (bandwidths)...",
3309 nullptr, 1, MODIFY_Formant_formula_bandwidths);
3310 praat_addAction1 (classFormant, 0, U"Convert", nullptr, 0, nullptr);
3311 praat_addAction1 (classFormant, 0, U"Track...",
3312 nullptr, 0, NEW_Formant_tracker);
3313 praat_addAction1 (classFormant, 0, U"Down to FormantTier",
3314 nullptr, GuiMenu_HIDDEN, NEW_Formant_downto_FormantTier);
3315 praat_addAction1 (classFormant, 0, U"Down to FormantGrid",
3316 nullptr, 0, NEW_Formant_downto_FormantGrid);
3317 praat_addAction1 (classFormant, 0, U"Hack", nullptr, 0, nullptr);
3318 praat_addAction1 (classFormant, 0, U"To Matrix...",
3319 nullptr, 0, NEW_Formant_to_Matrix);
3320
3321 praat_addAction1 (classHarmonicity, 0, U"Harmonicity help",
3322 nullptr, 0, HELP_Harmonicity_help);
3323 praat_addAction1 (classHarmonicity, 0, U"Draw", nullptr, 0, nullptr);
3324 praat_addAction1 (classHarmonicity, 0, U"Draw...",
3325 nullptr, 0, GRAPHICS_Harmonicity_draw);
3326 praat_addAction1 (classHarmonicity, 1, U"Query -", nullptr, 0, nullptr);
3327 praat_TimeFrameSampled_query_init (classHarmonicity);
3328 praat_addAction1 (classHarmonicity, 1, U"-- get content --",
3329 nullptr, 1, nullptr);
3330 praat_addAction1 (classHarmonicity, 1, U"Get value at time...",
3331 nullptr, 1, REAL_Harmonicity_getValueAtTime);
3332 praat_addAction1 (classHarmonicity, 1, U"Get value in frame...",
3333 nullptr, 1, REAL_Harmonicity_getValueInFrame);
3334 praat_addAction1 (classHarmonicity, 1, U"-- get extreme --",
3335 nullptr, 1, nullptr);
3336 praat_addAction1 (classHarmonicity, 1, U"Get minimum...",
3337 nullptr, 1, REAL_Harmonicity_getMinimum);
3338 praat_addAction1 (classHarmonicity, 1, U"Get time of minimum...",
3339 nullptr, 1, REAL_Harmonicity_getTimeOfMinimum);
3340 praat_addAction1 (classHarmonicity, 1, U"Get maximum...",
3341 nullptr, 1, REAL_Harmonicity_getMaximum);
3342 praat_addAction1 (classHarmonicity, 1, U"Get time of maximum...",
3343 nullptr, 1, REAL_Harmonicity_getTimeOfMaximum);
3344 praat_addAction1 (classHarmonicity, 1, U"-- get statistics --",
3345 nullptr, 1, nullptr);
3346 praat_addAction1 (classHarmonicity, 1, U"Get mean...",
3347 nullptr, 1, REAL_Harmonicity_getMean);
3348 praat_addAction1 (classHarmonicity, 1, U"Get standard deviation...",
3349 nullptr, 1, REAL_Harmonicity_getStandardDeviation);
3350 praat_addAction1 (classHarmonicity, 0, U"Modify", nullptr, 0, nullptr);
3351 praat_TimeFunction_modify_init (classHarmonicity);
3352 praat_addAction1 (classHarmonicity, 0, U"Formula...",
3353 nullptr, 0, MODIFY_Harmonicity_formula);
3354 praat_addAction1 (classHarmonicity, 0, U"Hack", nullptr, 0, nullptr);
3355 praat_addAction1 (classHarmonicity, 0, U"To Matrix",
3356 nullptr, 0, NEW_Harmonicity_to_Matrix);
3357
3358 praat_addAction1 (classIntensity, 0, U"Intensity help",
3359 nullptr, 0, HELP_Intensity_help);
3360 praat_addAction1 (classIntensity, 0, U"Draw...",
3361 nullptr, 0, GRAPHICS_Intensity_draw);
3362 praat_addAction1 (classIntensity, 1, U"Query -", nullptr, 0, nullptr);
3363 praat_TimeFrameSampled_query_init (classIntensity);
3364 praat_addAction1 (classIntensity, 1, U"-- get content --",
3365 nullptr, 1, nullptr);
3366 praat_addAction1 (classIntensity, 1, U"Get value at time...",
3367 nullptr, 1, REAL_Intensity_getValueAtTime);
3368 praat_addAction1 (classIntensity, 1, U"Get value in frame...",
3369 nullptr, 1, REAL_Intensity_getValueInFrame);
3370 praat_addAction1 (classIntensity, 1, U"-- get extreme --",
3371 nullptr, 1, nullptr);
3372 praat_addAction1 (classIntensity, 1, U"Get minimum...",
3373 nullptr, 1, REAL_Intensity_getMinimum);
3374 praat_addAction1 (classIntensity, 1, U"Get time of minimum...",
3375 nullptr, 1, REAL_Intensity_getTimeOfMinimum);
3376 praat_addAction1 (classIntensity, 1, U"Get maximum...",
3377 nullptr, 1, REAL_Intensity_getMaximum);
3378 praat_addAction1 (classIntensity, 1, U"Get time of maximum...",
3379 nullptr, 1, REAL_Intensity_getTimeOfMaximum);
3380 praat_addAction1 (classIntensity, 1, U"-- get statistics --",
3381 nullptr, 1, nullptr);
3382 praat_addAction1 (classIntensity, 1, U"Get quantile...",
3383 nullptr, 1, REAL_Intensity_getQuantile);
3384 praat_addAction1 (classIntensity, 1, U"Get mean...",
3385 nullptr, 1, REAL_Intensity_getMean);
3386 praat_addAction1 (classIntensity, 1, U"Get standard deviation...",
3387 nullptr, 1, REAL_Intensity_getStandardDeviation);
3388 praat_addAction1 (classIntensity, 0, U"Modify -", nullptr, 0, nullptr);
3389 praat_TimeFunction_modify_init (classIntensity);
3390 praat_addAction1 (classIntensity, 0, U"Formula...",
3391 nullptr, 1, MODIFY_Intensity_formula);
3392 praat_addAction1 (classIntensity, 0, U"Analyse", nullptr, 0, nullptr);
3393 praat_addAction1 (classIntensity, 0, U"To IntensityTier (peaks)",
3394 nullptr, 0, NEW_Intensity_to_IntensityTier_peaks);
3395 praat_addAction1 (classIntensity, 0, U"To IntensityTier (valleys)",
3396 nullptr, 0, NEW_Intensity_to_IntensityTier_valleys);
3397 praat_addAction1 (classIntensity, 0, U"Convert", nullptr, 0, nullptr);
3398 praat_addAction1 (classIntensity, 0, U"Down to IntensityTier",
3399 nullptr, 0, NEW_Intensity_downto_IntensityTier);
3400 praat_addAction1 (classIntensity, 0, U"Down to Matrix",
3401 nullptr, 0, NEW_Intensity_downto_Matrix);
3402
3403 praat_addAction1 (classLtas, 0, U"Ltas help",
3404 nullptr, 0, HELP_Ltas_help);
3405 praat_addAction1 (classLtas, 0, U"Draw...",
3406 nullptr, 0, GRAPHICS_Ltas_draw);
3407 praat_addAction1 (classLtas, 1, U"Query -", nullptr, 0, nullptr);
3408 praat_addAction1 (classLtas, 1, U"Frequency domain", nullptr, 1, nullptr);
3409 praat_addAction1 (classLtas, 1, U"Get lowest frequency",
3410 nullptr, 2, REAL_Ltas_getLowestFrequency);
3411 praat_addAction1 (classLtas, 1, U"Get highest frequency",
3412 nullptr, 2, REAL_Ltas_getHighestFrequency);
3413 praat_addAction1 (classLtas, 1, U"Frequency sampling", nullptr, 1, nullptr);
3414 praat_addAction1 (classLtas, 1, U"Get number of bins || Get number of bands",
3415 nullptr, 2, INTEGER_Ltas_getNumberOfBins); // alternative GuiMenu_DEPRECATED_2004
3416 praat_addAction1 (classLtas, 1, U"Get bin width || Get band width",
3417 nullptr, 2, REAL_Ltas_getBinWidth);
3418 praat_addAction1 (classLtas, 1, U"Get frequency from bin number... || Get frequency from band...",
3419 nullptr, 2, REAL_Ltas_getFrequencyFromBinNumber);
3420 praat_addAction1 (classLtas, 1, U"Get bin number from frequency... || Get band from frequency...",
3421 nullptr, 2, REAL_Ltas_getBinNumberFromFrequency);
3422 praat_addAction1 (classLtas, 1, U"-- get content --",
3423 nullptr, 1, nullptr);
3424 praat_addAction1 (classLtas, 1, U"Get value at frequency...",
3425 nullptr, 1, REAL_Ltas_getValueAtFrequency);
3426 praat_addAction1 (classLtas, 1, U"Get value in bin... || Get value in band...",
3427 nullptr, 1, REAL_Ltas_getValueInBin);
3428 praat_addAction1 (classLtas, 1, U"-- get extreme --",
3429 nullptr, 1, nullptr);
3430 praat_addAction1 (classLtas, 1, U"Get minimum...",
3431 nullptr, 1, REAL_Ltas_getMinimum);
3432 praat_addAction1 (classLtas, 1, U"Get frequency of minimum...",
3433 nullptr, 1, REAL_Ltas_getFrequencyOfMinimum);
3434 praat_addAction1 (classLtas, 1, U"Get maximum...",
3435 nullptr, 1, REAL_Ltas_getMaximum);
3436 praat_addAction1 (classLtas, 1, U"Get frequency of maximum...",
3437 nullptr, 1, REAL_Ltas_getFrequencyOfMaximum);
3438 praat_addAction1 (classLtas, 1, U"-- get statistics --",
3439 nullptr, 1, nullptr);
3440 praat_addAction1 (classLtas, 1, U"Get mean...",
3441 nullptr, 1, REAL_Ltas_getMean);
3442 praat_addAction1 (classLtas, 1, U"Get slope...",
3443 nullptr, 1, REAL_Ltas_getSlope);
3444 praat_addAction1 (classLtas, 1, U"Get local peak height...",
3445 nullptr, 1, REAL_Ltas_getLocalPeakHeight);
3446 praat_addAction1 (classLtas, 1, U"Get standard deviation...",
3447 nullptr, 1, REAL_Ltas_getStandardDeviation);
3448 praat_addAction1 (classLtas, 0, U"Modify", nullptr, 0, nullptr);
3449 praat_addAction1 (classLtas, 0, U"Formula...",
3450 nullptr, 0, MODIFY_Ltas_formula);
3451 praat_addAction1 (classLtas, 0, U"Analyse", nullptr, 0, nullptr);
3452 praat_addAction1 (classLtas, 0, U"To SpectrumTier (peaks)",
3453 nullptr, 0, NEW_Ltas_to_SpectrumTier_peaks);
3454 praat_addAction1 (classLtas, 0, U"Convert", nullptr, 0, nullptr);
3455 praat_addAction1 (classLtas, 0, U"Compute trend line...",
3456 nullptr, 0, NEW_Ltas_computeTrendLine);
3457 praat_addAction1 (classLtas, 0, U"Subtract trend line...",
3458 nullptr, 0, NEW_Ltas_subtractTrendLine);
3459 praat_addAction1 (classLtas, 0, U"Combine", nullptr, 0, nullptr);
3460 praat_addAction1 (classLtas, 0, U"Merge",
3461 nullptr, GuiMenu_DEPRECATED_2005, NEW1_Ltases_merge);
3462 praat_addAction1 (classLtas, 0, U"Average",
3463 nullptr, 0, NEW1_Ltases_average);
3464 praat_addAction1 (classLtas, 0, U"Hack", nullptr, 0, nullptr);
3465 praat_addAction1 (classLtas, 0, U"To Matrix",
3466 nullptr, 0, NEW_Ltas_to_Matrix);
3467
3468 praat_addAction1 (classManipulation, 0, U"Manipulation help",
3469 nullptr, 0, HELP_Manipulation_help);
3470 praat_addAction1 (classManipulation, 1, U"View & Edit || Edit",
3471 nullptr, GuiMenu_ATTRACTIVE, EDITOR_ONE_Manipulation_viewAndEdit);
3472 praat_addAction1 (classManipulation, 0, U"Play (overlap-add) || Play (PSOLA)",
3473 nullptr, 0, PLAY_Manipulation_play_overlapAdd); // alternative GuiMenu_DEPRECATED_2007
3474 praat_addAction1 (classManipulation, 0, U"Play (LPC)",
3475 nullptr, 0, PLAY_Manipulation_play_lpc);
3476 praat_addAction1 (classManipulation, 0, U"Get resynthesis (overlap-add) || Get resynthesis (PSOLA)",
3477 nullptr, 0, NEW_Manipulation_getResynthesis_overlapAdd);
3478 praat_addAction1 (classManipulation, 0, U"Get resynthesis (LPC)",
3479 nullptr, 0, NEW_Manipulation_getResynthesis_lpc);
3480 praat_addAction1 (classManipulation, 0, U"Extract original sound",
3481 nullptr, 0, NEW_Manipulation_extractOriginalSound);
3482 praat_addAction1 (classManipulation, 0, U"Extract pulses",
3483 nullptr, 0, NEW_Manipulation_extractPulses);
3484 praat_addAction1 (classManipulation, 0, U"Extract pitch tier",
3485 nullptr, 0, NEW_Manipulation_extractPitchTier);
3486 praat_addAction1 (classManipulation, 0, U"Extract duration tier",
3487 nullptr, 0, NEW_Manipulation_extractDurationTier);
3488 praat_addAction1 (classManipulation, 0, U"Modify -", nullptr, 0, nullptr);
3489 praat_TimeFunction_modify_init (classManipulation);
3490 praat_addAction1 (classManipulation, 0, U"Replace pitch tier?",
3491 nullptr, 1, HELP_Manipulation_replacePitchTier_help);
3492 praat_addAction1 (classManipulation, 0, U"Replace duration tier?",
3493 nullptr, 1, HELP_Manipulation_replaceDurationTier_help);
3494 praat_addAction1 (classManipulation, 1, U"Save as text file without Sound... || Write to text file without Sound...",
3495 nullptr, 0, SAVE_Manipulation_writeToTextFileWithoutSound);
3496 praat_addAction1 (classManipulation, 1, U"Save as binary file without Sound... || Write to binary file without Sound...",
3497 nullptr, 0, SAVE_Manipulation_writeToBinaryFileWithoutSound);
3498
3499 praat_addAction1 (classParamCurve, 0, U"ParamCurve help",
3500 nullptr, 0, HELP_ParamCurve_help);
3501 praat_addAction1 (classParamCurve, 0, U"Draw", nullptr, 0, nullptr);
3502 praat_addAction1 (classParamCurve, 0, U"Draw...",
3503 nullptr, 0, GRAPHICS_ParamCurve_draw);
3504
3505 praat_addAction1 (classPitch, 0, U"Pitch help",
3506 nullptr, 0, HELP_Pitch_help);
3507 praat_addAction1 (classPitch, 1, U"View & Edit || Edit",
3508 nullptr, GuiMenu_ATTRACTIVE, EDITOR_ONE_Pitch_viewAndEdit);
3509 praat_addAction1 (classPitch, 0, U"Sound -", nullptr, 0, nullptr);
3510 praat_addAction1 (classPitch, 0, U"Play pulses",
3511 nullptr, 1, PLAY_Pitch_play);
3512 praat_addAction1 (classPitch, 0, U"Hum",
3513 nullptr, 1, PLAY_Pitch_hum);
3514 praat_addAction1 (classPitch, 0, U"-- to sound --",
3515 nullptr, 1, nullptr);
3516 praat_addAction1 (classPitch, 0, U"To Sound (pulses)",
3517 nullptr, 1, NEW_Pitch_to_Sound_pulses);
3518 praat_addAction1 (classPitch, 0, U"To Sound (hum)",
3519 nullptr, 1, NEW_Pitch_to_Sound_hum);
3520 praat_addAction1 (classPitch, 0, U"To Sound (sine)...",
3521 nullptr, 1, NEW_Pitch_to_Sound_sine);
3522 praat_addAction1 (classPitch, 0, U"Draw -", nullptr, 0, nullptr);
3523 praat_addAction1 (classPitch, 0, U"Draw...",
3524 nullptr, 1, GRAPHICS_Pitch_draw);
3525 praat_addAction1 (classPitch, 0, U"Draw logarithmic...",
3526 nullptr, 1, GRAPHICS_Pitch_drawLogarithmic);
3527 praat_addAction1 (classPitch, 0, U"Draw semitones (re 100 Hz)... || Draw semitones...",
3528 nullptr, 1, GRAPHICS_Pitch_drawSemitones100); // alternativeGuiMenu_DEPRECATED_2012
3529 praat_addAction1 (classPitch, 0, U"Draw semitones (re 200 Hz)...",
3530 nullptr, 1, GRAPHICS_Pitch_drawSemitones200);
3531 praat_addAction1 (classPitch, 0, U"Draw semitones (re 440 Hz)...",
3532 nullptr, 1, GRAPHICS_Pitch_drawSemitones440);
3533 praat_addAction1 (classPitch, 0, U"Draw mel...",
3534 nullptr, 1, GRAPHICS_Pitch_drawMel);
3535 praat_addAction1 (classPitch, 0, U"Draw erb...",
3536 nullptr, 1, GRAPHICS_Pitch_drawErb);
3537 praat_addAction1 (classPitch, 0, U"Speckle...",
3538 nullptr, 1, GRAPHICS_Pitch_speckle);
3539 praat_addAction1 (classPitch, 0, U"Speckle logarithmic...",
3540 nullptr, 1, GRAPHICS_Pitch_speckleLogarithmic);
3541 praat_addAction1 (classPitch, 0, U"Speckle semitones (re 100 Hz)... || Speckle semitones...",
3542 nullptr, 1, GRAPHICS_Pitch_speckleSemitones100);
3543 praat_addAction1 (classPitch, 0, U"Speckle semitones (re 200 Hz)...",
3544 nullptr, 1, GRAPHICS_Pitch_speckleSemitones200);
3545 praat_addAction1 (classPitch, 0, U"Speckle semitones (re 440 Hz)...",
3546 nullptr, 1, GRAPHICS_Pitch_speckleSemitones440);
3547 praat_addAction1 (classPitch, 0, U"Speckle mel...",
3548 nullptr, 1, GRAPHICS_Pitch_speckleMel);
3549 praat_addAction1 (classPitch, 0, U"Speckle erb...",
3550 nullptr, 1, GRAPHICS_Pitch_speckleErb);
3551 praat_addAction1 (classPitch, 0, U"Query -", nullptr, 0, nullptr);
3552 praat_TimeFrameSampled_query_init (classPitch);
3553 praat_addAction1 (classPitch, 1, U"-- get content --",
3554 nullptr, 1, nullptr);
3555 praat_addAction1 (classPitch, 1, U"Count voiced frames",
3556 nullptr, 1, INTEGER_Pitch_getNumberOfVoicedFrames);
3557 praat_addAction1 (classPitch, 1, U"Get value at time...",
3558 nullptr, 1, REAL_Pitch_getValueAtTime);
3559 praat_addAction1 (classPitch, 1, U"List values at times...",
3560 nullptr, 1, NUMVEC_Pitch_listValuesAtTimes);
3561 praat_addAction1 (classPitch, 1, U"Get value in frame...",
3562 nullptr, 1, REAL_Pitch_getValueInFrame);
3563 praat_addAction1 (classPitch, 1, U"List values in all frames...",
3564 nullptr, 1, NUMVEC_Pitch_listValuesInAllFrames);
3565 praat_addAction1 (classPitch, 1, U"-- get extreme --",
3566 nullptr, 1, nullptr);
3567 praat_addAction1 (classPitch, 1, U"Get minimum...",
3568 nullptr, 1, REAL_Pitch_getMinimum);
3569 praat_addAction1 (classPitch, 1, U"Get time of minimum...",
3570 nullptr, 1, REAL_Pitch_getTimeOfMinimum);
3571 praat_addAction1 (classPitch, 1, U"Get maximum...",
3572 nullptr, 1, REAL_Pitch_getMaximum);
3573 praat_addAction1 (classPitch, 1, U"Get time of maximum...",
3574 nullptr, 1, REAL_Pitch_getTimeOfMaximum);
3575 praat_addAction1 (classPitch, 1, U"-- get statistics --",
3576 nullptr, 1, nullptr);
3577 praat_addAction1 (classPitch, 1, U"Get quantile...",
3578 nullptr, 1, REAL_Pitch_getQuantile);
3579 /*praat_addAction1 (classPitch, 1, U"Get spreading...",
3580 nullptr, 1, REAL_Pitch_getSpreading);*/
3581 praat_addAction1 (classPitch, 1, U"Get mean...",
3582 nullptr, 1, REAL_Pitch_getMean);
3583 praat_addAction1 (classPitch, 1, U"Get standard deviation...",
3584 nullptr, 1, REAL_Pitch_getStandardDeviation);
3585 praat_addAction1 (classPitch, 1, U"-- get slope --",
3586 nullptr, 1, nullptr);
3587 praat_addAction1 (classPitch, 1, U"Get mean absolute slope...",
3588 nullptr, 1, REAL_Pitch_getMeanAbsoluteSlope);
3589 praat_addAction1 (classPitch, 1, U"Get slope without octave jumps",
3590 nullptr, 1, REAL_Pitch_getMeanAbsSlope_noOctave);
3591 praat_addAction1 (classPitch, 2, U"-- query two --",
3592 nullptr, 1, nullptr);
3593 praat_addAction1 (classPitch, 2, U"Count differences",
3594 nullptr, 1, INFO_Pitch_difference);
3595 praat_addAction1 (classPitch, 2, U"-- hack --",
3596 nullptr, 1, nullptr);
3597 praat_addAction1 (classPitch, 1, U"Internal", nullptr, 1, nullptr);
3598 praat_addAction1 (classPitch, 0, U"Tabulate candidates",
3599 nullptr, 2, NEW_Pitch_tabulateCandidates);
3600 praat_addAction1 (classPitch, 0, U"Tabulate candidates in frame...",
3601 nullptr, 2, NEW_Pitch_tabulateCandidatesInFrame);
3602 praat_addAction1 (classPitch, 1, U"Get all candidates in frame...",
3603 nullptr, 2, NUMMAT_Pitch_getAllCandidatesInFrame);
3604 praat_addAction1 (classPitch, 0, U"Modify -", nullptr, 0, nullptr);
3605 praat_TimeFunction_modify_init (classPitch);
3606 praat_addAction1 (classPitch, 0, U"Formula...",
3607 nullptr, 1, MODIFY_Pitch_formula);
3608 praat_addAction1 (classPitch, 0, U"Annotate -", nullptr, 0, nullptr);
3609 praat_addAction1 (classPitch, 0, U"To TextGrid...",
3610 nullptr, 1, NEW_Pitch_to_TextGrid);
3611 praat_addAction1 (classPitch, 0, U"-- to single tier --",
3612 nullptr, GuiMenu_HIDDEN + GuiMenu_DEPTH_1, nullptr);
3613 praat_addAction1 (classPitch, 0, U"To TextTier",
3614 nullptr, GuiMenu_HIDDEN | GuiMenu_DEPTH_1, NEW_Pitch_to_TextTier);
3615 praat_addAction1 (classPitch, 0, U"To IntervalTier",
3616 nullptr, GuiMenu_HIDDEN | GuiMenu_DEPTH_1, NEW_Pitch_to_IntervalTier);
3617 praat_addAction1 (classPitch, 0, U"Analyse -", nullptr, 0, nullptr);
3618 praat_addAction1 (classPitch, 0, U"To PointProcess",
3619 nullptr, 1, NEW_Pitch_to_PointProcess);
3620 praat_addAction1 (classPitch, 0, U"Convert -", nullptr, 0, nullptr);
3621 praat_addAction1 (classPitch, 0, U"Interpolate",
3622 nullptr, 1, NEW_Pitch_interpolate);
3623 praat_addAction1 (classPitch, 0, U"Smooth...",
3624 nullptr, 1, NEW_Pitch_smooth);
3625 praat_addAction1 (classPitch, 0, U"Subtract linear fit...",
3626 nullptr, 1, NEW_Pitch_subtractLinearFit);
3627 praat_addAction1 (classPitch, 0, U"Hack", nullptr, 1, nullptr);
3628 praat_addAction1 (classPitch, 0, U"Kill octave jumps",
3629 nullptr, 2, NEW_Pitch_killOctaveJumps);
3630 praat_addAction1 (classPitch, 0, U"-- to other types --",
3631 nullptr, 1, nullptr);
3632 praat_addAction1 (classPitch, 0, U"Down to PitchTier",
3633 nullptr, 1, NEW_Pitch_downto_PitchTier);
3634 praat_addAction1 (classPitch, 0, U"To Matrix",
3635 nullptr, 1, NEW_Pitch_to_Matrix);
3636
3637 praat_addAction1 (classPolygon, 0, U"Polygon help",
3638 nullptr, 0, HELP_Polygon_help);
3639 praat_addAction1 (classPolygon, 0, U"Draw -", nullptr, 0, nullptr);
3640 praat_addAction1 (classPolygon, 0, U"Draw...",
3641 nullptr, 1, GRAPHICS_Polygon_draw);
3642 praat_addAction1 (classPolygon, 0, U"Draw closed...",
3643 nullptr, 1, GRAPHICS_Polygon_drawClosed);
3644 praat_addAction1 (classPolygon, 0, U"Paint...",
3645 nullptr, 1, GRAPHICS_Polygon_paint);
3646 praat_addAction1 (classPolygon, 0, U"Draw circles...",
3647 nullptr, 1, GRAPHICS_Polygon_drawCircles);
3648 praat_addAction1 (classPolygon, 0, U"Paint circles...",
3649 nullptr, 1, GRAPHICS_Polygon_paintCircles);
3650 praat_addAction1 (classPolygon, 2, U"Draw connection...",
3651 nullptr, 1, GRAPHICS_Polygons_drawConnection);
3652 praat_addAction1 (classPolygon, 0, U"Modify -", nullptr, 0, nullptr);
3653 praat_addAction1 (classPolygon, 0, U"Randomize",
3654 nullptr, 1, MODIFY_Polygon_randomize);
3655 praat_addAction1 (classPolygon, 0, U"Salesperson...",
3656 nullptr, 1, MODIFY_Polygon_salesperson);
3657 praat_addAction1 (classPolygon, 0, U"Hack -", nullptr, 0, nullptr);
3658 praat_addAction1 (classPolygon, 0, U"To Matrix", nullptr, 1, NEW_Polygon_to_Matrix);
3659
3660 praat_addAction1 (classSpectrogram, 0, U"Spectrogram help",
3661 nullptr, 0, HELP_Spectrogram_help);
3662 praat_addAction1 (classSpectrogram, 1, U"View",
3663 nullptr, 0, EDITOR_ONE_Spectrogram_view);
3664 praat_addAction1 (classSpectrogram, 1, U"Play movie || Movie",
3665 nullptr, 0, MOVIE_Spectrogram_playMovie);
3666 praat_addAction1 (classSpectrogram, 0, U"Query -", nullptr, 0, nullptr);
3667 praat_TimeFrameSampled_query_init (classSpectrogram);
3668 praat_addAction1 (classSpectrogram, 1, U"Get power at...",
3669 nullptr, 1, REAL_Spectrogram_getPowerAt);
3670 praat_addAction1 (classSpectrogram, 0, U"Draw -", nullptr, 0, nullptr);
3671 praat_addAction1 (classSpectrogram, 0, U"Paint...",
3672 nullptr, 1, GRAPHICS_Spectrogram_paint);
3673 praat_addAction1 (classSpectrogram, 0, U"Analyse -", nullptr, 0, nullptr);
3674 praat_addAction1 (classSpectrogram, 0, U"To Spectrum (slice)...",
3675 nullptr, 1, NEW_Spectrogram_to_Spectrum);
3676 praat_addAction1 (classSpectrogram, 0, U"Synthesize -", nullptr, 0, nullptr);
3677 praat_addAction1 (classSpectrogram, 0, U"To Sound...",
3678 nullptr, 1, NEW_Spectrogram_to_Sound);
3679 praat_addAction1 (classSpectrogram, 0, U"Modify -", nullptr, 0, nullptr);
3680 praat_TimeFunction_modify_init (classSpectrogram);
3681 praat_addAction1 (classSpectrogram, 0, U"Formula...",
3682 nullptr, 1, MODIFY_Spectrogram_formula);
3683 praat_addAction1 (classSpectrogram, 0, U"Hack -", nullptr, 0, nullptr);
3684 praat_addAction1 (classSpectrogram, 0, U"To Matrix",
3685 nullptr, 1, NEW_Spectrogram_to_Matrix);
3686
3687 praat_addAction1 (classSpectrum, 0, U"Spectrum help",
3688 nullptr, 0, HELP_Spectrum_help);
3689 praat_addAction1 (classSpectrum, 1, U"View & Edit || Edit",
3690 nullptr, GuiMenu_ATTRACTIVE, EDITOR_ONE_Spectrum_viewAndEdit);
3691 praat_addAction1 (classSpectrum, 0, U"Sound -", nullptr, 0, nullptr);
3692 praat_addAction1 (classSpectrum, 0, U"To Sound || To Sound (fft)",
3693 nullptr, 1, NEW_Spectrum_to_Sound); // alternative GuiMenu_DEPRECATED_2004
3694 praat_addAction1 (classSpectrum, 0, U"Draw -", nullptr, 0, nullptr);
3695 praat_addAction1 (classSpectrum, 0, U"Draw...",
3696 nullptr, 1, GRAPHICS_Spectrum_draw);
3697 praat_addAction1 (classSpectrum, 0, U"Draw (log freq)...",
3698 nullptr, 1, GRAPHICS_Spectrum_drawLogFreq);
3699 praat_addAction1 (classSpectrum, 0, U"Tabulate -", nullptr, 0, nullptr);
3700 praat_addAction1 (classSpectrum, 1, U"Tabulate...",
3701 nullptr, 1, NEW_Spectrum_tabulate);
3702 praat_addAction1 (classSpectrum, 1, U"Tabulate (verbose)",
3703 nullptr, 1, NEW_Spectrum_tabulate_verbose);
3704 praat_addAction1 (classSpectrum, 1, U"Query -", nullptr, 0, nullptr);
3705 praat_addAction1 (classSpectrum, 1, U"Frequency domain", nullptr, 1, nullptr);
3706 praat_addAction1 (classSpectrum, 1, U"Get lowest frequency",
3707 nullptr, 2, REAL_Spectrum_getLowestFrequency);
3708 praat_addAction1 (classSpectrum, 1, U"Get highest frequency",
3709 nullptr, 2, REAL_Spectrum_getHighestFrequency);
3710 praat_addAction1 (classSpectrum, 1, U"Frequency sampling", nullptr, 1, nullptr);
3711 praat_addAction1 (classSpectrum, 1, U"Get number of bins",
3712 nullptr, 2, INTEGER_Spectrum_getNumberOfBins);
3713 praat_addAction1 (classSpectrum, 1, U"Get bin width",
3714 nullptr, 2, REAL_Spectrum_getBinWidth);
3715 praat_addAction1 (classSpectrum, 1, U"Get frequency from bin number... || Get frequency from bin...",
3716 nullptr, 2, REAL_Spectrum_getFrequencyFromBin); // alternative GuiMenu_DEPRECATED_2004
3717 praat_addAction1 (classSpectrum, 1, U"Get bin number from frequency... || Get bin from frequency...",
3718 nullptr, 2, REAL_Spectrum_getBinNumberFromFrequency);
3719 praat_addAction1 (classSpectrum, 1, U"-- get content --",
3720 nullptr, 1, nullptr);
3721 praat_addAction1 (classSpectrum, 1, U"Get real value in bin...",
3722 nullptr, 1, REAL_Spectrum_getRealValueInBin);
3723 praat_addAction1 (classSpectrum, 1, U"Get imaginary value in bin...",
3724 nullptr, 1, REAL_Spectrum_getImaginaryValueInBin);
3725 praat_addAction1 (classSpectrum, 1, U"-- get energy --",
3726 nullptr, 1, nullptr);
3727 praat_addAction1 (classSpectrum, 1, U"Get band energy...",
3728 nullptr, 1, REAL_Spectrum_getBandEnergy);
3729 praat_addAction1 (classSpectrum, 1, U"Get band density...",
3730 nullptr, 1, REAL_Spectrum_getBandDensity);
3731 praat_addAction1 (classSpectrum, 1, U"Get band energy difference...",
3732 nullptr, 1, REAL_Spectrum_getBandEnergyDifference);
3733 praat_addAction1 (classSpectrum, 1, U"Get band density difference...",
3734 nullptr, 1, REAL_Spectrum_getBandDensityDifference);
3735 praat_addAction1 (classSpectrum, 1, U"-- get moments --",
3736 nullptr, 1, nullptr);
3737 praat_addAction1 (classSpectrum, 1, U"Get centre of gravity...",
3738 nullptr, 1, REAL_Spectrum_getCentreOfGravity);
3739 praat_addAction1 (classSpectrum, 1, U"Get standard deviation...",
3740 nullptr, 1, REAL_Spectrum_getStandardDeviation);
3741 praat_addAction1 (classSpectrum, 1, U"Get skewness...",
3742 nullptr, 1, REAL_Spectrum_getSkewness);
3743 praat_addAction1 (classSpectrum, 1, U"Get kurtosis...",
3744 nullptr, 1, REAL_Spectrum_getKurtosis);
3745 praat_addAction1 (classSpectrum, 1, U"Get central moment...",
3746 nullptr, 1, REAL_Spectrum_getCentralMoment);
3747 praat_addAction1 (classSpectrum, 1, U"-- search --",
3748 nullptr, 1, nullptr);
3749 praat_addAction1 (classSpectrum, 1, U"Get frequency of nearest maximum...",
3750 nullptr, 1, REAL_Spectrum_getFrequencyOfNearestMaximum);
3751 praat_addAction1 (classSpectrum, 1, U"Get sound pressure level of nearest maximum...",
3752 nullptr, 1, REAL_Spectrum_getSoundPressureLevelOfNearestMaximum);
3753 praat_addAction1 (classSpectrum, 0, U"Modify -", nullptr, 0, nullptr);
3754 praat_addAction1 (classSpectrum, 0, U"Formula...",
3755 nullptr, 1, MODIFY_Spectrum_formula);
3756 praat_addAction1 (classSpectrum, 0, U"Filter (pass Hann band)...",
3757 nullptr, 1, MODIFY_Spectrum_passHannBand);
3758 praat_addAction1 (classSpectrum, 0, U"Filter (stop Hann band)...",
3759 nullptr, 1, MODIFY_Spectrum_stopHannBand);
3760 praat_addAction1 (classSpectrum, 0, U"Analyse -", nullptr, 0, nullptr);
3761 praat_addAction1 (classSpectrum, 0, U"To Excitation...",
3762 nullptr, 1, NEW_Spectrum_to_Excitation);
3763 praat_addAction1 (classSpectrum, 0, U"To SpectrumTier (peaks)",
3764 nullptr, 1, NEW_Spectrum_to_SpectrumTier_peaks);
3765 praat_addAction1 (classSpectrum, 0, U"To Formant (peaks)...",
3766 nullptr, 1, NEW_Spectrum_to_Formant_peaks);
3767 praat_addAction1 (classSpectrum, 0, U"To Ltas...",
3768 nullptr, 1, NEW_Spectrum_to_Ltas);
3769 praat_addAction1 (classSpectrum, 0, U"To Ltas (1-to-1)",
3770 nullptr, 1, NEW_Spectrum_to_Ltas_1to1);
3771 praat_addAction1 (classSpectrum, 0, U"To Spectrogram",
3772 nullptr, 1, NEW_Spectrum_to_Spectrogram);
3773 praat_addAction1 (classSpectrum, 0, U"Convert -", nullptr, 0, nullptr);
3774 praat_addAction1 (classSpectrum, 0, U"Cepstral smoothing...",
3775 nullptr, 1, NEW_Spectrum_cepstralSmoothing);
3776 praat_addAction1 (classSpectrum, 0, U"LPC smoothing...",
3777 nullptr, 1, NEW_Spectrum_lpcSmoothing);
3778 praat_addAction1 (classSpectrum, 0, U"Hack", nullptr, 1, nullptr);
3779 praat_addAction1 (classSpectrum, 0, U"To Matrix",
3780 nullptr, 2, NEW_Spectrum_to_Matrix);
3781
3782 praat_addAction1 (classStrings, 0, U"Strings help", nullptr, 0, HELP_Strings_help);
3783 praat_addAction1 (classStrings, 1, U"Save as raw text file... || Write to raw text file...",
3784 nullptr, 0, SAVE_Strings_writeToRawTextFile);
3785 praat_addAction1 (classStrings, 1, U"View & Edit || Edit",
3786 nullptr, GuiMenu_ATTRACTIVE, EDITOR_ONE_Strings_viewAndEdit);
3787 praat_addAction1 (classStrings, 0, U"Query -", nullptr, 0, nullptr);
3788 praat_addAction1 (classStrings, 2, U"Equal?",
3789 nullptr, 1, BOOLEAN_Strings_equal);
3790 praat_addAction1 (classStrings, 1, U"Get number of strings",
3791 nullptr, 1, INTEGER_Strings_getNumberOfStrings);
3792 praat_addAction1 (classStrings, 1, U"Get string...",
3793 nullptr, 1, STRING_Strings_getString);
3794 praat_addAction1 (classStrings, 1, U"List all strings",
3795 nullptr, 1, STRVEC_Strings_listAllStrings);
3796 praat_addAction1 (classStrings, 0, U"Modify -", nullptr, 0, nullptr);
3797 praat_addAction1 (classStrings, 0, U"Set string...",
3798 nullptr, 1, MODIFY_Strings_setString);
3799 praat_addAction1 (classStrings, 0, U"Insert string...",
3800 nullptr, 1, MODIFY_Strings_insertString);
3801 praat_addAction1 (classStrings, 0, U"Remove string...",
3802 nullptr, 1, MODIFY_Strings_removeString);
3803 praat_addAction1 (classStrings, 0, U"-- modify order --",
3804 nullptr, 1, nullptr);
3805 praat_addAction1 (classStrings, 0, U"Randomize",
3806 nullptr, 1, MODIFY_Strings_randomize);
3807 praat_addAction1 (classStrings, 0, U"Sort",
3808 nullptr, 1, MODIFY_Strings_sort);
3809 praat_addAction1 (classStrings, 0, U"-- convert --",
3810 nullptr, 1, nullptr);
3811 praat_addAction1 (classStrings, 0, U"Convert to backslash trigraphs || Genericize",
3812 nullptr, 1, MODIFY_Strings_genericize); // alternative GuiMenu_DEPRECATED_2016
3813 praat_addAction1 (classStrings, 0, U"Convert to Unicode || Nativize",
3814 nullptr, 1, MODIFY_Strings_nativize);
3815 praat_addAction1 (classStrings, 0, U"Convert -", nullptr, 0, nullptr);
3816 praat_addAction1 (classStrings, 0, U"Replace all...",
3817 nullptr, 1, NEW_Strings_replaceAll);
3818 praat_addAction1 (classStrings, 0, U"Analyze", nullptr, 0, nullptr);
3819 praat_addAction1 (classStrings, 0, U"To Distributions",
3820 nullptr, 0, NEW_Strings_to_Distributions);
3821 praat_addAction1 (classStrings, 0, U"Synthesize", nullptr, 0, nullptr);
3822 praat_addAction1 (classStrings, 0, U"To WordList",
3823 nullptr, 0, NEW_Strings_to_WordList);
3824
3825 praat_addAction1 (classTransition, 0, U"Transition help", nullptr, 0, HELP_Transition_help);
3826 praat_addAction1 (classTransition, 0, U"Draw", nullptr, 0, nullptr);
3827 praat_addAction1 (classTransition, 0, U"Draw as numbers...",
3828 nullptr, 0, GRAPHICS_Transition_drawAsNumbers);
3829 praat_addAction1 (classTransition, 0, U"Analyse", nullptr, 0, nullptr);
3830 praat_addAction1 (classTransition, 0, U"Eigen",
3831 nullptr, 0, NEWTIMES2_Transition_eigen);
3832 praat_addAction1 (classTransition, 0, U"Conflate",
3833 nullptr, 0, NEW_Transition_conflate);
3834 praat_addAction1 (classTransition, 0, U"Synthesize", nullptr, 0, nullptr);
3835 praat_addAction1 (classTransition, 0, U"Power...",
3836 nullptr, 0, NEW_Transition_power);
3837 praat_addAction1 (classTransition, 0, U"Cast", nullptr, 0, nullptr);
3838 praat_addAction1 (classTransition, 0, U"To Matrix",
3839 nullptr, 0, NEW_Transition_to_Matrix);
3840
3841 praat_addAction2 (classDistributions, 1, classTransition, 1, U"Map",
3842 nullptr, 0, NEW1_Distributions_Transition_map);
3843 praat_addAction2 (classDistributions, 1, classTransition, 1, U"To Transition...",
3844 nullptr, 0, NEW1_Distributions_to_Transition_adj);
3845 praat_addAction2 (classDistributions, 2, classTransition, 1, U"To Transition (noise)...",
3846 nullptr, 0, NEW1_Distributions_to_Transition_noise_adj);
3847
3848 praat_addAction2 (classFormant, 1, classPointProcess, 1, U"To FormantTier",
3849 nullptr, 0, NEW1_Formant_PointProcess_to_FormantTier);
3850 praat_addAction2 (classFormant, 1, classSound, 1, U"Filter",
3851 nullptr, 0, NEW1_Sound_Formant_filter);
3852 praat_addAction2 (classFormant, 1, classSound, 1, U"Filter (no scale)",
3853 nullptr, 0, NEW1_Sound_Formant_filter_noscale);
3854
3855 praat_addAction2 (classIntensity, 1, classPitch, 1, U"Draw", nullptr, 0, nullptr);
3856 praat_addAction2 (classIntensity, 1, classPitch, 1, U"Draw (phonetogram)...",
3857 nullptr, 0, GRAPHICS_Pitch_Intensity_draw);
3858 praat_addAction2 (classIntensity, 1, classPitch, 1, U"Query", nullptr, 0, nullptr);
3859 praat_addAction2 (classIntensity, 1, classPitch, 1, U"Get mean",
3860 nullptr, 0, REAL_Pitch_Intensity_getMean);
3861 praat_addAction2 (classIntensity, 1, classPitch, 1, U"Get mean absolute slope",
3862 nullptr, 0, REAL_Pitch_Intensity_getMeanAbsoluteSlope);
3863
3864 praat_addAction2 (classIntensity, 1, classPointProcess, 1, U"To IntensityTier",
3865 nullptr, 0, NEW1_Intensity_PointProcess_to_IntensityTier);
3866
3867 praat_addAction2 (classManipulation, 1, classSound, 1, U"Replace original sound",
3868 nullptr, 0, MODIFY_Manipulation_replaceOriginalSound);
3869 praat_addAction2 (classManipulation, 1, classPointProcess, 1, U"Replace pulses",
3870 nullptr, 0, MODIFY_Manipulation_replacePulses);
3871 praat_addAction2 (classManipulation, 1, classPitchTier, 1, U"Replace pitch tier",
3872 nullptr, 0, MODIFY_Manipulation_replacePitchTier);
3873 praat_addAction2 (classManipulation, 1, classDurationTier, 1, U"Replace duration tier",
3874 nullptr, 0, MODIFY_Manipulation_replaceDurationTier);
3875 praat_addAction2 (classManipulation, 1, classTextTier, 1, U"To Manipulation",
3876 nullptr, 0, NEW1_Manipulation_TextTier_to_Manipulation);
3877 praat_addAction2 (classPitch, 1, classPitchTier, 1, U"Draw...",
3878 nullptr, 0, GRAPHICS_PitchTier_Pitch_draw);
3879 praat_addAction2 (classPitch, 1, classPitchTier, 1, U"To Pitch",
3880 nullptr, 0, NEW1_Pitch_PitchTier_to_Pitch);
3881 praat_addAction2 (classPitch, 1, classPointProcess, 1, U"To PitchTier",
3882 nullptr, 0, NEW1_Pitch_PointProcess_to_PitchTier);
3883 praat_addAction3 (classPitch, 1, classPointProcess, 1, classSound, 1, U"Voice report...",
3884 nullptr, 0, INFO_Sound_Pitch_PointProcess_voiceReport);
3885 praat_addAction2 (classPitch, 1, classSound, 1, U"To PointProcess (cc)",
3886 nullptr, 0, NEW1_Sound_Pitch_to_PointProcess_cc);
3887 praat_addAction2 (classPitch, 1, classSound, 1, U"To PointProcess (peaks)...",
3888 nullptr, 0, NEW1_Sound_Pitch_to_PointProcess_peaks);
3889 praat_addAction2 (classPitch, 1, classSound, 1, U"To Manipulation",
3890 nullptr, 0, NEW1_Sound_Pitch_to_Manipulation);
3891
3892 praat_addAction4 (classDurationTier, 1, classPitchTier, 1, classPointProcess, 1, classSound, 1, U"To Sound...",
3893 nullptr, 0, NEW1_Sound_Point_Pitch_Duration_to_Sound);
3894
3895 Melder_stopwatch ();
3896 INCLUDE_MANPAGES (manual_Manual_init)
3897 INCLUDE_MANPAGES (manual_commands_init)
3898 INCLUDE_MANPAGES (manual_formulas_init)
3899 INCLUDE_MANPAGES (manual_scripting_init)
3900 INCLUDE_MANPAGES (manual_demoWindow_init)
3901 INCLUDE_MANPAGES (manual_functions_init)
3902 INCLUDE_MANPAGES (manual_Picture_init)
3903
3904 INCLUDE_MANPAGES (manual_Fon_init)
3905 INCLUDE_MANPAGES (manual_whatsnew_init)
3906 INCLUDE_MANPAGES (manual_licenses_init)
3907 INCLUDE_MANPAGES (manual_tutorials_init)
3908 INCLUDE_MANPAGES (manual_glossary_init)
3909 INCLUDE_MANPAGES (manual_references_init)
3910 INCLUDE_MANPAGES (manual_soundFiles_init)
3911 INCLUDE_MANPAGES (manual_statistics_init)
3912 INCLUDE_MANPAGES (manual_voice_init)
3913 INCLUDE_MANPAGES (manual_programming_init)
3914 INCLUDE_MANPAGES (manual_gram_init)
3915 INCLUDE_MANPAGES (manual_ExperimentMFC_init)
3916 INCLUDE_MANPAGES (manual_EEG_init)
3917 //TRACE
3918 trace (U"manuals: ", Melder_stopwatch ());
3919
3920 INCLUDE_LIBRARY (praat_EEG_init)
3921 praat_addMenuCommand (U"Objects", U"New", U"-- new synthesis --", nullptr, 0, nullptr);
3922 INCLUDE_LIBRARY (praat_KlattGrid_init) // from dwtools
3923 INCLUDE_LIBRARY (praat_uvafon_Artsynth_init)
3924 INCLUDE_LIBRARY (praat_David_init) // starting with SpeechSynthesizer (last checked 2024-09-07)
3925 INCLUDE_LIBRARY (praat_uvafon_sensors_init)
3926 praat_addMenuCommand (U"Objects", U"New", U"-- new recognition --", nullptr, 0, nullptr);
3927 INCLUDE_LIBRARY (praat_SpeechRecognizer_init)
3928 praat_addMenuCommand (U"Objects", U"New", U"-- new grammars --", nullptr, 0, nullptr);
3929 INCLUDE_LIBRARY (praat_uvafon_gram_init)
3930 INCLUDE_LIBRARY (praat_uvafon_FFNet_init)
3931 INCLUDE_LIBRARY (praat_uvafon_LPC_init)
3932 praat_ExperimentMFC_init ();
3933
3934 Data_recognizeFileType (tabSeparatedFileRecognizer); // at end, as a sort of last resort
3935 }
3936
3937 /* End of file praat_uvafon_init.cpp */