diff Spectrogram.h @ 7:21147df9cb2d

* Error when deleting Spectrogram object in Tempogram::getRemainingFeatures(). * Moved Spectrogram computation into own class.
author Carl Bussey <c.bussey@se10.qmul.ac.uk>
date Thu, 07 Aug 2014 16:21:21 +0100
parents
children be59b4a73f49
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Spectrogram.h	Thu Aug 07 16:21:21 2014 +0100
@@ -0,0 +1,33 @@
+//
+//  Spectrogram.h
+//  Tempogram
+//
+//  Created by Carl Bussey on 07/08/2014.
+//  Copyright (c) 2014 Carl Bussey. All rights reserved.
+//
+
+#ifndef __Tempogram__Spectrogram__
+#define __Tempogram__Spectrogram__
+#include <vector>
+#include <vamp-sdk/FFT.h>
+#include <cmath>
+
+class Spectrogram{
+    int m_inputLength;
+    int m_fftLength;
+    int m_hopSize;
+    int m_numberOfOutputBins;
+    double * fftInput;
+    double * fftOutputReal;
+    double * fftOutputImag;
+    std::vector< std::vector <float> > spectrogramOutput;
+    
+    void initialise();
+    void cleanup();
+public:
+    std::vector< std::vector<float> > audioToMagnitudeSpectrogram(const float * const input, const float * window);
+    Spectrogram(unsigned int inputLength, unsigned int fftLength, unsigned int hopSize);
+    ~Spectrogram();
+};
+
+#endif /* defined(__Tempogram__Spectrogram__) */