~ubuntu-branches/ubuntu/utopic/ardour3/utopic

« back to all changes in this revision

Viewing changes to libs/qm-dsp/dsp/chromagram/Chromagram.h

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler
  • Date: 2013-09-21 19:05:02 UTC
  • Revision ID: package-import@ubuntu.com-20130921190502-8gsftrku6jnzhd7v
Tags: upstream-3.4~dfsg
ImportĀ upstreamĀ versionĀ 3.4~dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
 
2
 
 
3
/*
 
4
    QM DSP Library
 
5
 
 
6
    Centre for Digital Music, Queen Mary, University of London.
 
7
    This file 2005-2006 Christian Landone.
 
8
 
 
9
    This program is free software; you can redistribute it and/or
 
10
    modify it under the terms of the GNU General Public License as
 
11
    published by the Free Software Foundation; either version 2 of the
 
12
    License, or (at your option) any later version.  See the file
 
13
    COPYING included with this distribution for more information.
 
14
*/
 
15
 
 
16
#ifndef CHROMAGRAM_H
 
17
#define CHROMAGRAM_H
 
18
 
 
19
#include "dsp/transforms/FFT.h"
 
20
#include "base/Window.h"
 
21
#include "ConstantQ.h"
 
22
 
 
23
struct ChromaConfig{
 
24
    unsigned int FS;
 
25
    double min;
 
26
    double max;
 
27
    unsigned int BPO;
 
28
    double CQThresh;
 
29
    MathUtilities::NormaliseType normalise;
 
30
};
 
31
 
 
32
class Chromagram 
 
33
{
 
34
 
 
35
public: 
 
36
    Chromagram( ChromaConfig Config );
 
37
    ~Chromagram();
 
38
        
 
39
    double* process( const double *data ); // time domain
 
40
    double* process( const double *real, const double *imag ); // frequency domain
 
41
    void unityNormalise( double* src );
 
42
 
 
43
    // Complex arithmetic
 
44
    double kabs( double real, double imag );
 
45
        
 
46
    // Results
 
47
    unsigned int getK() { return m_uK;}
 
48
    unsigned int getFrameSize() { return m_frameSize; }
 
49
    unsigned int getHopSize()   { return m_hopSize; }
 
50
 
 
51
private:
 
52
    int initialise( ChromaConfig Config );
 
53
    int deInitialise();
 
54
 
 
55
    Window<double> *m_window;
 
56
    double *m_windowbuf;
 
57
        
 
58
    double* m_chromadata;
 
59
    double m_FMin;
 
60
    double m_FMax;
 
61
    unsigned int m_BPO;
 
62
    unsigned int m_uK;
 
63
 
 
64
    MathUtilities::NormaliseType m_normalise;
 
65
 
 
66
    unsigned int m_frameSize;
 
67
    unsigned int m_hopSize;
 
68
 
 
69
    FFTReal* m_FFT;
 
70
    ConstantQ* m_ConstantQ;
 
71
 
 
72
    double* m_FFTRe;
 
73
    double* m_FFTIm;
 
74
    double* m_CQRe;
 
75
    double* m_CQIm;
 
76
 
 
77
    bool m_skGenerated;
 
78
};
 
79
 
 
80
#endif