view NoveltyCurveProcessor.h @ 20:de7213b35755

* Removed warnings of comparisons with ints and size_t
author Carl Bussey <c.bussey@se10.qmul.ac.uk>
date Fri, 15 Aug 2014 15:17:28 +0100
parents 1e4c02ca8b81
children 99380ba63be6
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;
    size_t m_numberOfBlocks;
    int m_compressionConstant;
    size_t m_numberOfBands;
    int * m_pBandBoundaries;
    float * m_pBandSum;
    
    void initialise();
    void cleanup();
    float calculateMax(const std::vector< std::vector<float> > &spectrogram) const;
    void subtractLocalAverage(std::vector<float> &noveltyCurve, const size_t &smoothLength) const;
    void smoothedDifferentiator(std::vector< std::vector<float> > &spectrogram, const size_t &smoothLength) const;
    void halfWaveRectify(std::vector< std::vector<float> > &spectrogram) const;
    
public:
    
    NoveltyCurveProcessor(const float &samplingFrequency, const size_t &fftLength, const size_t &numberOfBlocks, const size_t &compressionConstant);
    ~NoveltyCurveProcessor();
    std::vector<float> spectrogramToNoveltyCurve(Spectrogram spectrogram) const;
};

#endif /* defined(__Tempogram__NoveltyCurve__) */