Debian Codegraph @

LPC/Sound_to_CPP.cpp

raw
1 /* Sound_to_CPP.cpp
2 *
3 * Copyright (C) 2026 David Weenink
4 *
5 * This code is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * This code is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this work. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "Sound_to_CPP.h"
20
21 autoCPP Sound_to_CPP (constSound me, double pitchFloor, double pitchCeiling, double dt, double maximumFrequency,
22 double preEmphasisFrequency, bool subtractTrendBeforeSmoothing, double timeAveragingWindow, double quefrencyAveragingWindow,
23 kVector_peakInterpolation peakInterpolationType,
24 double qstartFit, double qendFit, kCepstrum_trendType lineType, kCepstrum_trendFit fitMethod)
25 {
26 try {
27 autoPowerCepstrogram ps = Sound_to_PowerCepstrogram (me, pitchFloor, dt, maximumFrequency, preEmphasisFrequency);
28 if (subtractTrendBeforeSmoothing) {
29 ps = PowerCepstrogram_subtractTrend (ps.get(), qstartFit, qendFit, lineType, fitMethod).move();
30 }
31 autoPowerCepstrogram smoothed = PowerCepstrogram_smooth (ps.get(), timeAveragingWindow, quefrencyAveragingWindow);
32 autoCPP cpp = PowerCepstrogram_to_CPP (smoothed.get(), pitchFloor, pitchCeiling,
33 peakInterpolationType, qstartFit, qendFit, lineType, fitMethod);
34 return cpp;
35 } catch (MelderError) {
36 Melder_throw (me, U": canot create CPP.");
37 }
38 }
39
40
41 /* End of file Sound_to_CPP.cpp */