Chris@19
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@19
|
2
|
Chris@42
|
3 /*
|
Chris@42
|
4 Tipic
|
Chris@42
|
5
|
Chris@42
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@42
|
7
|
Chris@42
|
8 This program is free software; you can redistribute it and/or
|
Chris@42
|
9 modify it under the terms of the GNU General Public License as
|
Chris@42
|
10 published by the Free Software Foundation; either version 2 of the
|
Chris@42
|
11 License, or (at your option) any later version. See the file
|
Chris@42
|
12 COPYING included with this distribution for more information.
|
Chris@42
|
13 */
|
Chris@42
|
14
|
Chris@19
|
15 #ifndef CRP_H
|
Chris@19
|
16 #define CRP_H
|
Chris@19
|
17
|
Chris@19
|
18 #include "Types.h"
|
Chris@26
|
19 #include "DCTReduce.h"
|
Chris@19
|
20
|
Chris@57
|
21 /**
|
Chris@57
|
22 * Turn features obtained from a PitchFilterbank into timbre-invariant
|
Chris@57
|
23 * pitch chroma (CRP) features. No downsampling/smoothing is applied.
|
Chris@57
|
24 *
|
Chris@57
|
25 * This class retains no internal history, so a single instance could
|
Chris@57
|
26 * be used for multiple channels at once, interleaved, within a single
|
Chris@57
|
27 * thread. It is not thread-safe.
|
Chris@57
|
28 */
|
Chris@19
|
29 class CRP
|
Chris@19
|
30 {
|
Chris@19
|
31 public:
|
Chris@19
|
32 struct Parameters {
|
Chris@19
|
33 int coefficientsToDrop;
|
Chris@19
|
34 bool applyLogCompression;
|
Chris@24
|
35 double logFactor;
|
Chris@24
|
36 double logAddTerm;
|
Chris@26
|
37 int normP; // 0 = no normalisation, 1 = L^1, 2 = L^2
|
Chris@25
|
38 double normThresh;
|
Chris@24
|
39 Parameters() :
|
Chris@25
|
40 coefficientsToDrop(55),
|
Chris@24
|
41 applyLogCompression(true),
|
Chris@24
|
42 logFactor(1000.0),
|
Chris@24
|
43 logAddTerm(1.0),
|
Chris@25
|
44 normP(2),
|
Chris@25
|
45 normThresh(1e-6)
|
Chris@24
|
46 { }
|
Chris@19
|
47 };
|
Chris@19
|
48
|
Chris@26
|
49 CRP(Parameters params);
|
Chris@19
|
50 ~CRP();
|
Chris@19
|
51
|
Chris@58
|
52 /**
|
Chris@58
|
53 * Process a block as produced by PitchFilterbank.
|
Chris@58
|
54 */
|
Chris@19
|
55 RealBlock process(const RealBlock &in);
|
Chris@58
|
56
|
Chris@58
|
57 /**
|
Chris@58
|
58 * Process a single column.
|
Chris@58
|
59 */
|
Chris@58
|
60 RealColumn process(RealColumn col);
|
Chris@19
|
61
|
Chris@19
|
62 private:
|
Chris@19
|
63 Parameters m_params;
|
Chris@26
|
64 DCTReduce m_dctReduce;
|
Chris@19
|
65 };
|
Chris@19
|
66
|
Chris@19
|
67 #endif
|
Chris@19
|
68
|