Make an own class for AKF detector (tested for C2-B5)

This commit is contained in:
Flamefire committed 2014-03-30 01:32:25 +01:00
1 parent 4c597cb4f8
commit f1a885b95e
10 files changed
+259 -146

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
#pragma once
#include "performous/pitch.hh"
// A pitch detection that is based on the AKF and AMDF (initially from original Vocaluxe/USDx)
class PtAKF{
public:
PtAKF();
~PtAKF();
void input(short* begin, short* end){
_AnalysisBuf.insert(begin, end);
}
int GetNote(double* maxVolume, float* weights);
static int GetNumHalfTones(){ return _MaxHalfTone - _MinHalfTone + 1;}
private:
static int _InitCount;
static float* _SamplesPerPeriodPerTone;
static constexpr int _MinHalfTone = 0; //C2
static constexpr int _MaxHalfTone = 47; //B5
constexpr static size_t _SampleCt = 4096;
RingBuffer<_SampleCt * 2> _AnalysisBuf;
static int _GetNote(float* samples, double* maxVolume, float* weights);
static float _AnalyzeToneFunc(float* samples, int toneIndex);
};