1 /***************************************************************************
2 * Copyright (C) 2005 by Olivier Goffart *
5 * This program 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 *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
25 #include <QtCore/QMap>
26 #include <kdemacros.h>
32 #define WINDOW_MINIMUM 0.10
33 #define WINDOW_MINIMUM_ECART 200
34 #define WINDOW_NUMBER 7
35 #define WINDOW_SUPER 0.43
36 #define WINDOW_UNIT sound.fs()/4
41 #define FFT_RANGE_INF 370
42 #define FFT_RANGE_SUP 2000
43 // #define FFT_PONDERATION(f) ((double)log(1+(f))/log(10))
44 #define FFT_PONDERATION(f) 1
47 // theses settings are better in a 8000Hz fs
48 /*#define FFT_RANGE_INF 300
49 #define FFT_RANGE_SUP 1500*/
52 //#define REJECT_FACTOR_ECART_REL 0.5
53 #define REJECT_FACTOR_DIFF 0.0018
67 @author Olivier Goffart
69 class KDE_EXPORT VoiceSignature
{
71 explicit VoiceSignature(const Sound
& s
);
76 QMap
<int, QMap
<int, double> > data
;
78 static QMap
<int, QMap
<int, double> > pond
;
80 static float diff(const VoiceSignature
&s1
, const VoiceSignature
&s2
);
87 static QVector
<double> fft(const Sound
& sound
, unsigned int start
, unsigned int stop
);
88 static bool window(const Sound
& sound
, unsigned int *start
, unsigned int *stop
);
90 void write(KConfigGroup
& cfg
, const QString
&key
) const;
91 void read(KConfigGroup
& cfg
, const QString
&key
);
93 inline bool isNull() const
95 return data
.isEmpty();