| 1 |
/* Sounds_to_DTW.cpp |
| 2 |
* |
| 3 |
* Copyright (C) 2012-2019 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_MFCC.h" |
| 20 |
#include "Sounds_to_DTW.h" |
| 21 |
#include "CCs_to_DTW.h" |
| 22 |
|
| 23 |
autoDTW Sounds_to_DTW (Sound me, Sound thee, double analysisWidth, double dt, double band, int slope) { |
| 24 |
try { |
| 25 |
constexpr integer numberOfCoefficients = 12; |
| 26 |
constexpr double fmin_mel = 100.0, df_mel = 100.0, fmax_mel = 0.0; |
| 27 |
//TRACE |
| 28 |
trace(1); |
| 29 |
autoMFCC mfcc_me = Sound_to_MFCC (me, numberOfCoefficients, analysisWidth, dt, fmin_mel, fmax_mel, df_mel); |
| 30 |
trace(2); |
| 31 |
autoMFCC mfcc_thee = Sound_to_MFCC (thee, numberOfCoefficients, analysisWidth, dt, fmin_mel, fmax_mel, df_mel); |
| 32 |
trace(3); |
| 33 |
constexpr double wc = 1.0, wle = 0.0, wr = 0.0, wer = 0.0, dtr = 0.0; |
| 34 |
autoDTW him = CCs_to_DTW (mfcc_me.get(), mfcc_thee.get(), wc, wle, wr, wer, dtr); |
| 35 |
trace(4); |
| 36 |
autoPolygon p = DTW_to_Polygon (him.get(), band, slope); |
| 37 |
trace(5); |
| 38 |
DTW_Polygon_findPathInside (him.get(), p.get(), slope, 0); |
| 39 |
trace(6); |
| 40 |
return him; |
| 41 |
} catch (MelderError) { |
| 42 |
Melder_throw (me, U": no DTW created."); |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
/* End of file Sounds_to_DTW.cpp */ |