30 #include "../piano/piano.h"
31 #include "../system/prerequisites.h"
32 #include "../math/fftadapter.h"
33 #include "../math/fftimplementation.h"
53 std::pair<FFTAnalyzerErrorTypes, std::shared_ptr<Key> >
analyse(
80 int findNearestKey (
double f,
double conertPitch,
int numberOfKeys,
int keyNumberOfA);
95 #endif // FFTANALYZER_H
~FFTAnalyzer()
Empty destructor.
double findAccuratePeakFrequency(FFTDataPointer fftData, double f, int cents=5)
Find the accurate frequency of a spectral peak in the original FFT.
FFTAnalyzer()
Constructor.
Key::PeakListType PeakListType
Type for a peak map.
std::vector< FFTComplexType > FFTComplexVector
SpectrumType mCurrentKernel
The current kernel for the key detection.
Class describing a single piano key.
TuningDeviationCurveType computeTuningDeviation(const SpectrumType &kernel, const SpectrumType &signal, int searchSize)
static const int NumberOfBins
Total number of slots: 9 octaves.
std::vector< double > TuningDeviationCurveType
The FrequencyDetectionResultStruct struct.
double getExpectedInharmonicity(double f)
Key::SpectrumType SpectrumType
Type of a log spectrum.
double estimateFrequencyShift()
PeakListType identifyPeaks(FFTDataPointer fftData, const SpectrumType &spectrum, const double f, const double B)
void Write(std::string filename, SpectrumType &v)
std::pair< FFTAnalyzerErrorTypes, std::shared_ptr< Key > > analyse(const Piano *piano, FFTDataPointer finalFFT, int finalKey)
Main analyzing function.
FFT_Implementation mFFT
Instance of FFT implementation.
std::vector< double > SpectrumType
Type of a log-binned spectrum.
int findNearestKey(double f, double conertPitch, int numberOfKeys, int keyNumberOfA)
Compute the number of the nearest key.
SpectrumType constructKernel(const SpectrumType &originalSpectrum)
FrequencyDetectionResult detectFrequencyOfKnownKey(FFTDataPointer finalFFT, const Piano *piano, const Key &key, int keyIndex)
FFTAnalyzer::detectFrequencyOfKnownKey.
Module performing the final analysis of the Fourier transform.
const Key * mCurrentKernelKey
The key of which mCurrentKernel belongs to.
int locatePeak(const SpectrumType &spectrum, int m, int width)
std::shared_ptr< FFTData > FFTDataPointer
Shared pointer of FFTData.
double interpolatePeakPosition(const SpectrumType &spectrum, int m, int width)
double estimateInharmonicity(FFTDataPointer fftData, SpectrumType &spectrum, double f)
Estimate the inharmonicity B.
std::map< double, double > PeakListType
Type for a peak map.
std::shared_ptr< FrequencyDetectionResultStruct > FrequencyDetectionResult
void constructLogBinnedSpectrum(FFTDataPointer fftData, SpectrumType &spectrum)
Construct logarithmically binned spectrum from the mFinalFFT.
double estimateFrequency(int keynumber, double concertPitch, int keyNumberOfA)
Estimate the frequency for a given keynumber.
void WritePeaks(std::string filename, SpectrumType &v, PeakListType &peaks)
Thread-safe implementation of fftw3.
SpectrumType mOptimalSuperposition
Superposition of the partials.