| 1 | #ifndef _PowerCepstrogram_h_ |
| 2 | #define _PowerCepstrogram_h_ |
| 3 | /* PowerCepstrogram.h |
| 4 | * |
| 5 | * Copyright (C) 2012-2025 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 | /* |
| 22 | The Cepstrogram is a matrix of real numbers. |
| 23 | It is the inverse-fourier-transformed logarithm of the spectrum |
| 24 | of a (sound) signal. |
| 25 | */ |
| 26 | |
| 27 | #include "PowerCepstrumWorkspace.h" |
| 28 | #include "Matrix.h" |
| 29 | #include "Sound.h" |
| 30 | #include "Table.h" |
| 31 | |
| 32 | Thing_define (PowerCepstrogram, Matrix) { |
| 33 | double v_getValueAtSample (integer sampleNumber, integer level, int unit) const |
| 34 | override; |
| 35 | }; |
| 36 | |
| 37 | /* |
| 38 | xmin, xmax : time domain |
| 39 | nx, dx, x1 : sampling in the time domain |
| 40 | ymin // Lowest quefrency. |
| 41 | ymax // Highest quefrency. |
| 42 | ny // Number of quefrencies. |
| 43 | dy // Quefrency step. |
| 44 | y1 // First quefrency. |
| 45 | |
| 46 | */ |
| 47 | |
| 48 | autoPowerCepstrogram PowerCepstrogram_create (double tmin, double tmax, integer nt, double dt, double t1, |
| 49 | double qmin, double qmax, integer nq, double dq, double q1); |
| 50 | |
| 51 | void PowerCepstrogram_paint (PowerCepstrogram me, Graphics g, double tmin, double tmax, |
| 52 | double qmin, double qmax, double dBmaximum, int autoscaling, double dynamicRangedB, double dynamicCompression, bool garnish); |
| 53 | |
| 54 | autoPowerCepstrogram PowerCepstrogram_smooth (PowerCepstrogram me, double timeAveragingWindow, double quefrencyAveragingWindow); |
| 55 | |
| 56 | |
| 57 | autoTable PowerCepstrogram_to_Table_hillenbrand (PowerCepstrogram me, double pitchFloor, double pitchCeiling); |
| 58 | |
| 59 | autoTable PowerCepstrogram_to_Table_CPP (PowerCepstrogram me, bool includeFrameNumber, bool includeTime, |
| 60 | integer numberOfTimeDecimals, integer numberOfCPPdecimals, bool includeQuefrency, integer numberOfQuefrencyDecimals, |
| 61 | double pitchFloor, double pitchCeiling, double deltaF0, kVector_peakInterpolation peakInterpolationType, |
| 62 | double qstartFit, double qendFit, kCepstrum_trendType lineType, kCepstrum_trendFit fitMethod); |
| 63 | |
| 64 | void PowerCepstrogram_listCPP (PowerCepstrogram me, bool includeFrameNumber, bool includeTime, |
| 65 | integer numberOfTimeDecimals, integer numberOfCPPdecimals, bool includePeakQuefrency, integer numberOfQuefrencyDecimals, |
| 66 | double pitchFloor, double pitchCeiling, double deltaF0, kVector_peakInterpolation peakInterpolationType, |
| 67 | double qstartFit, double qendFit, kCepstrum_trendType lineType, kCepstrum_trendFit fitMethod); |
| 68 | |
| 69 | autoTable PowerCepstrogram_to_Table_CPPvalues (PowerCepstrogram me, double pitchFloor, double pitchCeiling, |
| 70 | double deltaF0, kVector_peakInterpolation peakInterpolationType, double qstartFit, double qendFit, |
| 71 | kCepstrum_trendType lineType, kCepstrum_trendFit fitMethod); |
| 72 | |
| 73 | autoPowerCepstrum PowerCepstrogram_to_PowerCepstrum_slice (PowerCepstrogram me, double time); |
| 74 | |
| 75 | autoPowerCepstrogram PowerCepstrogram_subtractTrend (constPowerCepstrogram me, double qstartFit, double qendFit, |
| 76 | kCepstrum_trendType lineType, kCepstrum_trendFit fitMethod); |
| 77 | |
| 78 | void PowerCepstrogram_subtractTrend_inplace (mutablePowerCepstrogram me, double qstartFit, double qendFit, |
| 79 | kCepstrum_trendType lineType, kCepstrum_trendFit fitMethod); |
| 80 | |
| 81 | double PowerCepstrogram_getCPPS_hillenbrand (PowerCepstrogram me, bool subtractTrendBeforeSmoothing, |
| 82 | double timeAveragingWindow, double quefrencyAveragingWindow, double pitchFloor, double pitchCeiling); |
| 83 | |
| 84 | double PowerCepstrogram_getCPPS (PowerCepstrogram me, bool subtractTrendBeforeSmoothing, |
| 85 | double timeAveragingWindow, double quefrencyAveragingWindow, double pitchFloor, double pitchCeiling, double deltaF0, kVector_peakInterpolation peakInterpolationType, double qstartFit, double qendFit, kCepstrum_trendType lineType, kCepstrum_trendFit fitMethod); |
| 86 | |
| 87 | autoMatrix PowerCepstrogram_to_Matrix (PowerCepstrogram me); |
| 88 | |
| 89 | autoPowerCepstrogram Matrix_to_PowerCepstrogram (Matrix me); |
| 90 | |
| 91 | #endif /* _PowerCepstrogram_h_ */ |