Mercurial > hg > pyin
comparison YinUtil.h @ 0:99bac62ee2da
added PYIN sources, should be compileable
author | matthiasm |
---|---|
date | Wed, 27 Nov 2013 11:59:49 +0000 |
parents | |
children | 5945b8905d1f |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:99bac62ee2da |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 /* | |
3 This file is Copyright (c) 2012 Chris Cannam | |
4 | |
5 Permission is hereby granted, free of charge, to any person | |
6 obtaining a copy of this software and associated documentation | |
7 files (the "Software"), to deal in the Software without | |
8 restriction, including without limitation the rights to use, copy, | |
9 modify, merge, publish, distribute, sublicense, and/or sell copies | |
10 of the Software, and to permit persons to whom the Software is | |
11 furnished to do so, subject to the following conditions: | |
12 | |
13 The above copyright notice and this permission notice shall be | |
14 included in all copies or substantial portions of the Software. | |
15 | |
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR | |
20 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
21 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
23 */ | |
24 | |
25 #ifndef _YINUTIL_H_ | |
26 #define _YINUTIL_H_ | |
27 | |
28 #include "vamp-sdk/FFT.h" | |
29 #include "MeanFilter.h" | |
30 | |
31 #include <cmath> | |
32 | |
33 #include <iostream> | |
34 #include <vector> | |
35 #include <exception> | |
36 | |
37 using std::vector; | |
38 | |
39 class YinUtil | |
40 { | |
41 public: | |
42 static double sumSquare(const double *in, const size_t startInd, const size_t endInd); | |
43 static void difference(const double *in, double *yinBuffer, const size_t yinBufferSize); | |
44 static void fastDifference(const double *in, double *yinBuffer, const size_t yinBufferSize); | |
45 static void cumulativeDifference(double *yinBuffer, const size_t yinBufferSize); | |
46 static int absoluteThreshold(const double *yinBuffer, const size_t yinBufferSize, const double thresh); | |
47 static vector<double> yinProb(const double *yinBuffer, const size_t prior, const size_t yinBufferSize); | |
48 static double parabolicInterpolation(const double *yinBuffer, const size_t tau, | |
49 const size_t yinBufferSize); | |
50 }; | |
51 | |
52 #endif |