Entropy Piano Tuner
1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
|
Class describing a single piano key. More...
#include <key.h>
Public Types | |
using | SpectrumType = std::vector< double > |
Type of a log-binned spectrum. More... | |
using | PeakListType = std::map< double, double > |
Type for a peak map. More... | |
Public Member Functions | |
Key () | |
Constructor. More... | |
~Key () | |
Destructor. More... | |
void | clear () |
Clear all data elements of the Key. More... | |
void | setSpectrum (const SpectrumType &s) |
Copy spectrum to mSpectrum. More... | |
const SpectrumType & | getSpectrum () const |
Get a read-only reference to mSpectrum. More... | |
SpectrumType & | getSpectrum () |
Get a read-write reference of mSpectrum. More... | |
void | setPeaks (const PeakListType &s) |
Copy map of peaks. More... | |
const PeakListType & | getPeaks () const |
Get a read-only reference to mPeaks. More... | |
PeakListType & | getPeaks () |
Get a read-write reference of mPeaks. More... | |
void | setRecordedFrequency (const double f) |
Set recorded frequency. More... | |
double | getRecordedFrequency () const |
Get recorded frequency. More... | |
double & | getRecordedFrequency () |
Get recorded frequency. More... | |
void | setMeasuredInharmonicity (double f) |
Set estimated inharmonicity. More... | |
double | getMeasuredInharmonicity () const |
Get estimated inharmonicity. More... | |
double & | getMeasuredInharmonicity () |
Get estimated inharmonicity. More... | |
void | setRecognitionQuality (double f) |
Set quality of recognition. More... | |
double | getRecognitionQuality () const |
Get quality of recognition. More... | |
double & | getRecognitionQuality () |
Get quality of recognition. More... | |
void | setComputedFrequency (double f) |
Set computed frequency. More... | |
double | getComputedFrequency () const |
Get computed frequency. More... | |
double & | getComputedFrequency () |
Get computed frequency. More... | |
void | setTunedFrequency (double f) |
Set tuned frequency. More... | |
double | getTunedFrequency () const |
Get tuned frequency. More... | |
double & | getTunedFrequency () |
Get tuned frequency. More... | |
void | setOverpull (double cents) |
Set overpull in cents. More... | |
double | getOverpull () const |
Get overpull in cents. More... | |
double & | getOverpull () |
Get overpull in cents. More... | |
void | setRecorded (bool r) |
Set recorded flag. More... | |
bool | isRecorded () const |
Get recorded flag. More... | |
bool & | isRecorded () |
Get recorded flag. More... | |
Static Public Member Functions | |
static int | FrequencyToIndex (double f) |
Convert frequency to logbin index. More... | |
static double | FrequencyToRealIndex (double f) |
Convert frequency to real-valued logbin index. More... | |
static double | IndexToFrequency (double m) |
Convert continuous slot index to frequency in Hz. More... | |
Static Public Attributes | |
static const int | NumberOfBins = 10800 |
Total number of slots: 9 octaves. More... | |
static const int | BinsPerOctave = 1200 |
Number of slots per ocatave (here 1 cent) More... | |
static const double | fmin = 20.601722 |
Mimimal frequency of logbinned spectrum in Hz. More... | |
Private Attributes | |
SpectrumType | mSpectrum |
Logarithmically organized spectrum. More... | |
PeakListType | mPeaks |
List of identified peaks. More... | |
double | mRecordedFrequency |
Recorded frequency of 1st partial in Hz. More... | |
double | mMeasuredInharmonicity |
Measured inharmonicity of recorded signal. More... | |
double | mRecognitionQuality |
Accuracy of higher partials (in cents) More... | |
double | mComputedFrequency |
Computed frequency in Hz (tuning curve) More... | |
double | mTunedFrequency |
Tuned frequency in Hz. More... | |
double | mOverpull |
Overpull in cents. More... | |
bool | mRecorded |
Is the key already recorded? More... | |
Class describing a single piano key.
This class holds all information related to an individual piano key of the keyboard. The most important element is the logarithmically binned power spectrum of the key (in short: logbin spectrum). In contrast to the ordinary FFT, which is linear in the frequency index, the logbin spectrum is a vector whose index is logarithmic in the frequency. The resolution is chosen in such a way that each vector component corresponds exactly to one cent (1/100 half tone).
In addition, the Key class comprises various member variables such as the mesured, the computed, and the tuned frequency.
using Key::PeakListType = std::map<double,double> |
using Key::SpectrumType = std::vector<double> |
|
inline |
|
static |
Convert frequency to logbin index.
Converts a frequency in Hz to the corresponding logbin index.
f | : Frequency in Hz in the range 0 < f < 20 kHz. |
Definition at line 88 of file key.cpp.
|
static |
Convert frequency to real-valued logbin index.
Converts a frequency in Hz to the corresponding logbin index. For reasons of invertibility this function returns a floating-point value. In order to get the actual logbin index the result of this function has to be rounded (not truncated) to an integer.
f | : Frequency in Hz in the range 0 < f < 20 kHz. |
double Key::getComputedFrequency | ( | ) | const |
double & Key::getComputedFrequency | ( | ) |
double Key::getMeasuredInharmonicity | ( | ) | const |
double & Key::getMeasuredInharmonicity | ( | ) |
const Key::PeakListType & Key::getPeaks | ( | ) | const |
Key::PeakListType & Key::getPeaks | ( | ) |
double Key::getRecognitionQuality | ( | ) | const |
double & Key::getRecognitionQuality | ( | ) |
double Key::getRecordedFrequency | ( | ) | const |
double & Key::getRecordedFrequency | ( | ) |
const Key::SpectrumType & Key::getSpectrum | ( | ) | const |
Key::SpectrumType & Key::getSpectrum | ( | ) |
double Key::getTunedFrequency | ( | ) | const |
|
static |
void Key::setComputedFrequency | ( | double | f | ) |
void Key::setMeasuredInharmonicity | ( | double | f | ) |
void Key::setOverpull | ( | double | cents | ) |
void Key::setPeaks | ( | const PeakListType & | s | ) |
void Key::setRecognitionQuality | ( | double | f | ) |
void Key::setRecordedFrequency | ( | const double | f | ) |
void Key::setSpectrum | ( | const SpectrumType & | s | ) |
void Key::setTunedFrequency | ( | double | f | ) |
|
static |
|
static |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
static |