view src/SoundFileLoader.h @ 2:fa2af670b5c5 tip

SoundFileLoader might have moved
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Fri, 06 Jan 2012 00:23:26 +0000
parents
children
line wrap: on
line source
/*
 *  SoundFileLoader.h
 *  audioFileLoaderSVN1
 *
 *  Created by Andrew on 04/09/2011.
 *  Copyright 2011 QMUL. All rights reserved.
 *
 */

#ifndef SOUND_FILE_LOADER_H
#define SOUND_FILE_LOADER_H


#include "fftw3.h"
#include "ofMain.h"
#include "sndfile.h"
#include "AudioFile.h"
#include "AudioAnalysis.h"
#include "chromaGram.h"
#include "ChordDetect.h"

#define FRAMESIZE 512
#define ENERGY_LENGTH 80000
#define CHROMA_LENGTH 12000
#define CHROMA_CONVERSION_FACTOR 16 //16 times as many frames in energy as in chroma


//this does a chromagram analysis and aubio onset analysis
//held in double matrix and doubleVector respectively
//these are dynamic vectors, so size set by what's needed for the file

class SoundFileLoader{
	
public:
	SoundFileLoader();
	float frame[FRAMESIZE]; 
	
	void loadLibSndFile(const char *infilename);
	
	AudioFile audioHolder;
	AudioAnalysis chromaAnalysis;
	Chromagram chromoGramm;
	Chromagram* chromaG;
	
	typedef std::vector<double> DoubleVector;
	typedef std::vector<DoubleVector> DoubleMatrix;
	
	void processAudioToDoubleMatrix();
	double getEnergyOfFrame();
	
	int totalNumberOfFrames;
	
	SNDFILE *infile; // define input and output sound files
	SF_INFO sfinfo ; // struct to hold info about sound file

};
#endif