| 1 | #ifndef _Harmonicity_h_ |
| 2 | #define _Harmonicity_h_ |
| 3 | /* Harmonicity.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2011,2015-2017,2022,2023 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 "Vector.h" |
| 22 | |
| 23 | Thing_define (Harmonicity, Vector) { |
| 24 | void v1_info () |
| 25 | override; |
| 26 | int v_domainQuantity () const |
| 27 | override { return MelderQuantity_TIME_SECONDS; } |
| 28 | }; |
| 29 | |
| 30 | /* Attributes: |
| 31 | xmin // Start time (seconds). |
| 32 | xmax > xmin // End time (seconds). |
| 33 | nx >= 1 // Number of time slices. |
| 34 | dx > 0.0 // Time step (seconds). |
| 35 | x1 // Centre of first time slice (seconds). |
| 36 | ymin, ymax, dy, y1 = 1.0 |
| 37 | ny = 1 |
| 38 | z [1] [1..nt] |
| 39 | // The harmonic strength, a real number between -150 dB and +150 dB: |
| 40 | // -150 dB means not periodic at all, +150 dB means perfectly periodic. |
| 41 | // Normal values for speech are between -10 dB for [s] and +30 dB for [u]. |
| 42 | // -200 means silence. |
| 43 | */ |
| 44 | |
| 45 | autoHarmonicity Harmonicity_create (double tmin, double tmax, integer nt, double dt, double t1); |
| 46 | |
| 47 | void Harmonicity_draw (Harmonicity me, double tmin, double tmax, double min, double max); |
| 48 | /* |
| 49 | draw a harmonicity contour into the current Graphics. |
| 50 | If tmax <= tmin, draw whole time domain. |
| 51 | If max <= min, scale to extrema. |
| 52 | */ |
| 53 | |
| 54 | double Harmonicity_getMean (Harmonicity me, double tmin, double tmax); |
| 55 | double Harmonicity_getStandardDeviation (Harmonicity me, double tmin, double tmax); |
| 56 | double Harmonicity_getQuantile (Harmonicity me, double quantile); |
| 57 | |
| 58 | autoMatrix Harmonicity_to_Matrix (Harmonicity me); |
| 59 | autoHarmonicity Matrix_to_Harmonicity (Matrix me); |
| 60 | |
| 61 | /* End of file Harmonicity.h */ |
| 62 | #endif |