annotate maths/MathAliases.h @ 73:dcb555b90924

* Key detector: when returning key strengths, use the peak value of the three underlying chromagram correlations (from 36-bin chromagram) corresponding to each key, instead of the mean. Rationale: This is the same method as used when returning the key value, and it's nice to have the same results in both returned value and plot. The peak performed better than the sum with a simple test set of triads, so it seems reasonable to change the plot to match the key output rather than the other way around. * FFT: kiss_fftr returns only the non-conjugate bins, synthesise the rest rather than leaving them (perhaps dangerously) undefined. Fixes an uninitialised data error in chromagram that could cause garbage results from key detector. * Constant Q: remove precalculated values again, I reckon they're not proving such a good tradeoff.
author cannam
date Fri, 05 Jun 2009 15:12:39 +0000
parents 5bec06ecc88a
children e5907ae6de17
rev   line source
cannam@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@0 2
cannam@0 3 /*
cannam@0 4 QM DSP Library
cannam@0 5
cannam@0 6 Centre for Digital Music, Queen Mary, University of London.
cannam@0 7 This file copyright 2005-2006 Christian Landone.
cannam@0 8 All rights reserved.
cannam@0 9 */
cannam@0 10
cannam@0 11 #ifndef MATHALIASES_H
cannam@0 12 #define MATHALIASES_H
cannam@0 13
cannam@0 14 #include <cmath>
cannam@0 15 #include <complex>
cannam@0 16
cannam@0 17 using namespace std;
cannam@0 18 typedef complex<double> ComplexData;
cannam@0 19
cannam@0 20
cannam@0 21 #ifndef PI
cannam@0 22 #define PI (3.14159265358979232846)
cannam@0 23 #endif
cannam@0 24
cannam@54 25 #define TWO_PI (2. * PI)
cannam@0 26
cannam@0 27 #define EPS 2.2204e-016
cannam@0 28
cannam@0 29 /* aliases to math.h functions */
cannam@0 30 #define EXP exp
cannam@0 31 #define COS cos
cannam@0 32 #define SIN sin
cannam@0 33 #define ABS fabs
cannam@0 34 #define POW powf
cannam@0 35 #define SQRT sqrtf
cannam@0 36 #define LOG10 log10f
cannam@0 37 #define LOG logf
cannam@0 38 #define FLOOR floorf
cannam@0 39 #define TRUNC truncf
cannam@0 40
cannam@0 41 /* aliases to complex.h functions */
cannam@0 42 /** sample = EXPC(complex) */
cannam@0 43 #define EXPC cexpf
cannam@0 44 /** complex = CEXPC(complex) */
cannam@0 45 #define CEXPC cexp
cannam@0 46 /** sample = ARGC(complex) */
cannam@0 47 #define ARGC cargf
cannam@0 48 /** sample = ABSC(complex) norm */
cannam@0 49 #define ABSC cabsf
cannam@0 50 /** sample = REAL(complex) */
cannam@0 51 #define REAL crealf
cannam@0 52 /** sample = IMAG(complex) */
cannam@0 53 #define IMAG cimagf
cannam@0 54
cannam@0 55 #endif