| 1 | #ifndef _Formant_h_ |
| 2 | #define _Formant_h_ |
| 3 | /* Formant.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2005,2007-2009,2011,2012,2014-2020,2024 Paul Boersma |
| 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. |
| 15 | * See the GNU 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 "Matrix.h" |
| 22 | #include "Table.h" |
| 23 | Thing_declare (Interpreter); |
| 24 | |
| 25 | #include "Formant_enums.h" |
| 26 | #include "Formant_def.h" |
| 27 | |
| 28 | autoFormant Formant_create (double tmin, double tmax, integer nt, double dt, double t1, integer maximumNumberOfFormants); |
| 29 | /* |
| 30 | Function: |
| 31 | return a new instance of Formant. |
| 32 | Preconditions: |
| 33 | nt >= 1; |
| 34 | dt > 0.0; |
| 35 | maxnFormants >= 1; |
| 36 | Postconditions: |
| 37 | my xmin == tmin; |
| 38 | my xmax == tmax; |
| 39 | my nx == nt; |
| 40 | my dx == dt; |
| 41 | my x1 == t1; |
| 42 | my maximumNumberOfPairs == maxnFormants; |
| 43 | my frames [1..nt]. intensity == 0.0; |
| 44 | my frames [1..nt]. numberOfPairs == 0; |
| 45 | my frames [1..nt]. formants [1..maxnFormants] = 0.0; |
| 46 | my frames [1..nt]. bandwidths [1..maxnFormants] = 0.0; |
| 47 | */ |
| 48 | integer Formant_getMinNumFormants (Formant me); |
| 49 | integer Formant_getMaxNumFormants (Formant me); |
| 50 | |
| 51 | double Formant_getValueAtTime (Formant me, integer formantNumber, double time, kFormant_unit unit); |
| 52 | double Formant_getBandwidthAtTime (Formant me, integer formantNumber, double time, kFormant_unit unit); |
| 53 | |
| 54 | void Formant_getExtrema (Formant me, integer formantNumber, double tmin, double tmax, double *fmin, double *fmax); |
| 55 | void Formant_getMinimumAndTime (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit, int interpolate, |
| 56 | double *return_minimum, double *return_timeOfMinimum); |
| 57 | void Formant_getMaximumAndTime (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit, int interpolate, |
| 58 | double *return_maximum, double *return_timeOfMaximum); |
| 59 | double Formant_getMinimum (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit, int interpolate); |
| 60 | double Formant_getMaximum (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit, int interpolate); |
| 61 | double Formant_getTimeOfMaximum (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit, int interpolate); |
| 62 | double Formant_getTimeOfMinimum (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit, int interpolate); |
| 63 | |
| 64 | double Formant_getQuantile (Formant me, integer formantNumber, double quantile, double tmin, double tmax, kFormant_unit unit); |
| 65 | double Formant_getQuantileOfBandwidth (Formant me, integer formantNumber, double quantile, double tmin, double tmax, kFormant_unit unit); |
| 66 | double Formant_getMean (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit); |
| 67 | double Formant_getStandardDeviation (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit); |
| 68 | |
| 69 | void Formant_sort (Formant me); |
| 70 | |
| 71 | void Formant_drawTracks (Formant me, Graphics graphics, double tmin, double tmax, double fmax, bool garnish); |
| 72 | void Formant_drawSpeckles_inside (Formant me, Graphics graphics, double tmin, double tmax, double fmin, double fmax, |
| 73 | double suppress_dB, MelderColour oddColour, MelderColour evenColour, bool drawWithContrast); |
| 74 | void Formant_drawSpeckles_inside (Formant me, Graphics graphics, double tmin, double tmax, double fmin, double fmax, |
| 75 | double suppress_dB); |
| 76 | void Formant_drawSpeckles (Formant me, Graphics graphics, double tmin, double tmax, double fmax, |
| 77 | double suppress_dB, bool garnish); |
| 78 | void Formant_scatterPlot (Formant me, Graphics graphics, double tmin, double tmax, |
| 79 | integer iformant1, double fmin1, double fmax1, integer iformant2, double fmin2, double fmax2, |
| 80 | double size_mm, conststring32 mark, bool garnish); |
| 81 | |
| 82 | autoMatrix Formant_to_Matrix (Formant me, integer iformant); |
| 83 | autoMatrix Formant_to_Matrix_bandwidths (Formant me, integer iformant); |
| 84 | void Formant_formula_frequencies (Formant me, conststring32 formula, Interpreter interpreter); |
| 85 | void Formant_formula_bandwidths (Formant me, conststring32 formula, Interpreter interpreter); |
| 86 | |
| 87 | autoFormant Formant_tracker (Formant me, integer numberOfTracks, |
| 88 | double refF1, double refF2, double refF3, double refF4, double refF5, |
| 89 | double dfCost, // per kHz |
| 90 | double bfCost, double octaveJumpCost); |
| 91 | |
| 92 | autoTable Formant_downto_Table (Formant me, bool includeFrameNumbers, |
| 93 | bool includeTimes, integer timeDecimals, |
| 94 | bool includeIntensity, integer intensityDecimals, |
| 95 | bool includeNumberOfFormants, integer frequencyDecimals, |
| 96 | bool includeBandwidths); |
| 97 | void Formant_list (Formant me, bool includeFrameNumbers, |
| 98 | bool includeTimes, integer timeDecimals, |
| 99 | bool includeIntensity, integer intensityDecimals, |
| 100 | bool includeNumberOfFormants, integer frequencyDecimals, |
| 101 | bool includeBandwidths); |
| 102 | |
| 103 | /* End of file Formant.h */ |
| 104 | #endif |