comparison src/AudioAnalysis.h @ 1:ba2a17cf81bf

first working version of audio file loder. Loads bach clip from the apps->audio-file-loader->bin->data->sounds foler. Three classes: SoundFileLoader does the loading and parsing of thefile with libSndFile. audio samples are kept in AudioFile and analysis of features are kept in AudioAnalysis, at this stage just chromagramm and basic energy
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Sun, 04 Sep 2011 22:45:35 +0100
parents bcb0d40158f4
children
comparison
equal deleted inserted replaced
0:bcb0d40158f4 1:ba2a17cf81bf
17 #include "ChordDetect.h" 17 #include "ChordDetect.h"
18 #include "sndfile.h" 18 #include "sndfile.h"
19 #include "ofxFileDialogOSX.h" 19 #include "ofxFileDialogOSX.h"
20 #include "AudioFile.h" 20 #include "AudioFile.h"
21 21
22 #define FRAMESIZE 512
23 #define ENERGY_LENGTH 80000
24 #define CHROMA_LENGTH 12000
25 #define CHROMA_CONVERSION_FACTOR 16 //16 times as many frames in energy as in chroma
26
27
22 //this does a chromagram analysis and aubio onset analysis 28 //this does a chromagram analysis and aubio onset analysis
23 //held in double matrix and doubleVector respectively 29 //held in double matrix and doubleVector respectively
24 //these are dynamic vectors, so size set by what's needed for the file 30 //these are dynamic vectors, so size set by what's needed for the file
25 31
26 class AudioAnalysis{ 32 class AudioAnalysis{
27 33
28 public: 34 public:
35
36 AudioAnalysis();
37
38 typedef std::vector<double> DoubleVector;
39 typedef std::vector<DoubleVector> DoubleMatrix;
40
41 DoubleMatrix chromaMatrix;
42 // DoubleMatrix* matrixPtr;
43 DoubleVector energyVector;
44
45 AudioFile* audioHolder;
46 void loadNewAudio(string soundFileName);//??
47
48 Chromagram chromoGramm;
49 int currentPlayingFrame;
50
51 ChordDetect chord;
52
53 double getEnergyOfFrame();
54 int scrollWidth;
55 //int totalFrames;
56 void drawEnergyVectorFromPointer();
57 void drawSpectralDifference();
58
29 /* 59 /*
30 double getEnergyOfFrame(); 60 double getEnergyOfFrame();
31 // void putEnergyInFrame(); 61
32 62
33 void initialiseVariables(); 63 void initialiseVariables();
34 64
65
66 void initialiseVariables();
35 67
36 typedef std::vector<double> DoubleVector; 68
37 typedef std::vector<DoubleVector> DoubleMatrix; 69 AudioFile audioHolder;
70
71 void drawDoubleMatrix(DoubleMatrix* dMatrix);//DoubleMatrix* dMatrix); WOULD BE NICE TO USE POINTER BUT NOT WORKING YET
38 72
73
74 DoubleVector firstEnergyVector;
75
76 void drawEnergyVectorFromPointer(DoubleVector* energyVec);
77
78 void processAudioToDoubleMatrix(Chromagram* chromaG, DoubleMatrix* myDoubleMatrix, DoubleVector* energyVector);
79
80 void loadNewAudio(string soundFileName);
81
82
83
39 */ 84 */
40 85
41 86
42 }; 87 };
43 #endif 88 #endif