| 1 | #cxx . . $ `<file>/LPC/FormantPath.h`/ifndef _FormantPath_h_ |
| 2 | #define _FormantPath_h_cxx . . $ `LPC/FormantPath.h:2:9`! |
| 3 | /* FormantPath.h |
| 4 | * |
| 5 | * Copyright (C) 2020-2023 David Weenink |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "Collection.h"cxx . . $ `<file>/sys/Collection.h`/ |
| 22 | #include "Formant.h"cxx . . $ `<file>/fon/Formant.h`/ |
| 23 | #include "Function.h"cxx . . $ `<file>/fon/Function.h`/ |
| 24 | #include "LPC.h"cxx . . $ `<file>/LPC/LPC.h`/ |
| 25 | #include "Sound.h"cxx . . $ `<file>/fon/Sound.h`/ |
| 26 | #include "Table.h"cxx . . $ `<file>/stat/Table.h`/ |
| 27 | #include "TextGrid.h"cxx . . $ `<file>/fon/TextGrid.h`/ |
| 28 | |
| 29 | #include "FormantPath_def.h"cxx . . $ `<file>/LPC/FormantPath_def.h`/ |
| 30 | |
| 31 | /* |
| 32 | A FormantPath inherits from Sampled and contains: |
| 33 | |
| 34 | 1. An ordered collection of N Formant objects. |
| 35 | 2. A vector of size N with ceiling frequencies in hertz. Ceiling [i] contains the formant ceiling frequency |
| 36 | that was used to calculate the corresponding Formant from the sound. |
| 37 | 3. A TextGrid in which an intervalTier determines a path. |
| 38 | Each interval is labeled with an integer number that refers to one of the Formant objects (an integer number |
| 39 | was chosen instead of the ceiling frequency wich is a real number, because integers can be more easily compared |
| 40 | for equivalence than real numbers.) |
| 41 | */ |
| 42 | |
| 43 | autoFormantPathcxx . . $ autoFormantPath# FormantPath_createcxx . . $ FormantPath_create(16da078af6b04e95). (double xmin, double xmax, integercxx . . $ integer# nx, double dx, double x1, integercxx . . $ integer# numberOfCandidates); |
| 44 | |
| 45 | integercxx . . $ integer# FormantPath_getNumberOfFormantTrackscxx . . $ FormantPath_getNumberOfFormantTracks(57eee78a3ac77977). (FormantPathcxx . . $ FormantPath# me); |
| 46 | |
| 47 | autoTablecxx . . $ autoTable# FormantPath_downTo_Table_optimalIntervalcxx . . $ FormantPath_downTo_Table_optimalInterval(8e4599b1f35d7401). (FormantPathcxx . . $ FormantPath# me, double tmin, double tmax, |
| 48 | constINTVECcxx . . $ constINTVEC# const& parameters, double powerf, bool includeFrameNumber, bool includeTime, integercxx . . $ integer# numberOfTimeDecimals, |
| 49 | bool includeIntensity, integercxx . . $ integer# numberOfIntensityDecimals, bool includeNumberOfFormants, integercxx . . $ integer# numberOfFrequencyDecimals, |
| 50 | bool includeBandwidths, bool includeOptimalCeiling, bool includeMinimumStress); |
| 51 | |
| 52 | autoTablecxx . . $ autoTable# FormantPath_downTo_Table_stressescxx . . $ FormantPath_downTo_Table_stresses(e75cb988ad3d5f1a). (FormantPathcxx . . $ FormantPath# me, double tmin, double tmax, constINTVECcxx . . $ constINTVEC# const& parameters, |
| 53 | double powerf, integercxx . . $ integer# numberOfStressDecimals, bool includeIntervalTimes, integercxx . . $ integer# numberOfTimeDecimals); |
| 54 | |
| 55 | autoFormantcxx . . $ autoFormant# FormantPath_extractFormantcxx . . $ FormantPath_extractFormant(c1105e94bde1773c). (FormantPathcxx . . $ FormantPath# me); |
| 56 | |
| 57 | autoMatrixcxx . . $ autoMatrix# FormantPath_to_Matrix_qSumscxx . . $ FormantPath_to_Matrix_qSums(f5559ea80f11849e). (FormantPathcxx . . $ FormantPath# me, integercxx . . $ integer# numberOfTracks); |
| 58 | autoMatrixcxx . . $ autoMatrix# FormantPath_to_Matrix_transitioncxx . . $ FormantPath_to_Matrix_transition(a57b8db26dabb0bc). (FormantPathcxx . . $ FormantPath# me, integercxx . . $ integer# numberOfTracks, bool maximumCosts); |
| 59 | autoMatrixcxx . . $ autoMatrix# FormantPath_to_Matrix_stresscxx . . $ FormantPath_to_Matrix_stress(a34c70565600288e). (FormantPathcxx . . $ FormantPath# me, double windowLength, constINTVECcxx . . $ constINTVEC# const& parameters, double powerf); |
| 60 | |
| 61 | double FormantPath_getStressOfCandidatecxx . . $ FormantPath_getStressOfCandidate(7a4b899a2d870095). (FormantPathcxx . . $ FormantPath# me, double tmin, double tmax, integercxx . . $ integer# fromFormant, integercxx . . $ integer# toFormant, |
| 62 | constINTVECcxx . . $ constINTVEC# const& parameters, double powerf, integercxx . . $ integer# candidate); |
| 63 | |
| 64 | autoVECcxx . . $ autoVEC# FormantPath_getStressOfCandidatescxx . . $ FormantPath_getStressOfCandidates(ac0ceb70b18df84f). (FormantPathcxx . . $ FormantPath# me, double tmin, double tmax, integercxx . . $ integer# fromFormant, integercxx . . $ integer# toFormant, |
| 65 | constINTVECcxx . . $ constINTVEC# const& parameters, double powerf); |
| 66 | |
| 67 | double FormantPath_getOptimalCeilingcxx . . $ FormantPath_getOptimalCeiling(6929afb7af3095ad). (FormantPathcxx . . $ FormantPath# me, double tmin, double tmax, constINTVECcxx . . $ constINTVEC# const& parameters, double powerf); |
| 68 | |
| 69 | autoINTVECcxx . . $ autoINTVEC# FormantPath_getOptimumPathcxx . . $ FormantPath_getOptimumPath(8accdf14aef78ca5). (FormantPathcxx . . $ FormantPath# me, double qWeight, double frequencyChangeWeight, double stressWeight, |
| 70 | double ceilingChangeWeight, double intensityModulationStepSize, double windowLength, constINTVECcxx . . $ constINTVEC# const& parameters, |
| 71 | double powerf, autoMatrixcxx . . $ autoMatrix# *out_delta); |
| 72 | |
| 73 | void FormantPath_setPathcxx . . $ FormantPath_setPath(a9da2faec368519a). (FormantPathcxx . . $ FormantPath# me, double tmin, double tmax, integercxx . . $ integer# selectedCandidate); |
| 74 | void FormantPath_setOptimalPathcxx . . $ FormantPath_setOptimalPath(b1c658718653901f). (FormantPathcxx . . $ FormantPath# me, double tmin, double tmax, constINTVECcxx . . $ constINTVEC# const& parameters, double powerf); |
| 75 | |
| 76 | void FormantPath_pathFindercxx . . $ FormantPath_pathFinder(c152c93180464ef5). (FormantPathcxx . . $ FormantPath# me, double qWeight, double frequencyChangeWeight, double stressWeight, |
| 77 | double ceilingChangeWeight, double intensityModulationStepSize, double windowLength, constINTVECcxx . . $ constINTVEC# const& parameters, |
| 78 | double powerf); |
| 79 | |
| 80 | autoFormantPathcxx . . $ autoFormantPath# Sound_to_FormantPath_anycxx . . $ Sound_to_FormantPath_any(da04c3ed23676d81). (Soundcxx . . $ Sound# me, kLPC_Analysiscxx . . $ kLPC_Analysis# lpcType, double timeStep, double maximumNumberOfFormants, |
| 81 | double formantCeiling, double analysisWidth, double preemphasisFrequency, double ceilingExtensionFraction, |
| 82 | integercxx . . $ integer# numberOfStepsUpDown, double marple_tol1, double marple_tol2, double huber_numberOfStdDev, |
| 83 | double huber_tol, integercxx . . $ integer# huber_maximumNumberOfIterations, autoSoundcxx . . $ autoSound# *out_sourcesMultiChannel |
| 84 | ); |
| 85 | |
| 86 | static inline autoFormantPathcxx . . $ autoFormantPath# Sound_to_FormantPath_burgcxx . . $ Sound_to_FormantPath_burg(eb5656d5370e24ea). (Soundcxx . . $ Sound# me, double timeStep, double maximumNumberOfFormants, |
| 87 | double formantCeiling, double analysisWidth, double preemphasisFrequency, double ceilingExtensionFraction, integercxx . . $ integer# numberOfStepsUpDown) |
| 88 | { |
| 89 | return Sound_to_FormantPath_anycxx . . $ Sound_to_FormantPath_any(da04c3ed23676d81). (me, kLPC_Analysiscxx . . $ kLPC_Analysis#::BURGcxx . . $ kLPC_Analysis#BURG., timeStep, maximumNumberOfFormants, |
| 90 | formantCeiling, analysisWidth, preemphasisFrequency, ceilingExtensionFraction, numberOfStepsUpDown, 1e-6, 1e-6, 1.5, 1e-6, 5, nullptr); |
| 91 | } |
| 92 | |
| 93 | static inline autoFormantPathcxx . . $ autoFormantPath# Sound_to_FormantPath_robustcxx . . $ Sound_to_FormantPath_robust(2c4ca634aa131257). (Soundcxx . . $ Sound# me, double timeStep, double maximumNumberOfFormants, |
| 94 | double formantCeiling, double analysisWidth, double preemphasisFrequency, double numberOfStandardDeviations, |
| 95 | integercxx . . $ integer# maximumNumberOfIterations, double tolerance, double ceilingExtensionFraction, integercxx . . $ integer# numberOfStepsUpDown) |
| 96 | { |
| 97 | return Sound_to_FormantPath_anycxx . . $ Sound_to_FormantPath_any(da04c3ed23676d81). (me, kLPC_Analysiscxx . . $ kLPC_Analysis#::ROBUSTcxx . . $ kLPC_Analysis#ROBUST., timeStep, maximumNumberOfFormants, |
| 98 | formantCeiling, analysisWidth, preemphasisFrequency, ceilingExtensionFraction, numberOfStepsUpDown, 1e-6, 1e-6, numberOfStandardDeviations, tolerance, maximumNumberOfIterations, nullptr); |
| 99 | } |
| 100 | |
| 101 | void FormantPath_drawAsGridcxx . . $ FormantPath_drawAsGrid(b4ff202d0916fa3d). (FormantPathcxx . . $ FormantPath# me, Graphicscxx . . $ Graphics# g, double tmin, double tmax, double fmax, |
| 102 | integercxx . . $ integer# fromFormant, integercxx . . $ integer# toFormant, bool showBandwidths, MelderColourcxx . . $ MelderColour# oddNumberedFormants, MelderColourcxx . . $ MelderColour# evenNumberedFormants, |
| 103 | integercxx . . $ integer# nrow, integercxx . . $ integer# ncol, double spaceBetweenFraction_x, double spaceBetweenFraction_y, double yGridLineEvery_Hz, |
| 104 | double xCursor, double yCursor, MelderColourcxx . . $ MelderColour# selected, constINTVECcxx . . $ constINTVEC# const& parameters, |
| 105 | bool markCandidatesWithinPath, bool showStress, double powerf, bool showEstimatedModels, bool garnish); |
| 106 | |
| 107 | void FormantPath_drawAsGrid_insidecxx . . $ FormantPath_drawAsGrid_inside(b4ff202d0916fa3d). (FormantPathcxx . . $ FormantPath# me, Graphicscxx . . $ Graphics# g, double tmin, double tmax, double fmax, |
| 108 | integercxx . . $ integer# fromFormant, integercxx . . $ integer# toFormant, bool showBandwidths, MelderColourcxx . . $ MelderColour# oddNumberedFormants, MelderColourcxx . . $ MelderColour# evenNumberedFormants, |
| 109 | integercxx . . $ integer# nrow, integercxx . . $ integer# ncol, double spaceBetweenFraction_x, double spaceBetweenFraction_y, double yGridLineEvery_Hz, |
| 110 | double xCursor, double yCursor, MelderColourcxx . . $ MelderColour# selected, constINTVECcxx . . $ constINTVEC# const& parameters, |
| 111 | bool markCandidatesWithinPath, bool showStress, double powerf, bool showEstimatedModels, bool garnish); |
| 112 | |
| 113 | void FormantPath_getCandidateAtTimecxx . . $ FormantPath_getCandidateAtTime(b935a6477ff02c9c). (FormantPathcxx . . $ FormantPath# me, double time, double *out_tmin, double *out_tmax, integercxx . . $ integer# *out_candidate); |
| 114 | |
| 115 | integercxx . . $ integer# FormantPath_getCandidateInFramecxx . . $ FormantPath_getCandidateInFrame(927d2653fab2afa4). (FormantPathcxx . . $ FormantPath# me, integercxx . . $ integer# iframe); |
| 116 | |
| 117 | integercxx . . $ integer# FormantPath_getUniqueCandidateInIntervalcxx . . $ FormantPath_getUniqueCandidateInInterval(786bab8c8334d64b). (FormantPathcxx . . $ FormantPath# me, double tmin, double tmax); |
| 118 | |
| 119 | inline conststring32cxx . . $ conststring32# FormantPath_getCeilingFrequency_stringcxx . . $ FormantPath_getCeilingFrequency_string(646e9cc708830cb0). (FormantPathcxx . . $ FormantPath# me, integercxx . . $ integer# candidate) { |
| 120 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (candidate > 0 && candidate <= mycxx . . $ `melder/melder.h:44:9`! ceilings.size); |
| 121 | const double ceilingFrequency = mycxx . . $ `melder/melder.h:44:9`! ceilingscxx . . $ structFormantPath#ceilings. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).candidate]; |
| 122 | return Melder_doublecxx . . $ Melder_double(f05d861d9dbec9b2). (ceilingFrequency); |
| 123 | } |
| 124 | |
| 125 | /* |
| 126 | Only needed to convert from version 0 |
| 127 | */ |
| 128 | autoTextGridcxx . . $ autoTextGrid# FormantPath_to_TextGrid_version0cxx . . $ FormantPath_to_TextGrid_version0(4c602d361d111fd9). (FormantPathcxx . . $ FormantPath# me, INTVECcxx . . $ INTVEC# const& path); |
| 129 | |
| 130 | #endif /* _FormantPath_h_ */ |