Mercurial > hg > audio-time-warp
comparison src/testApp.h @ 5:0d51e93bfe74
some work in improving the efficiency of doing chroma and onset analysis ahs been made - don't need to recalculate the chroma comparison each time
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Wed, 20 Jul 2011 12:06:45 +0100 |
parents | f40577e6b30d |
children | b9d05eb35488 |
comparison
equal
deleted
inserted
replaced
4:f40577e6b30d | 5:0d51e93bfe74 |
---|---|
42 | 42 |
43 void audioRequested (float * input, int bufferSize, int nChannels); | 43 void audioRequested (float * input, int bufferSize, int nChannels); |
44 void loadSndfile(); | 44 void loadSndfile(); |
45 //double getEnergyOfFrame(); | 45 //double getEnergyOfFrame(); |
46 | 46 |
47 | 47 void drawAlignmentmeasureValues(const int& startingYframe); |
48 void drawChromoGram(); | 48 void drawChromoGram(); |
49 | 49 |
50 void loadFirstAudioFile(); | 50 void loadFirstAudioFile(); |
51 void initialiseVariables(); | 51 void initialiseVariables(); |
52 | 52 |
53 void calculateSimilarityAndAlignment(); | 53 void calculateSimilarityAndAlignment(); |
54 | 54 |
55 typedef std::vector<double> DoubleVector; | 55 typedef std::vector<double> DoubleVector; |
56 typedef std::vector<DoubleVector> DoubleMatrix; | 56 typedef std::vector<DoubleVector> DoubleMatrix; |
57 | |
58 typedef std::vector<int> IntVector; | |
59 typedef std::vector<IntVector> IntMatrix; | |
57 | 60 |
58 // DoubleMatrix chromaMatrix; | 61 // DoubleMatrix chromaMatrix; |
59 // DoubleMatrix secondMatrix; | 62 // DoubleMatrix secondMatrix; |
60 DoubleMatrix* matrixPtr; | 63 DoubleMatrix* matrixPtr; |
61 | 64 |
71 | 74 |
72 bool drawSimilarity; | 75 bool drawSimilarity; |
73 void drawSimilarityMatrix(); | 76 void drawSimilarityMatrix(); |
74 void printSimilarityMatrix(int sizeToPrint); | 77 void printSimilarityMatrix(int sizeToPrint); |
75 | 78 |
79 | |
80 void drawChromaSimilarityMatrix(); | |
81 | |
76 // DoubleMatrix alignmentMeasureMatrix; | 82 // DoubleMatrix alignmentMeasureMatrix; |
77 | 83 |
78 // DoubleVector minimumAlignmentPath; | 84 // DoubleVector minimumAlignmentPath; |
79 | 85 |
80 void drawAlignmentPath(int startingChromaXFrame, int startingChromaYFrame); | 86 void drawAlignmentPath(int startingChromaXFrame, int startingChromaYFrame, IntMatrix* backPath); |
81 void drawForwardsAlignmentPath(int startingChromaXFrame, int startingChromaYFrame); | 87 void drawForwardsAlignmentPath(int startingChromaXFrame, int startingChromaYFrame); |
82 int findStartWidthFrame(); | 88 int findStartWidthFrame(); |
83 | 89 |
84 void printScoreForRow(int row, int max); | 90 void printScoreForRow(int row, int max); |
85 | 91 |
86 int numberOfScrollWidthsForFirstFile; | 92 int numberOfScrollWidthsForFirstFile; |
87 int numberOfScrollWidthsForSecondFile; | 93 int numberOfScrollWidthsForSecondFile; |
88 | 94 |
89 void checkIfAudioPositionExceedsWidthForFirstFile(); | 95 void checkIfAudioPositionExceedsWidthForFirstFile(); |
90 | 96 |
91 typedef std::vector<int> IntVector; | |
92 typedef std::vector<IntVector> IntMatrix; | |
93 | 97 |
94 // IntMatrix backwardsAlignmentPath; | 98 // IntMatrix backwardsAlignmentPath; |
95 int backwardsAlignmentIndex;//used for drawing the path | 99 int backwardsAlignmentIndex;//used for drawing the path |
96 | 100 |
97 void updateAlignmentPathIndex(int idenifier); | 101 void updateAlignmentPathIndex(int idenifier); |
112 int findMinimumOfVector(DoubleVector *d); | 116 int findMinimumOfVector(DoubleVector *d); |
113 void swapBetweenPlayingFilesUsingAlignmentMatch(); | 117 void swapBetweenPlayingFilesUsingAlignmentMatch(); |
114 int findMatchFromAlignment(bool whichFileToTest); | 118 int findMatchFromAlignment(bool whichFileToTest); |
115 | 119 |
116 void drawEnergyVectorFromPointer(DoubleVector* energyVec); | 120 void drawEnergyVectorFromPointer(DoubleVector* energyVec); |
121 void drawForwardsAlignmentPathOnChromaSimilarity(const int& startingXFrame, const int& startingYFrame); | |
117 | 122 |
118 void processAudioToDoubleMatrix(DoubleMatrix* myDoubleMatrix, DoubleVector* energyVector); | 123 void processAudioToDoubleMatrix(DoubleMatrix* myDoubleMatrix, DoubleVector* energyVector); |
119 | 124 |
120 void loadNewAudio(string soundFileName); | 125 void loadNewAudio(string soundFileName); |
121 void loadSecondAudio(string soundFileName); | 126 void loadSecondAudio(string soundFileName); |
190 ChordDetect chord; | 195 ChordDetect chord; |
191 //sndfile part | 196 //sndfile part |
192 SNDFILE *infile; // define input and output sound files | 197 SNDFILE *infile; // define input and output sound files |
193 SF_INFO sfinfo ; // struct to hold info about sound file | 198 SF_INFO sfinfo ; // struct to hold info about sound file |
194 | 199 |
195 int chromaConversionRatio;//not needed but could be useful | 200 float chromaConversionRatio;//not needed but could be useful |
196 TimeWarp tw; | 201 TimeWarp tw; |
197 Chromagram chromaG; | 202 Chromagram chromaG; |
198 OnsetDetectionFunction* onset; | 203 OnsetDetectionFunction* onset; |
199 | 204 |
200 int conversionFactor; | 205 int conversionFactor; |