Mercurial > hg > vamp-tempogram
changeset 2:1d0b7dcea27f
Added manual setting of timestamps as wasn't working on both test machines.
author | Carl Bussey <c.bussey@se10.qmul.ac.uk> |
---|---|
date | Wed, 09 Jul 2014 14:32:32 +0100 |
parents | 3fd1a41b089b |
children | 5125d34fda67 |
files | Makefile Tempogram.cpp |
diffstat | 2 files changed, 23 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Wed Jul 09 10:26:51 2014 +0100 +++ b/Makefile Wed Jul 09 14:32:32 2014 +0100 @@ -38,7 +38,7 @@ ## Xcode 4 command-line tools. CXX := g++ -CXXFLAGS := -arch x86_64 -I$(VAMP_SDK_DIR) -Wall -fPIC +CXXFLAGS := -mmacosx-version-min=10.6 -arch x86_64 -I$(VAMP_SDK_DIR) -Wall -fPIC PLUGIN_EXT := .dylib LDFLAGS := $(CXXFLAGS) -dynamiclib -install_name $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) /usr/local/lib/libvamp-sdk.a -exported_symbols_list vamp-plugin.list @@ -97,7 +97,7 @@ $(PLUGIN_OBJECTS): $(PLUGIN_HEADERS) install: $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) - cp $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) /Library/Audio/Plug-Ins/Vamp + cp $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) ~/Library/Audio/Plug-Ins/Vamp clean: rm -f *.o *.dylib
--- a/Tempogram.cpp Wed Jul 09 10:26:51 2014 +0100 +++ b/Tempogram.cpp Wed Jul 09 14:32:32 2014 +0100 @@ -240,6 +240,18 @@ d.hasDuration = false; list.push_back(d); + d.identifier = "spect"; + d.name = "spect"; + d.description = "spect"; + d.unit = ""; + d.hasFixedBinCount = true; + d.binCount = m_blockSize/2; + d.hasKnownExtents = false; + d.isQuantized = false; + d.sampleType = OutputDescriptor::OneSamplePerStep; + d.hasDuration = false; + list.push_back(d); + return list; } @@ -274,11 +286,11 @@ const float *in = inputBuffers[0]; - //Calculate log magnitude float sum = 0; for (int i = 0; i < n; i++){ float magnitude = sqrt(in[2*i] * in[2*i] + in[2*i + 1] * in[2*i + 1]); - currentY[i] = log(1+compressionConstant*magnitude); //should be 1+C*magnitude + feature.values.push_back(magnitude); + currentY[i] = log(1+compressionConstant*magnitude); if(currentY[i] >= previousY[i]){ sum += (currentY[i] - previousY[i]); } @@ -289,10 +301,12 @@ float *tmpY = currentY; currentY = previousY; previousY = tmpY; + tmpY = NULL; ncTimestamps.push_back(timestamp); + featureSet[2].push_back(feature); - return FeatureSet(); + return featureSet; } void @@ -339,17 +353,18 @@ noveltyCurve[i] -= noveltyCurveLocalAverage[i]; noveltyCurve[i] = noveltyCurve[i] >= 0 ? noveltyCurve[i] : 0; Feature ncFeature; + ncFeature.hasTimestamp = true; + ncFeature.timestamp = ncTimestamps[i]; ncFeature.values.push_back(noveltyCurve[i]); featureSet[1].push_back(ncFeature); } - int i=0; WindowFunction::hanning(hannWindowtN, tN); + int timestampInc = floor((((float)ncTimestamps[1].nsec - ncTimestamps[0].nsec)/1e9)*(thopSize) + 0.5); + int i=0; int index; int frameBeginOffset = floor(tN/2 + 0.5); - int timestampInc = floor((((float)ncTimestamps[1].nsec - ncTimestamps[0].nsec)/1e9)*(thopSize) + 0.5); - //cout << timestampInc << endl; while(i < ncLength){ Feature feature;