annotate YinUtil.h @ 140:c2b426f4d841
vamp-fft-revision
size_t -> int, remove some unnecessary work: marginally quicker. Also remove meaningless const from pass-by-value args
author |
Chris Cannam |
date |
Fri, 19 Aug 2016 13:40:11 +0100 |
parents |
7cbf40306c10 |
children |
|
rev |
line source |
matthiasm@0
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@9
|
2
|
matthiasm@0
|
3 /*
|
Chris@9
|
4 pYIN - A fundamental frequency estimator for monophonic audio
|
Chris@9
|
5 Centre for Digital Music, Queen Mary, University of London.
|
Chris@9
|
6
|
Chris@9
|
7 This program is free software; you can redistribute it and/or
|
Chris@9
|
8 modify it under the terms of the GNU General Public License as
|
Chris@9
|
9 published by the Free Software Foundation; either version 2 of the
|
Chris@9
|
10 License, or (at your option) any later version. See the file
|
Chris@9
|
11 COPYING included with this distribution for more information.
|
matthiasm@0
|
12 */
|
matthiasm@0
|
13
|
matthiasm@0
|
14 #ifndef _YINUTIL_H_
|
matthiasm@0
|
15 #define _YINUTIL_H_
|
matthiasm@0
|
16
|
matthiasm@0
|
17 #include <cmath>
|
matthiasm@0
|
18
|
matthiasm@0
|
19 #include <iostream>
|
matthiasm@0
|
20 #include <vector>
|
matthiasm@0
|
21 #include <exception>
|
matthiasm@0
|
22
|
Chris@136
|
23 #include "vamp-sdk/FFT.h"
|
Chris@136
|
24
|
matthiasm@0
|
25 using std::vector;
|
matthiasm@0
|
26
|
matthiasm@0
|
27 class YinUtil
|
matthiasm@0
|
28 {
|
matthiasm@0
|
29 public:
|
Chris@140
|
30 YinUtil(int yinBufferSize);
|
Chris@136
|
31 ~YinUtil();
|
Chris@136
|
32
|
Chris@140
|
33 double sumSquare(const double *in, int startInd, int endInd);
|
Chris@136
|
34 void difference(const double *in, double *yinBuffer);
|
Chris@136
|
35 void fastDifference(const double *in, double *yinBuffer);
|
Chris@136
|
36 void slowDifference(const double *in, double *yinBuffer);
|
Chris@136
|
37 void cumulativeDifference(double *yinBuffer);
|
Chris@140
|
38 int absoluteThreshold(const double *yinBuffer, double thresh);
|
Chris@140
|
39 vector<double> yinProb(const double *yinBuffer, int prior,
|
Chris@140
|
40 int minTau = 0, int maxTau = 0);
|
Chris@140
|
41 double parabolicInterpolation(const double *yinBuffer, int tau);
|
Chris@136
|
42
|
Chris@136
|
43 private:
|
Chris@140
|
44 const int m_yinBufferSize;
|
Chris@136
|
45 Vamp::FFTReal m_fft;
|
matthiasm@0
|
46 };
|
matthiasm@0
|
47
|
matthiasm@0
|
48 #endif
|