| 1 | #cxx . . $ `<file>/LPC/PowerCepstrumWorkspace.h`/ifndef _PowerCepstrumWorkspace_h_ |
| 2 | #define _PowerCepstrumWorkspace_h_cxx . . $ `LPC/PowerCepstrumWorkspace.h:2:9`! |
| 3 | /* PowerCepstrumWorkspace_def.h |
| 4 | * |
| 5 | * Copyright (C) 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 3 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 "PowerCepstrum.h"cxx . . $ `<file>/LPC/PowerCepstrum.h`/ |
| 22 | #include "SlopeSelector.h"cxx . . $ `<file>/dwsys/SlopeSelector.h`/ |
| 23 | |
| 24 | Thing_definecxx . . $ mutablePowerCepstrumWorkspace# (PowerCepstrumWorkspace, Thing) { |
| 25 | |
| 26 | /* |
| 27 | To do some of the calculations efficiently we use a Workspace that maintains state. |
| 28 | */ |
| 29 | constPowerCepstrumcxx . . $ constPowerCepstrum# powerCepstrumcxx . . $ structPowerCepstrumWorkspace#powerCepstrum.; |
| 30 | integercxx . . $ integer# numberOfPointscxx . . $ structPowerCepstrumWorkspace#numberOfPoints. = 0; |
| 31 | integercxx . . $ integer# imincxx . . $ structPowerCepstrumWorkspace#imin., imaxcxx . . $ structPowerCepstrumWorkspace#imax.; // [imin,imax] the slope calculation interval |
| 32 | autoVECcxx . . $ autoVEC# xcxx . . $ structPowerCepstrumWorkspace#x., ycxx . . $ structPowerCepstrumWorkspace#y.; // numberOfPoints (in dB's) |
| 33 | autoMatrixcxx . . $ autoMatrix# asdBscxx . . $ structPowerCepstrumWorkspace#asdBs.; // for peak detection |
| 34 | autoSlopeSelectorcxx . . $ autoSlopeSelector# slopeSelectorcxx . . $ structPowerCepstrumWorkspace#slopeSelector.; |
| 35 | bool slopeKnowncxx . . $ structPowerCepstrumWorkspace#slopeKnown. = false, peakKnowncxx . . $ structPowerCepstrumWorkspace#peakKnown. = false, trendSubtractedcxx . . $ structPowerCepstrumWorkspace#trendSubtracted. = false; |
| 36 | kSlopeSelector_methodcxx . . $ kSlopeSelector_method# methodcxx . . $ structPowerCepstrumWorkspace#method.; |
| 37 | kCepstrum_trendTypecxx . . $ kCepstrum_trendType# trendLineTypecxx . . $ structPowerCepstrumWorkspace#trendLineType.; |
| 38 | kVector_peakInterpolationcxx . . $ kVector_peakInterpolation# peakInterpolationTypecxx . . $ structPowerCepstrumWorkspace#peakInterpolationType. = kVector_peakInterpolationcxx . . $ kVector_peakInterpolation# :: PARABOLICcxx . . $ kVector_peakInterpolation#PARABOLIC.; |
| 39 | double qminPeakSearchcxx . . $ structPowerCepstrumWorkspace#qminPeakSearch., qmaxPeakSearchcxx . . $ structPowerCepstrumWorkspace#qmaxPeakSearch.; // peak in [pitchFloor, pitchCeiling] |
| 40 | double slopecxx . . $ structPowerCepstrumWorkspace#slope., interceptcxx . . $ structPowerCepstrumWorkspace#intercept.; |
| 41 | double cppcxx . . $ structPowerCepstrumWorkspace#cpp.; // = peakdB - trenddB |
| 42 | double trenddBcxx . . $ structPowerCepstrumWorkspace#trenddB., peakdBcxx . . $ structPowerCepstrumWorkspace#peakdB.; |
| 43 | double peakQuefrencycxx . . $ structPowerCepstrumWorkspace#peakQuefrency.; |
| 44 | integercxx . . $ integer# maximumNumberOfRhamonicscxx . . $ structPowerCepstrumWorkspace#maximumNumberOfRhamonics., numberOfRhamonicscxx . . $ structPowerCepstrumWorkspace#numberOfRhamonics.; |
| 45 | autoMATcxx . . $ autoMAT# rhamonicscxx . . $ structPowerCepstrumWorkspace#rhamonics.; // maximumNumberOfRhamonics x 5: power, q1, q, q2, amplitude |
| 46 | |
| 47 | void initWorkspacecxx . . $ structPowerCepstrumWorkspace#initWorkspace(3274f37fea208c61). (constPowerCepstrumcxx . . $ constPowerCepstrum# me, double qminFit, double qmaxFit, kCepstrum_trendTypecxx . . $ kCepstrum_trendType# trendLineType, kCepstrum_trendFitcxx . . $ kCepstrum_trendFit# method); |
| 48 | |
| 49 | void initPeakSearchPartcxx . . $ structPowerCepstrumWorkspace#initPeakSearchPart(f64aff899444c20a). (double qminPeakSearch, double qmaxPeakSearch, kVector_peakInterpolationcxx . . $ kVector_peakInterpolation# peakInterpolationType); |
| 50 | |
| 51 | void newDatacxx . . $ structPowerCepstrumWorkspace#newData(97428d87df076bf). (constPowerCepstrumcxx . . $ constPowerCepstrum# thee); |
| 52 | |
| 53 | void getSlopeAndInterceptcxx . . $ structPowerCepstrumWorkspace#getSlopeAndIntercept(49f6e7a06ebc5aa8). (); |
| 54 | |
| 55 | void getPeakAndPositioncxx . . $ structPowerCepstrumWorkspace#getPeakAndPosition(49f6e7a06ebc5aa8). (); |
| 56 | |
| 57 | void subtractTrendcxx . . $ structPowerCepstrumWorkspace#subtractTrend(49f6e7a06ebc5aa8). (); |
| 58 | |
| 59 | double getTrendcxx . . $ structPowerCepstrumWorkspace#getTrend(447c67c6676f75c3). (double quefrency); |
| 60 | |
| 61 | void getCPPcxx . . $ structPowerCepstrumWorkspace#getCPP(49f6e7a06ebc5aa8). (); |
| 62 | |
| 63 | void todBscxx . . $ structPowerCepstrumWorkspace#todBs(49f6e7a06ebc5aa8). (); |
| 64 | |
| 65 | void fromdBscxx . . $ structPowerCepstrumWorkspace#fromdBs(49f6e7a06ebc5aa8). (); |
| 66 | |
| 67 | void setMaximumNumberOfRhamonicscxx . . $ structPowerCepstrumWorkspace#setMaximumNumberOfRhamonics(1624ee8275b10bda). (integercxx . . $ integer# maximumNumberOfRhamonics); |
| 68 | |
| 69 | void getNumberOfRhamonicscxx . . $ structPowerCepstrumWorkspace#getNumberOfRhamonics(bc12c9ec15586e6a). (double qmin, double qmax); |
| 70 | |
| 71 | void getRhamonicPeakscxx . . $ structPowerCepstrumWorkspace#getRhamonicPeaks(bc12c9ec15586e6a). (double qmin, double qmax); |
| 72 | |
| 73 | void getRhamonicsPowercxx . . $ structPowerCepstrumWorkspace#getRhamonicsPower(98dd472ac7e5c3d4). (double qmin, double qmax, double f0fractionalWidth); |
| 74 | |
| 75 | double getRNRcxx . . $ structPowerCepstrumWorkspace#getRNR(7678bba071383ab). (double qmin, double qmax, double f0fractionalWidth); |
| 76 | |
| 77 | }; |
| 78 | |
| 79 | autoPowerCepstrumWorkspacecxx . . $ autoPowerCepstrumWorkspace# PowerCepstrumWorkspace_createcxx . . $ PowerCepstrumWorkspace_create(fb1b3573b07a0390). (constPowerCepstrumcxx . . $ constPowerCepstrum# thee, double qminFit, double qmaxFit, |
| 80 | kCepstrum_trendTypecxx . . $ kCepstrum_trendType# trendLineType, kCepstrum_trendFitcxx . . $ kCepstrum_trendFit# method); |
| 81 | |
| 82 | /*void PowerCepstrum_initWorkspace (PowerCepstrum me, double qminFit, double qmaxFit, |
| 83 | kCepstrum_trendType trendLineType, kCepstrum_trendFit method); |
| 84 | |
| 85 | |
| 86 | void PowerCepstrumWorkspace_init (mutablePowerCepstrumWorkspace me, constPowerCepstrum thee, double qminFit, double qmaxFit, |
| 87 | kCepstrum_trendType trendLineType, kCepstrum_trendFit method); |
| 88 | |
| 89 | autoPowerCepstrumWorkspace PowerCepstrumWorkspace_create (constPowerCepstrum thee, double qminFit, double qmaxFit, |
| 90 | kCepstrum_trendType trendLineType, kCepstrum_trendFit method); |
| 91 | |
| 92 | void PowerCepstrumWorkspace_initPeakSearchPart (mutablePowerCepstrumWorkspace me, double qminPeakSearch, |
| 93 | double qmaxPeakSearch, kVector_peakInterpolation peakInterpolationType); |
| 94 | */ |
| 95 | |
| 96 | #endif /* PowerCepstrumWorkspace_h_ */ |