annotate YinUtil.h @ 0:99bac62ee2da

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