Sign in
Register
Home
Projects
Help
Search
:
QM-DSP
Overview
Members
Activity
Roadmap
Issues
Downloads
Repository
Code docs
qm-dsp
1.8
Main Page
Classes
Files
File List
File Members
dsp
onsets
DetectionFunction.h
Go to the documentation of this file.
1
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3
/*
4
QM DSP Library
5
6
Centre for Digital Music, Queen Mary, University of London.
7
This file 2005-2006 Christian Landone.
8
9
This program is free software; you can redistribute it and/or
10
modify it under the terms of the GNU General Public License as
11
published by the Free Software Foundation; either version 2 of the
12
License, or (at your option) any later version. See the file
13
COPYING included with this distribution for more information.
14
*/
15
16
#ifndef QM_DSP_DETECTIONFUNCTION_H
17
#define QM_DSP_DETECTIONFUNCTION_H
18
19
#include "
maths/MathUtilities.h
"
20
#include "
maths/MathAliases.h
"
21
#include "
dsp/phasevocoder/PhaseVocoder.h
"
22
#include "
base/Window.h
"
23
24
#define DF_HFC (1)
25
#define DF_SPECDIFF (2)
26
#define DF_PHASEDEV (3)
27
#define DF_COMPLEXSD (4)
28
#define DF_BROADBAND (5)
29
30
struct
DFConfig
{
31
int
stepSize
;
// DF step in samples
32
int
frameLength
;
// DF analysis window - usually 2*step. Must be even!
33
int
DFType
;
// type of detection function ( see defines )
34
double
dbRise
;
// only used for broadband df (and required for it)
35
bool
adaptiveWhitening
;
// perform adaptive whitening
36
double
whiteningRelaxCoeff
;
// if < 0, a sensible default will be used
37
double
whiteningFloor
;
// if < 0, a sensible default will be used
38
};
39
40
class
DetectionFunction
41
{
42
public
:
43
double
* getSpectrumMagnitude();
44
DetectionFunction
(
DFConfig
config );
45
virtual
~
DetectionFunction
();
46
51
double
processTimeDomain(
const
double
* samples);
52
57
double
processFrequencyDomain(
const
double
* reals,
const
double
* imags);
58
59
private
:
60
void
whiten();
61
double
runDF();
62
63
double
HFC(
int
length,
double
* src);
64
double
specDiff(
int
length,
double
* src);
65
double
phaseDev(
int
length,
double
*srcPhase);
66
double
complexSD(
int
length,
double
*srcMagnitude,
double
*srcPhase);
67
double
broadband(
int
length,
double
*srcMagnitude);
68
69
private
:
70
void
initialise(
DFConfig
Config );
71
void
deInitialise();
72
73
int
m_DFType
;
74
int
m_dataLength
;
75
int
m_halfLength
;
76
int
m_stepSize
;
77
double
m_dbRise
;
78
bool
m_whiten
;
79
double
m_whitenRelaxCoeff
;
80
double
m_whitenFloor
;
81
82
double
*
m_magHistory
;
83
double
*
m_phaseHistory
;
84
double
*
m_phaseHistoryOld
;
85
double
*
m_magPeaks
;
86
87
double
*
m_windowed
;
// Array for windowed analysis frame
88
double
*
m_magnitude
;
// Magnitude of analysis frame ( frequency domain )
89
double
*
m_thetaAngle
;
// Phase of analysis frame ( frequency domain )
90
double
*
m_unwrapped
;
// Unwrapped phase of analysis frame
91
92
Window<double>
*
m_window
;
93
PhaseVocoder
*
m_phaseVoc
;
// Phase Vocoder
94
};
95
96
#endif
DetectionFunction::m_halfLength
int m_halfLength
Definition:
DetectionFunction.h:75
DetectionFunction::m_magPeaks
double * m_magPeaks
Definition:
DetectionFunction.h:85
DFConfig::whiteningFloor
double whiteningFloor
Definition:
DetectionFunction.h:37
DetectionFunction::m_window
Window< double > * m_window
Definition:
DetectionFunction.h:92
PhaseVocoder.h
Window< double >
DFConfig::adaptiveWhitening
bool adaptiveWhitening
Definition:
DetectionFunction.h:35
DFConfig::dbRise
double dbRise
Definition:
DetectionFunction.h:34
DetectionFunction::m_dataLength
int m_dataLength
Definition:
DetectionFunction.h:74
DetectionFunction
Definition:
DetectionFunction.h:40
DetectionFunction::m_magHistory
double * m_magHistory
Definition:
DetectionFunction.h:82
DetectionFunction::m_phaseVoc
PhaseVocoder * m_phaseVoc
Definition:
DetectionFunction.h:93
DetectionFunction::m_windowed
double * m_windowed
Definition:
DetectionFunction.h:87
DetectionFunction::m_whitenRelaxCoeff
double m_whitenRelaxCoeff
Definition:
DetectionFunction.h:79
MathUtilities.h
DFConfig::DFType
int DFType
Definition:
DetectionFunction.h:33
DetectionFunction::m_whitenFloor
double m_whitenFloor
Definition:
DetectionFunction.h:80
DFConfig
Definition:
DetectionFunction.h:30
DetectionFunction::m_magnitude
double * m_magnitude
Definition:
DetectionFunction.h:88
PhaseVocoder
Definition:
PhaseVocoder.h:21
DFConfig::whiteningRelaxCoeff
double whiteningRelaxCoeff
Definition:
DetectionFunction.h:36
DetectionFunction::m_thetaAngle
double * m_thetaAngle
Definition:
DetectionFunction.h:89
DetectionFunction::m_stepSize
int m_stepSize
Definition:
DetectionFunction.h:76
DetectionFunction::m_DFType
int m_DFType
Definition:
DetectionFunction.h:73
DetectionFunction::m_dbRise
double m_dbRise
Definition:
DetectionFunction.h:77
DetectionFunction::m_whiten
bool m_whiten
Definition:
DetectionFunction.h:78
DetectionFunction::m_phaseHistoryOld
double * m_phaseHistoryOld
Definition:
DetectionFunction.h:84
MathAliases.h
DFConfig::frameLength
int frameLength
Definition:
DetectionFunction.h:32
DFConfig::stepSize
int stepSize
Definition:
DetectionFunction.h:31
Window.h
DetectionFunction::m_phaseHistory
double * m_phaseHistory
Definition:
DetectionFunction.h:83
DetectionFunction::m_unwrapped
double * m_unwrapped
Definition:
DetectionFunction.h:90
Generated by
1.8.11
Loading...