Debian Codegraph @

fon/praat_uvafon_init.cpp

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