| 1 |
#ifndef _CPP_h_ |
| 2 |
#define _CPP_h_ |
| 3 |
/* CPP.h |
| 4 |
* |
| 5 |
* Copyright (C) 2026 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. |
| 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 |
#include "Pitch.h" |
| 23 |
|
| 24 |
Thing_define (CPP, Vector) { |
| 25 |
void v1_info () |
| 26 |
override; |
| 27 |
int v_domainQuantity () const |
| 28 |
override { return MelderQuantity_TIME_SECONDS; } |
| 29 |
}; |
| 30 |
|
| 31 |
/* |
| 32 |
Cepstral Peak Prominence is a measure that shows periodicity in the Spectrum. |
| 33 |
The peak prominenceis the distance between top of the first peak in the PowerCepstrum |
| 34 |
and the peak's background. |
| 35 |
Periodicity in the Spectrum is caused by periodicity in the sound if the |
| 36 |
sound is composed of multiple harmonics. A single sine with frequency f0 does not show |
| 37 |
periodicity in the spectrum, just a single peak. Only if there are harmonics of f0, |
| 38 |
periodicity in the spectrum will turn up. |
| 39 |
|
| 40 |
Attributes: |
| 41 |
xmin // Start time (seconds). |
| 42 |
xmax > xmin // End time (seconds). |
| 43 |
nx >= 1 // Number of time slices. |
| 44 |
dx > 0.0 // Time step (seconds). |
| 45 |
x1 // Centre of first time slice (seconds). |
| 46 |
ymin, ymax, dy, y1 = 1.0 |
| 47 |
ny = 1 |
| 48 |
z [1] [1..nt] |
| 49 |
TODO |
| 50 |
The Cepstral Prominence Peak value, a real number between 0 dB and > 100 dB: |
| 51 |
0 dB means no periodicity at all |
| 52 |
Normal values for speech are between 10 dB for non-voiced parts and 60 dB for monotone perfectly voiced |
| 53 |
*/ |
| 54 |
|
| 55 |
autoCPP CPP_create (double tmin, double tmax, integer nt, double dt, double t1); |
| 56 |
|
| 57 |
void CPP_draw (CPP me, Graphics g, double tmin, double tmax, double min, double max, bool garnish); |
| 58 |
/* |
| 59 |
draw a CPP contour into the current Graphics. |
| 60 |
If tmax <= tmin, draw whole time domain. |
| 61 |
If max <= min, scale to extrema. |
| 62 |
*/ |
| 63 |
|
| 64 |
double CPP_getMean (CPP me, double tmin, double tmax); |
| 65 |
|
| 66 |
double CPP_getStandardDeviation (CPP me, double tmin, double tmax); |
| 67 |
|
| 68 |
double CPP_getQuantile (CPP me, double quantile); |
| 69 |
|
| 70 |
autoMatrix CPP_to_Matrix (CPP me); |
| 71 |
|
| 72 |
autoCPP Matrix_to_CPP (Matrix me); |
| 73 |
|
| 74 |
autoCPP CPP_and_Pitch_to_CPP_markUnvoiced (CPP me, Pitch thee); |
| 75 |
|
| 76 |
#endif // _CPP_h_ |