| 1 |
#ifndef _Cepstrumc_h_ |
| 2 |
#define _Cepstrumc_h_ |
| 3 |
/* Cepstrumc.h |
| 4 |
* |
| 5 |
* Copyright (C) 1994-2019 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 |
djmw 19950822 |
| 23 |
djmw 20020812 GPL header |
| 24 |
djmw 20110306 Latest modification. |
| 25 |
*/ |
| 26 |
|
| 27 |
#include "Sampled.h" |
| 28 |
#include "Matrix.h" |
| 29 |
#include "Graphics.h" |
| 30 |
#include "DTW.h" |
| 31 |
|
| 32 |
#include "Cepstrumc_def.h" |
| 33 |
|
| 34 |
void Cepstrumc_init (Cepstrumc me, double tmin, double tmax, integer nt, double dt, double t1, |
| 35 |
integer nCoefficients, double samplingFrequency); |
| 36 |
|
| 37 |
autoCepstrumc Cepstrumc_create (double tmin, double tmax, integer nt, double dt, double t1, |
| 38 |
integer nCoefficients, double samplingFrequency); |
| 39 |
|
| 40 |
/******************* Frames ************************************************/ |
| 41 |
|
| 42 |
void Cepstrumc_Frame_init (Cepstrumc_Frame me, integer nCoefficients); |
| 43 |
|
| 44 |
autoDTW Cepstrumc_to_DTW (Cepstrumc me, Cepstrumc thee, double wc, double wle, |
| 45 |
double wr, double wer, double dtr, int matchStart, int matchEnd, int constraint); |
| 46 |
/* |
| 47 |
1. Calculate distances between Cepstra: |
| 48 |
Distance between frame i (from me) and j (from thee) is |
| 49 |
wc * d1 + wle * d2 + wr * d3 + wer * d4, |
| 50 |
where wc, wle, wr & wer are weights and |
| 51 |
d1 = Sum (k=1; k=nCoefficients; (c [i,k]-c [j,k])^2) |
| 52 |
d2 = (c [0,k]-c [0,k])^2 |
| 53 |
d3 = Sum (k=1; k=nCoefficients; (r [i,k]-r [j,k])^2), with |
| 54 |
r [i,k] the regression coefficient of the cepstral coefficients |
| 55 |
from the frames within a time span of 'dtr' seconds. |
| 56 |
c [i,j] is jth cepstral coefficient in frame i. |
| 57 |
d4 = regression on energy (c [0]) |
| 58 |
2. Find optimal path through the distance matrix (see DTW). |
| 59 |
|
| 60 |
PRECONDITIONS: |
| 61 |
|
| 62 |
at least one of wc, wle, wr, wer != 0 |
| 63 |
*/ |
| 64 |
|
| 65 |
autoMatrix Cepstrumc_to_Matrix (Cepstrumc me); |
| 66 |
|
| 67 |
#endif /* _Cepstrumc_h_ */ |