| 1 | #ifndef _CCs_to_DTW_h_ |
| 2 | #define _CCs_to_DTW_h_ |
| 3 | /* CCs_to_DTW.h |
| 4 | * |
| 5 | * Dynamic Time Warp of two CCs. |
| 6 | * |
| 7 | * Copyright (C) 1993-2018 David Weenink |
| 8 | * |
| 9 | * This code is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or (at |
| 12 | * your option) any later version. |
| 13 | * |
| 14 | * This code is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 21 | */ |
| 22 | |
| 23 | /* |
| 24 | djmw 20020315 GPL header |
| 25 | */ |
| 26 | |
| 27 | |
| 28 | #include "CC.h" |
| 29 | #include "DTW.h" |
| 30 | |
| 31 | |
| 32 | autoDTW CCs_to_DTW (CC me, CC thee, double coefficientWeight, double logEnergyWeight, double coefficientRegressionWeight, double logEnergyRegressionWeight, double regressionWindowLength); |
| 33 | /* |
| 34 | 1. Calculate distances between CCs: |
| 35 | Distance between frame i (from me) and j (from thee) is |
| 36 | coefficientWeight * d1 + logEnergyWeight * d2 + coefficientRegressionWeight * d3 + logEnergyRegressionWeight * d4, |
| 37 | where |
| 38 | d1 = Sum (k=1; k=nCoefficients; (c [i,k]-c [j,k])^2) |
| 39 | d2 = (c [0,k]-c [0,k])^2 |
| 40 | d3 = Sum (k=1; k=nCoefficients; (r [i,k]-r [j,k])^2), with |
| 41 | r [i,k] the regression coefficient of the cepstral coefficients |
| 42 | from the frames within a time span of 'dtr' seconds. |
| 43 | c [i,j] is jth cepstral coefficient in frame i. |
| 44 | d4 = regression on energy (c [0]) |
| 45 | 2. Find optimal path through the distance matrix (see DTW). |
| 46 | |
| 47 | PRECONDITIONS: |
| 48 | |
| 49 | at least one of the four weights != 0 |
| 50 | */ |
| 51 | |
| 52 | #endif /* _CCs_to_DTW_h_ */ |