view NoveltyCurveProcessor.h @ 36:4010960c659e

* Merge with Chris' changes
author Carl Bussey <c.bussey@se10.qmul.ac.uk>
date Thu, 04 Sep 2014 14:33:36 +0100
parents fe23998968b4
children 4cf2d163127b
line wrap: on
line source
//
//  NoveltyCurveProcessor.h
//  Tempogram
//
//  Created by Carl Bussey on 10/07/2014.
//  Copyright (c) 2014 Carl Bussey. All rights reserved.
//

// Don't new delete objects

#ifndef __Tempogram__NoveltyCurve__
#define __Tempogram__NoveltyCurve__

#include <iostream>
#include <cmath>
#include <vector>
#include <iostream>
#include "FIRFilter.h"
#include "WindowFunction.h"
#include <cassert>
#include "SpectrogramProcessor.h"

class NoveltyCurveProcessor{
    float m_samplingFrequency;
    size_t m_fftLength;
    size_t m_blockSize;
    int m_compressionConstant;
    size_t m_numberOfBands;
    int * m_pBandBoundaries;
    float * m_pBandSum;
    
    void initialise();
    void cleanup();
    void subtractLocalAverage(std::vector<float> &noveltyCurve, const size_t &smoothLength) const;
    void smoothedDifferentiator(SpectrogramTransposed &spectrogram, const size_t &smoothLength) const;
    void halfWaveRectify(SpectrogramTransposed &spectrogram) const;
    
public:
    
    NoveltyCurveProcessor(const float &samplingFrequency, const size_t &fftLength, const size_t &compressionConstant);
    ~NoveltyCurveProcessor();
    std::vector<float> spectrogramToNoveltyCurve(const Spectrogram &spectrogram) const;
};

#endif /* defined(__Tempogram__NoveltyCurve__) */