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"
33 Yin(size_t frameSize, size_t inputSampleRate, double thresh = 0.2, bool fast = true);
40 vector<double> salience;
41 vector<pair<double, double> > freqProb;
42 YinOutput() : f0(0), periodicity(0), rms(0),
43 salience(vector<double>(0)), freqProb(vector<pair<double, double> >(0)) { }
44 YinOutput(double _f, double _p, double _r) :
45 f0(_f), periodicity(_p), rms(_r),
46 salience(vector<double>(0)), freqProb(vector<pair<double, double> >(0)) { }
47 YinOutput(double _f, double _p, double _r, vector<double> _salience) :
48 f0(_f), periodicity(_p), rms(_r), salience(_salience),
49 freqProb(vector<pair<double, double> >(0)) { }
52 int setThreshold(double parameter);
53 int setThresholdDistr(float parameter);
54 int setFrameSize(size_t frameSize);
55 int setFast(bool fast);
56 // int setRemoveUnvoiced(bool frameSize);
57 YinOutput process(const double *in) const;
58 YinOutput processProbabilisticYin(const double *in) const;
61 mutable size_t m_frameSize;
62 mutable size_t m_inputSampleRate;
63 mutable double m_thresh;
64 mutable size_t m_threshDistr;
65 mutable size_t m_yinBufferSize;
67 // mutable bool m_removeUnvoiced;