1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
4 pYIN - A fundamental frequency estimator for monophonic audio
5 Centre for Digital Music, Queen Mary, University of London.
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version. See the file
11 COPYING included with this distribution for more information.
17 #include "vamp-sdk/FFT.h"
18 #include "MeanFilter.h"
34 Yin(size_t frameSize, size_t inputSampleRate, double thresh = 0.2, bool fast = true);
41 vector<double> salience;
42 vector<pair<double, double> > freqProb;
43 YinOutput() : f0(0), periodicity(0), rms(0),
44 salience(vector<double>(0)), freqProb(vector<pair<double, double> >(0)) { }
45 YinOutput(double _f, double _p, double _r) :
46 f0(_f), periodicity(_p), rms(_r),
47 salience(vector<double>(0)), freqProb(vector<pair<double, double> >(0)) { }
48 YinOutput(double _f, double _p, double _r, vector<double> _salience) :
49 f0(_f), periodicity(_p), rms(_r), salience(_salience),
50 freqProb(vector<pair<double, double> >(0)) { }
53 int setThreshold(double parameter);
54 int setThresholdDistr(float parameter);
55 int setFrameSize(size_t frameSize);
56 int setFast(bool fast);
57 // int setRemoveUnvoiced(bool frameSize);
58 YinOutput process(const double *in) const;
59 YinOutput processProbabilisticYin(const double *in) const;
62 mutable size_t m_frameSize;
63 mutable size_t m_inputSampleRate;
64 mutable double m_thresh;
65 mutable size_t m_threshDistr;
66 mutable size_t m_yinBufferSize;
68 // mutable bool m_removeUnvoiced;