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