Mercurial > hg > vamp-tempogram
changeset 51:c7cc649dc9b6
* I had made further changes to previous revisions accidentally. Now should wor.
author | Carl Bussey <c.bussey@se10.qmul.ac.uk> |
---|---|
date | Tue, 30 Sep 2014 16:19:31 +0100 |
parents | 45ba1627d802 |
children | eff9dc53de62 |
files | TempogramPlugin.cpp |
diffstat | 1 files changed, 30 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/TempogramPlugin.cpp Tue Sep 30 15:00:23 2014 +0100 +++ b/TempogramPlugin.cpp Tue Sep 30 16:19:31 2014 +0100 @@ -239,6 +239,18 @@ d8.isQuantized = true; d8.quantizeStep = 1; list.push_back(d8); + + ParameterDescriptor d9; + d8.identifier = "refBPM"; + d8.name = "Cyclic Tempogram Reference Tempo"; + d8.description = "The reference tempo used when calculating the Cyclic Tempogram parameter \'s\'."; + d8.unit = ""; + d8.minValue = 5; + d8.maxValue = 60; + d8.defaultValue = 30; + d8.isQuantized = true; + d8.quantizeStep = 1; + list.push_back(d8); return list; } @@ -270,6 +282,9 @@ else if (identifier == "octDiv"){ return m_cyclicTempogramOctaveDivider; } + else if (identifier == "refBPM"){ + return m_cyclicTempogramReferenceBPM; + } return 0; } @@ -302,6 +317,9 @@ else if (identifier == "octDiv"){ m_cyclicTempogramOctaveDivider = value; } + else if (identifier == "refBPM"){ + m_cyclicTempogramReferenceBPM = value; + } } @@ -349,6 +367,18 @@ d1.sampleType = OutputDescriptor::FixedSampleRate; d_sampleRate = tempogramInputSampleRate/m_tempogramHopSize; d1.sampleRate = d_sampleRate > 0.0 && !isnan(d_sampleRate) ? d_sampleRate : 0; + vector< vector <unsigned int> > logBins = calculateTempogramNearestNeighbourLogBins(); + if (!logBins.empty()){ + float scale = pow(2,floor(60/logBins[0][0])); + + cerr << m_cyclicTempogramOctaveDivider << endl; + for(int i = 0; i < m_cyclicTempogramNumberOfOctaves; i++){ + float s = fmod(binToBPM(logBins[0][i]), m_cyclicTempogramReferenceBPM)*scale; + d1.binNames.push_back(floatToString(s)); + cerr << i << endl; + //cerr << m_cyclicTempogramOctaveDivider << " " << s << endl; + } + } d1.hasDuration = false; list.push_back(d1);