# HG changeset patch # User mathieub # Date 1308592908 -3600 # Node ID 88f3cfcff55ff3660aafd15bb07925f87913c166 # Parent 70143b37bbe6498b01febf4dc7fa05af113fd385 A threshold (delta) is added in the peak picking parameters structure (PPickParams). It is used as an offset when computing the smoothed detection function. A constructor for the structure PPickParams is also added to set the parameters to 0 when a structure instance is created. Hence programmes using the peak picking parameter structure and which do not set the delta parameter (e.g. QM Vamp note onset detector) won't be affected by the modifications. Functions modified: - dsp/onsets/PeakPicking.cpp - dsp/onsets/PeakPicking.h - dsp/signalconditioning/DFProcess.cpp - dsp/signalconditioning/DFProcess.h diff -r 70143b37bbe6 -r 88f3cfcff55f dsp/onsets/PeakPicking.cpp --- a/dsp/onsets/PeakPicking.cpp Tue Apr 05 13:48:18 2011 +0100 +++ b/dsp/onsets/PeakPicking.cpp Mon Jun 20 19:01:48 2011 +0100 @@ -6,11 +6,19 @@ Centre for Digital Music, Queen Mary, University of London. This file 2005-2006 Christian Landone. + Modifications: + + - delta threshold + Description: add delta threshold used as offset in the smoothed + detection function + Author: Mathieu Barthet + Date: June 2010 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the file - COPYING included with this distribution for more information. + COPYING included with this distribution for more information. */ #include "PeakPicking.h" @@ -50,7 +58,8 @@ m_DFProcessingParams.winPost = Config.WinT.post; m_DFProcessingParams.AlphaNormParam = Config.alpha; m_DFProcessingParams.isMedianPositive = false; - + m_DFProcessingParams.Delta = Config.delta; //add the delta threshold as an adjustable parameter + m_DFSmoothing = new DFProcess( m_DFProcessingParams ); m_workBuffer = new double[ m_DFLength ]; diff -r 70143b37bbe6 -r 88f3cfcff55f dsp/onsets/PeakPicking.h --- a/dsp/onsets/PeakPicking.h Tue Apr 05 13:48:18 2011 +0100 +++ b/dsp/onsets/PeakPicking.h Mon Jun 20 19:01:48 2011 +0100 @@ -6,6 +6,14 @@ Centre for Digital Music, Queen Mary, University of London. This file 2005-2006 Christian Landone. + Modifications: + + - delta threshold + Description: add delta threshold used as offset in the smoothed + detection function + Author: Mathieu Barthet + Date: June 2010 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the @@ -29,6 +37,12 @@ { unsigned int pre; unsigned int post; + + PPWinThresh(unsigned int x, unsigned int y) : + pre(x), + post(y) + { + } }; struct QFitThresh @@ -36,12 +50,19 @@ double a; double b; double c; + + QFitThresh(double x, double y, double z) : + a(x), + b(y), + c(z) + { + } }; struct PPickParams { unsigned int length; //Detection FunctionLength - double tau; // time resolution of the detection function: + double tau; // time resolution of the detection function unsigned int alpha; //alpha-norm parameter double cutoff;//low-pass Filter cutoff freq unsigned int LPOrd; // low-pass Filter order @@ -49,6 +70,21 @@ double* LPBCoeffs; //low pass Filter num coefficients PPWinThresh WinT;//window size in frames for adaptive thresholding [pre post]: QFitThresh QuadThresh; + float delta; //delta threshold used as an offset when computing the smoothed detection function + + PPickParams() : + length(0), + tau(0), + alpha(0), + cutoff(0), + LPOrd(0), + LPACoeffs(NULL), + LPBCoeffs(NULL), + WinT(0,0), + QuadThresh(0,0,0), + delta(0) + { + } }; class PeakPicking diff -r 70143b37bbe6 -r 88f3cfcff55f dsp/signalconditioning/DFProcess.cpp --- a/dsp/signalconditioning/DFProcess.cpp Tue Apr 05 13:48:18 2011 +0100 +++ b/dsp/signalconditioning/DFProcess.cpp Mon Jun 20 19:01:48 2011 +0100 @@ -6,6 +6,14 @@ Centre for Digital Music, Queen Mary, University of London. This file 2005-2006 Christian Landone. + Modifications: + + - delta threshold + Description: add delta threshold used as offset in the smoothed + detection function + Author: Mathieu Barthet + Date: June 2010 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the @@ -57,7 +65,10 @@ m_FilterConfigParams.ACoeffs = Config.LPACoeffs; m_FilterConfigParams.BCoeffs = Config.LPBCoeffs; - m_FiltFilt = new FiltFilt( m_FilterConfigParams ); + m_FiltFilt = new FiltFilt( m_FilterConfigParams ); + + //add delta threshold + m_Delta = Config.Delta; } void DFProcess::deInitialise() @@ -146,7 +157,9 @@ for( i = 0; i < m_length; i++ ) { - val = src[ i ] - scratch[ i ];// - 0.033; + //add a delta threshold used as an offset when computing the smoothed detection function + //(helps to discard noise when detecting peaks) + val = src[ i ] - scratch[ i ] - m_Delta; if( m_isMedianPositive ) { diff -r 70143b37bbe6 -r 88f3cfcff55f dsp/signalconditioning/DFProcess.h --- a/dsp/signalconditioning/DFProcess.h Tue Apr 05 13:48:18 2011 +0100 +++ b/dsp/signalconditioning/DFProcess.h Mon Jun 20 19:01:48 2011 +0100 @@ -6,6 +6,14 @@ Centre for Digital Music, Queen Mary, University of London. This file 2005-2006 Christian Landone. + Modifications: + + - delta threshold + Description: add delta threshold used as offset in the smoothed + detection function + Author: Mathieu Barthet + Date: June 2010 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the @@ -28,6 +36,7 @@ unsigned int winPost; double AlphaNormParam; bool isMedianPositive; + float Delta; //delta threshold used as an offset when computing the smoothed detection function }; class DFProcess @@ -64,6 +73,7 @@ FiltFilt* m_FiltFilt; bool m_isMedianPositive; + float m_Delta; //add delta threshold }; #endif diff -r 70143b37bbe6 -r 88f3cfcff55f dsp/tempotracking/TempoTrack.h --- a/dsp/tempotracking/TempoTrack.h Tue Apr 05 13:48:18 2011 +0100 +++ b/dsp/tempotracking/TempoTrack.h Mon Jun 20 19:01:48 2011 +0100 @@ -5,11 +5,11 @@ Centre for Digital Music, Queen Mary, University of London. This file 2005-2006 Christian Landone. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. See the file + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file COPYING included with this distribution for more information. */ @@ -31,7 +31,7 @@ struct WinThresh { unsigned int pre; - unsigned int post; + unsigned int post; }; struct TTParams diff -r 70143b37bbe6 -r 88f3cfcff55f libqm-dsp.a Binary file libqm-dsp.a has changed diff -r 70143b37bbe6 -r 88f3cfcff55f qm-dsp.pro.user --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qm-dsp.pro.user Mon Jun 20 19:01:48 2011 +0100 @@ -0,0 +1,202 @@ + + + + RunConfiguration0-Arguments + + + + RunConfiguration0-BaseEnvironmentBase + 2 + + + RunConfiguration0-Executable + + + + RunConfiguration0-RunConfiguration.name + Custom Executable + + + RunConfiguration0-UseTerminal + false + + + RunConfiguration0-UserEnvironmentChanges + + + + RunConfiguration0-UserName + + + + RunConfiguration0-UserSetName + false + + + RunConfiguration0-WorkingDirectory + $BUILDDIR + + + RunConfiguration0-type + ProjectExplorer.CustomExecutableRunConfiguration + + + activeRunConfiguration + 0 + + + activebuildconfiguration + Debug + + + buildConfiguration-Debug + + Debug + 0 + 0 + 2 + + + + buildConfiguration-Release + + Release + 0 + 0 + + + + buildconfiguration-Debug-buildstep0 + + Debug + + Apple_PubSub_Socket_Render=/tmp/launch-CVQ5Yw/Render + COMMAND_MODE=unix2003 + DISPLAY=/tmp/launch-7rJXTo/:0 + HOME=/Users/mathieub + LOGNAME=mathieub + PATH=/Developer/Tools/Qt:/usr/bin:/bin:/usr/sbin:/sbin + QTDIR=/usr/local/Qt4.7 + SECURITYSESSIONID=82d590 + SHELL=/bin/bash + SSH_AUTH_SOCK=/tmp/launch-moi9U2/Listeners + TMPDIR=/var/folders/V7/V7hFV43NHuGIiTNXMruZKU+++TM/-Tmp-/ + USER=mathieub + __CF_USER_TEXT_ENCODING=0x1F6:0:0 + + + /Users/mathieub/Data/CODE/qm-dsp/qm-dsp.pro + -spec + macx-g++ + -r + + /usr/bin/qmake + false + /Users/mathieub/Data/CODE/qm-dsp + + + + buildconfiguration-Debug-buildstep1 + + Debug + + Apple_PubSub_Socket_Render=/tmp/launch-CVQ5Yw/Render + COMMAND_MODE=unix2003 + DISPLAY=/tmp/launch-7rJXTo/:0 + HOME=/Users/mathieub + LOGNAME=mathieub + PATH=/Developer/Tools/Qt:/usr/bin:/bin:/usr/sbin:/sbin + QTDIR=/usr/local/Qt4.7 + SECURITYSESSIONID=82d590 + SHELL=/bin/bash + SSH_AUTH_SOCK=/tmp/launch-moi9U2/Listeners + TMPDIR=/var/folders/V7/V7hFV43NHuGIiTNXMruZKU+++TM/-Tmp-/ + USER=mathieub + __CF_USER_TEXT_ENCODING=0x1F6:0:0 + + false + + -w + + /usr/bin/make + true + /Users/mathieub/Data/CODE/qm-dsp + + + + buildconfiguration-Debug-cleanstep0 + + Debug + true + + clean + + + + + buildconfiguration-Release-buildstep0 + + Release + + + + buildconfiguration-Release-buildstep1 + + Release + + + + buildconfiguration-Release-cleanstep0 + + Release + + + + buildconfigurations + + Debug + Release + + + + buildstep0 + + + + + + + buildstep1 + + + + + + buildsteps + + trolltech.qt4projectmanager.qmake + trolltech.qt4projectmanager.make + + + + cleanstep0 + + + true + + + + cleansteps + + trolltech.qt4projectmanager.make + + + + defaultFileEncoding + System + + + project + + + diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/BeatSpectrum.o Binary file tmp_obj/BeatSpectrum.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/ChangeDetectionFunction.o Binary file tmp_obj/ChangeDetectionFunction.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/Chromagram.o Binary file tmp_obj/Chromagram.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/ClusterMeltSegmenter.o Binary file tmp_obj/ClusterMeltSegmenter.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/ConstantQ.o Binary file tmp_obj/ConstantQ.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/Correlation.o Binary file tmp_obj/Correlation.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/CosineDistance.o Binary file tmp_obj/CosineDistance.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/DFProcess.o Binary file tmp_obj/DFProcess.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/Decimator.o Binary file tmp_obj/Decimator.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/DetectionFunction.o Binary file tmp_obj/DetectionFunction.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/DownBeat.o Binary file tmp_obj/DownBeat.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/FFT.o Binary file tmp_obj/FFT.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/FiltFilt.o Binary file tmp_obj/FiltFilt.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/Filter.o Binary file tmp_obj/Filter.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/Framer.o Binary file tmp_obj/Framer.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/GetKeyMode.o Binary file tmp_obj/GetKeyMode.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/KLDivergence.o Binary file tmp_obj/KLDivergence.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/MFCC.o Binary file tmp_obj/MFCC.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/MathUtilities.o Binary file tmp_obj/MathUtilities.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/PeakPicking.o Binary file tmp_obj/PeakPicking.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/PhaseVocoder.o Binary file tmp_obj/PhaseVocoder.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/Pitch.o Binary file tmp_obj/Pitch.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/Segmenter.o Binary file tmp_obj/Segmenter.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/TCSgram.o Binary file tmp_obj/TCSgram.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/TempoTrack.o Binary file tmp_obj/TempoTrack.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/TempoTrackV2.o Binary file tmp_obj/TempoTrackV2.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/Thread.o Binary file tmp_obj/Thread.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/TonalEstimator.o Binary file tmp_obj/TonalEstimator.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/Wavelet.o Binary file tmp_obj/Wavelet.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/cluster_melt.o Binary file tmp_obj/cluster_melt.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/cluster_segmenter.o Binary file tmp_obj/cluster_segmenter.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/hmm.o Binary file tmp_obj/hmm.o has changed diff -r 70143b37bbe6 -r 88f3cfcff55f tmp_obj/pca.o Binary file tmp_obj/pca.o has changed