Mercurial > hg > qm-dsp
changeset 96:88f3cfcff55f
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
line wrap: on
line diff
--- 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 ];
--- 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
--- 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 ) {
--- 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
--- 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
--- /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 @@ +<!DOCTYPE QtCreatorProject> +<qtcreator> + <data> + <variable>RunConfiguration0-Arguments</variable> + <valuelist type="QVariantList"/> + </data> + <data> + <variable>RunConfiguration0-BaseEnvironmentBase</variable> + <value type="int">2</value> + </data> + <data> + <variable>RunConfiguration0-Executable</variable> + <value type="QString"></value> + </data> + <data> + <variable>RunConfiguration0-RunConfiguration.name</variable> + <value type="QString">Custom Executable</value> + </data> + <data> + <variable>RunConfiguration0-UseTerminal</variable> + <value type="bool">false</value> + </data> + <data> + <variable>RunConfiguration0-UserEnvironmentChanges</variable> + <valuelist type="QVariantList"/> + </data> + <data> + <variable>RunConfiguration0-UserName</variable> + <value type="QString"></value> + </data> + <data> + <variable>RunConfiguration0-UserSetName</variable> + <value type="bool">false</value> + </data> + <data> + <variable>RunConfiguration0-WorkingDirectory</variable> + <value type="QString">$BUILDDIR</value> + </data> + <data> + <variable>RunConfiguration0-type</variable> + <value type="QString">ProjectExplorer.CustomExecutableRunConfiguration</value> + </data> + <data> + <variable>activeRunConfiguration</variable> + <value type="int">0</value> + </data> + <data> + <variable>activebuildconfiguration</variable> + <value type="QString">Debug</value> + </data> + <data> + <variable>buildConfiguration-Debug</variable> + <valuemap type="QVariantMap"> + <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> + <value key="QtVersionId" type="int">0</value> + <value key="ToolChain" type="int">0</value> + <value key="buildConfiguration" type="int">2</value> + </valuemap> + </data> + <data> + <variable>buildConfiguration-Release</variable> + <valuemap type="QVariantMap"> + <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> + <value key="QtVersionId" type="int">0</value> + <value key="buildConfiguration" type="int">0</value> + </valuemap> + </data> + <data> + <variable>buildconfiguration-Debug-buildstep0</variable> + <valuemap type="QVariantMap"> + <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> + <valuelist key="abstractProcess.Environment" type="QVariantList"> + <value type="QString">Apple_PubSub_Socket_Render=/tmp/launch-CVQ5Yw/Render</value> + <value type="QString">COMMAND_MODE=unix2003</value> + <value type="QString">DISPLAY=/tmp/launch-7rJXTo/:0</value> + <value type="QString">HOME=/Users/mathieub</value> + <value type="QString">LOGNAME=mathieub</value> + <value type="QString">PATH=/Developer/Tools/Qt:/usr/bin:/bin:/usr/sbin:/sbin</value> + <value type="QString">QTDIR=/usr/local/Qt4.7</value> + <value type="QString">SECURITYSESSIONID=82d590</value> + <value type="QString">SHELL=/bin/bash</value> + <value type="QString">SSH_AUTH_SOCK=/tmp/launch-moi9U2/Listeners</value> + <value type="QString">TMPDIR=/var/folders/V7/V7hFV43NHuGIiTNXMruZKU+++TM/-Tmp-/</value> + <value type="QString">USER=mathieub</value> + <value type="QString">__CF_USER_TEXT_ENCODING=0x1F6:0:0</value> + </valuelist> + <valuelist key="abstractProcess.arguments" type="QVariantList"> + <value type="QString">/Users/mathieub/Data/CODE/qm-dsp/qm-dsp.pro</value> + <value type="QString">-spec</value> + <value type="QString">macx-g++</value> + <value type="QString">-r</value> + </valuelist> + <value key="abstractProcess.command" type="QString">/usr/bin/qmake</value> + <value key="abstractProcess.enabled" type="bool">false</value> + <value key="abstractProcess.workingDirectory" type="QString">/Users/mathieub/Data/CODE/qm-dsp</value> + </valuemap> + </data> + <data> + <variable>buildconfiguration-Debug-buildstep1</variable> + <valuemap type="QVariantMap"> + <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> + <valuelist key="abstractProcess.Environment" type="QVariantList"> + <value type="QString">Apple_PubSub_Socket_Render=/tmp/launch-CVQ5Yw/Render</value> + <value type="QString">COMMAND_MODE=unix2003</value> + <value type="QString">DISPLAY=/tmp/launch-7rJXTo/:0</value> + <value type="QString">HOME=/Users/mathieub</value> + <value type="QString">LOGNAME=mathieub</value> + <value type="QString">PATH=/Developer/Tools/Qt:/usr/bin:/bin:/usr/sbin:/sbin</value> + <value type="QString">QTDIR=/usr/local/Qt4.7</value> + <value type="QString">SECURITYSESSIONID=82d590</value> + <value type="QString">SHELL=/bin/bash</value> + <value type="QString">SSH_AUTH_SOCK=/tmp/launch-moi9U2/Listeners</value> + <value type="QString">TMPDIR=/var/folders/V7/V7hFV43NHuGIiTNXMruZKU+++TM/-Tmp-/</value> + <value type="QString">USER=mathieub</value> + <value type="QString">__CF_USER_TEXT_ENCODING=0x1F6:0:0</value> + </valuelist> + <value key="abstractProcess.IgnoreReturnValue" type="bool">false</value> + <valuelist key="abstractProcess.arguments" type="QVariantList"> + <value type="QString">-w</value> + </valuelist> + <value key="abstractProcess.command" type="QString">/usr/bin/make</value> + <value key="abstractProcess.enabled" type="bool">true</value> + <value key="abstractProcess.workingDirectory" type="QString">/Users/mathieub/Data/CODE/qm-dsp</value> + </valuemap> + </data> + <data> + <variable>buildconfiguration-Debug-cleanstep0</variable> + <valuemap type="QVariantMap"> + <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> + <value key="cleanConfig" type="bool">true</value> + <valuelist key="makeargs" type="QVariantList"> + <value type="QString">clean</value> + </valuelist> + </valuemap> + </data> + <data> + <variable>buildconfiguration-Release-buildstep0</variable> + <valuemap type="QVariantMap"> + <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> + </valuemap> + </data> + <data> + <variable>buildconfiguration-Release-buildstep1</variable> + <valuemap type="QVariantMap"> + <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> + </valuemap> + </data> + <data> + <variable>buildconfiguration-Release-cleanstep0</variable> + <valuemap type="QVariantMap"> + <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> + </valuemap> + </data> + <data> + <variable>buildconfigurations</variable> + <valuelist type="QVariantList"> + <value type="QString">Debug</value> + <value type="QString">Release</value> + </valuelist> + </data> + <data> + <variable>buildstep0</variable> + <valuemap type="QVariantMap"> + <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value> + <value key="mkspec" type="QString"></value> + </valuemap> + </data> + <data> + <variable>buildstep1</variable> + <valuemap type="QVariantMap"> + <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value> + </valuemap> + </data> + <data> + <variable>buildsteps</variable> + <valuelist type="QVariantList"> + <value type="QString">trolltech.qt4projectmanager.qmake</value> + <value type="QString">trolltech.qt4projectmanager.make</value> + </valuelist> + </data> + <data> + <variable>cleanstep0</variable> + <valuemap type="QVariantMap"> + <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value> + <value key="clean" type="bool">true</value> + </valuemap> + </data> + <data> + <variable>cleansteps</variable> + <valuelist type="QVariantList"> + <value type="QString">trolltech.qt4projectmanager.make</value> + </valuelist> + </data> + <data> + <variable>defaultFileEncoding</variable> + <value type="QByteArray">System</value> + </data> + <data> + <variable>project</variable> + <valuemap type="QVariantMap"/> + </data> +</qtcreator>