Mercurial > hg > audio-file-loader
annotate 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 |
rev | line source |
---|---|
andrew@2 | 1 /* |
andrew@2 | 2 * SoundFileLoader.h |
andrew@2 | 3 * audioFileLoaderSVN1 |
andrew@2 | 4 * |
andrew@2 | 5 * Created by Andrew on 04/09/2011. |
andrew@2 | 6 * Copyright 2011 QMUL. All rights reserved. |
andrew@2 | 7 * |
andrew@2 | 8 */ |
andrew@2 | 9 |
andrew@2 | 10 #ifndef SOUND_FILE_LOADER_H |
andrew@2 | 11 #define SOUND_FILE_LOADER_H |
andrew@2 | 12 |
andrew@2 | 13 |
andrew@2 | 14 #include "fftw3.h" |
andrew@2 | 15 #include "ofMain.h" |
andrew@2 | 16 #include "sndfile.h" |
andrew@2 | 17 #include "AudioFile.h" |
andrew@2 | 18 #include "AudioAnalysis.h" |
andrew@2 | 19 #include "chromaGram.h" |
andrew@2 | 20 #include "ChordDetect.h" |
andrew@2 | 21 |
andrew@2 | 22 #define FRAMESIZE 512 |
andrew@2 | 23 #define ENERGY_LENGTH 80000 |
andrew@2 | 24 #define CHROMA_LENGTH 12000 |
andrew@2 | 25 #define CHROMA_CONVERSION_FACTOR 16 //16 times as many frames in energy as in chroma |
andrew@2 | 26 |
andrew@2 | 27 |
andrew@2 | 28 //this does a chromagram analysis and aubio onset analysis |
andrew@2 | 29 //held in double matrix and doubleVector respectively |
andrew@2 | 30 //these are dynamic vectors, so size set by what's needed for the file |
andrew@2 | 31 |
andrew@2 | 32 class SoundFileLoader{ |
andrew@2 | 33 |
andrew@2 | 34 public: |
andrew@2 | 35 SoundFileLoader(); |
andrew@2 | 36 float frame[FRAMESIZE]; |
andrew@2 | 37 |
andrew@2 | 38 void loadLibSndFile(const char *infilename); |
andrew@2 | 39 |
andrew@2 | 40 AudioFile audioHolder; |
andrew@2 | 41 AudioAnalysis chromaAnalysis; |
andrew@2 | 42 Chromagram chromoGramm; |
andrew@2 | 43 Chromagram* chromaG; |
andrew@2 | 44 |
andrew@2 | 45 typedef std::vector<double> DoubleVector; |
andrew@2 | 46 typedef std::vector<DoubleVector> DoubleMatrix; |
andrew@2 | 47 |
andrew@2 | 48 void processAudioToDoubleMatrix(); |
andrew@2 | 49 double getEnergyOfFrame(); |
andrew@2 | 50 |
andrew@2 | 51 int totalNumberOfFrames; |
andrew@2 | 52 |
andrew@2 | 53 SNDFILE *infile; // define input and output sound files |
andrew@2 | 54 SF_INFO sfinfo ; // struct to hold info about sound file |
andrew@2 | 55 |
andrew@2 | 56 }; |
andrew@2 | 57 #endif |