Chris@19: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@19: Chris@42: /* Chris@42: Tipic Chris@42: Chris@42: Centre for Digital Music, Queen Mary, University of London. Chris@42: Chris@42: This program is free software; you can redistribute it and/or Chris@42: modify it under the terms of the GNU General Public License as Chris@42: published by the Free Software Foundation; either version 2 of the Chris@42: License, or (at your option) any later version. See the file Chris@42: COPYING included with this distribution for more information. Chris@42: */ Chris@42: Chris@19: #ifndef CRP_H Chris@19: #define CRP_H Chris@19: Chris@19: #include "Types.h" Chris@26: #include "DCTReduce.h" Chris@19: Chris@57: /** Chris@57: * Turn features obtained from a PitchFilterbank into timbre-invariant Chris@57: * pitch chroma (CRP) features. No downsampling/smoothing is applied. Chris@57: * Chris@57: * This class retains no internal history, so a single instance could Chris@57: * be used for multiple channels at once, interleaved, within a single Chris@57: * thread. It is not thread-safe. Chris@57: */ Chris@19: class CRP Chris@19: { Chris@19: public: Chris@19: struct Parameters { Chris@19: int coefficientsToDrop; Chris@19: bool applyLogCompression; Chris@24: double logFactor; Chris@24: double logAddTerm; Chris@26: int normP; // 0 = no normalisation, 1 = L^1, 2 = L^2 Chris@25: double normThresh; Chris@24: Parameters() : Chris@25: coefficientsToDrop(55), Chris@24: applyLogCompression(true), Chris@24: logFactor(1000.0), Chris@24: logAddTerm(1.0), Chris@25: normP(2), Chris@25: normThresh(1e-6) Chris@24: { } Chris@19: }; Chris@19: Chris@26: CRP(Parameters params); Chris@19: ~CRP(); Chris@19: Chris@58: /** Chris@58: * Process a block as produced by PitchFilterbank. Chris@58: */ Chris@19: RealBlock process(const RealBlock &in); Chris@58: Chris@58: /** Chris@58: * Process a single column. Chris@58: */ Chris@58: RealColumn process(RealColumn col); Chris@19: Chris@19: private: Chris@19: Parameters m_params; Chris@26: DCTReduce m_dctReduce; Chris@19: }; Chris@19: Chris@19: #endif Chris@19: