annotate dsp/chromagram/Chromagram.h @ 489:701233f8ed41

Make include-guards consistent
author Chris Cannam <cannam@all-day-breakfast.com>
date Fri, 31 May 2019 16:48:37 +0100
parents fdaa63607c15
children
rev   line source
c@225 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
c@225 2 /*
c@225 3 QM DSP Library
c@225 4
c@225 5 Centre for Digital Music, Queen Mary, University of London.
c@309 6 This file 2005-2006 Christian Landone.
c@309 7
c@309 8 This program is free software; you can redistribute it and/or
c@309 9 modify it under the terms of the GNU General Public License as
c@309 10 published by the Free Software Foundation; either version 2 of the
c@309 11 License, or (at your option) any later version. See the file
c@309 12 COPYING included with this distribution for more information.
c@225 13 */
c@225 14
cannam@489 15 #ifndef QM_DSP_CHROMAGRAM_H
cannam@489 16 #define QM_DSP_CHROMAGRAM_H
c@225 17
c@225 18 #include "dsp/transforms/FFT.h"
c@257 19 #include "base/Window.h"
c@225 20 #include "ConstantQ.h"
c@225 21
cannam@465 22 struct ChromaConfig {
cannam@465 23 double FS;
c@225 24 double min;
c@225 25 double max;
c@414 26 int BPO;
c@225 27 double CQThresh;
c@259 28 MathUtilities::NormaliseType normalise;
c@225 29 };
c@225 30
c@225 31 class Chromagram
c@225 32 {
cannam@483 33 public:
c@225 34 Chromagram( ChromaConfig Config );
c@225 35 ~Chromagram();
cannam@467 36
cannam@467 37 /**
cannam@467 38 * Process a time-domain input signal of length equal to
cannam@467 39 * getFrameSize().
cannam@467 40 *
cannam@467 41 * The returned buffer contains the chromagram values indexed by
cannam@467 42 * bin, with the number of values corresponding to the BPO field
cannam@467 43 * in the ChromaConfig supplied at construction. It is owned by
cannam@467 44 * the Chromagram object and is reused from one process call to
cannam@467 45 * the next.
cannam@467 46 */
cannam@467 47 double *process(const double *data);
cannam@467 48
cannam@467 49 /**
cannam@467 50 * Process a frequency-domain input signal generated from a
cannam@467 51 * time-domain signal of length equal to getFrameSize() that has
cannam@467 52 * been windowed and "fftshifted" to place the zero index in the
cannam@467 53 * centre of the frame. The real and imag buffers must each
cannam@467 54 * contain the full getFrameSize() frequency bins.
cannam@467 55 *
cannam@467 56 * The returned buffer contains the chromagram values indexed by
cannam@467 57 * bin, with the number of values corresponding to the BPO field
cannam@467 58 * in the ChromaConfig supplied at construction. It is owned by
cannam@467 59 * the Chromagram object and is reused from one process call to
cannam@467 60 * the next.
cannam@467 61 */
cannam@467 62 double *process(const double *real, const double *imag);
cannam@467 63
cannam@467 64 void unityNormalise(double* src);
c@225 65
c@225 66 // Complex arithmetic
c@225 67 double kabs( double real, double imag );
cannam@483 68
c@225 69 // Results
c@414 70 int getK() { return m_uK;}
c@414 71 int getFrameSize() { return m_frameSize; }
c@414 72 int getHopSize() { return m_hopSize; }
c@414 73
c@225 74 private:
c@225 75 int initialise( ChromaConfig Config );
c@225 76 int deInitialise();
c@257 77
c@257 78 Window<double> *m_window;
c@257 79 double *m_windowbuf;
cannam@483 80
c@225 81 double* m_chromadata;
c@225 82 double m_FMin;
c@225 83 double m_FMax;
c@414 84 int m_BPO;
c@414 85 int m_uK;
c@225 86
c@259 87 MathUtilities::NormaliseType m_normalise;
c@225 88
c@414 89 int m_frameSize;
c@414 90 int m_hopSize;
c@225 91
c@289 92 FFTReal* m_FFT;
c@225 93 ConstantQ* m_ConstantQ;
c@225 94
c@225 95 double* m_FFTRe;
c@225 96 double* m_FFTIm;
c@225 97 double* m_CQRe;
c@225 98 double* m_CQIm;
c@225 99
c@276 100 bool m_skGenerated;
c@225 101 };
c@225 102
c@225 103 #endif