Entropy Piano Tuner  1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Piano Class Reference

#include <piano.h>

+ Collaboration diagram for Piano:

Public Types

using Keys = std::vector< Key >
 

Public Member Functions

 Piano ()
 Constructor of the piano, initializing the member variables. More...
 
 ~Piano ()
 
void setName (const std::string &name)
 
const std::string & getName () const
 
void setType (piano::PianoType type)
 
piano::PianoType getPianoType () const
 
piano::PianoTypegetPianoType ()
 
void setSerialNumber (const std::string &number)
 
const std::string & getSerialNumber () const
 
void setManufactureYear (const std::string &year)
 
const std::string & getManufactionYear () const
 
void setManufactureLocation (const std::string &loc)
 
const std::string & getManufactionLocation () const
 
void setTuningLocation (const std::string &loc)
 
const std::string & getTuningLocation () const
 
void setTuningTime (const std::string &time)
 
void setTuningTimeToActualTime ()
 This function resets the tuning time to the actual time. This is used as default value. More...
 
const std::string & getTuningTime () const
 
void setConcertPitch (double pitch)
 
const double & getConcertPitch () const
 
double & getConcertPitch ()
 
const KeyboardgetKeyboard () const
 
KeyboardgetKeyboard ()
 
const KeygetKey (int i) const
 
KeygetKey (int i)
 
const KeygetKeyPtr (int i) const
 
KeygetKeyPtr (int i)
 
void setKey (int i, const Key &key)
 
double getExpectedInharmonicity (double f) const
 Compute expected approximative inharmonicity. More...
 
double getEqualTempFrequency (int keynumber, double cents=0, double A4=0) const
 Function returning the equal temperament. More...
 
double getDefiningTempFrequency (int keynumber, double cents=0, double A4=0) const
 Compute the defining temperatent. More...
 

Static Public Attributes

static const int DEFAULT_NUMBER_OF_KEYS = 88
 
static const int DEFAULT_KEY_NUMBER_OF_A = 48
 
static const int DEFAULT_KEYS_ON_BASS_BRIDGE = 28
 
static const double DEFAULT_CONCERT_PITCH = 440
 default concert pitch of A More...
 

Private Attributes

std::string mName
 name of the real piano More...
 
piano::PianoType mType
 type of the real piano More...
 
std::string mSerialNumber
 serial number of the real piano More...
 
std::string mManufactureYear
 manufaction year of the real piano More...
 
std::string mManufactureLocation
 location where the piano was produced More...
 
std::string mTuningLocation
 location where the piano is now More...
 
std::string mTuningTime
 time when the tuning hast been started (format yyyy-mm-dd HH:MM:SS, UTC) More...
 
double mConcertPitch
 concert pitch (default 440 Hz) More...
 
Keyboard mKeyboard
 the keyboard More...
 

Detailed Description

Definition at line 40 of file piano.h.

Member Typedef Documentation

using Piano::Keys = std::vector<Key>

Definition at line 52 of file piano.h.

Constructor & Destructor Documentation

Piano::Piano ( )

Constructor of the piano, initializing the member variables.

Definition at line 45 of file piano.cpp.

+ Here is the call graph for this function:

Piano::~Piano ( )
inline

Definition at line 50 of file piano.h.

Member Function Documentation

const double& Piano::getConcertPitch ( ) const
inline

Definition at line 80 of file piano.h.

double& Piano::getConcertPitch ( )
inline

Definition at line 81 of file piano.h.

double Piano::getDefiningTempFrequency ( int  keynumber,
double  cents = 0,
double  A4 = 0 
) const

Compute the defining temperatent.

This function provides the defining temperament on which the tuning process takes place. At the moment non-standard temperaments are not yet implemented, instead the function simply returns the equal temperamtne (ET). By defining this function, we prepare ourselves for a possible extension.

Parameters
keynumber: key number
cents: additional shift in cents
Returns
Frequency f1 without inharmonicity and stretch

Definition at line 148 of file piano.cpp.

+ Here is the call graph for this function:

double Piano::getEqualTempFrequency ( int  keynumber,
double  cents = 0,
double  A4 = 0 
) const

Function returning the equal temperament.

This function computes the theoretical frequency of a given key according to equal temperament (ET), optionally shifted by a given number of cents.

Parameters
keynumber: the index of the key on the piano keyboard
cents: additional cents in cents
A4: Frequency of A4 (replaced by mConcerPitch if zero by default)
Returns
Equal temperament frequency

Definition at line 123 of file piano.cpp.

+ Here is the call graph for this function:

double Piano::getExpectedInharmonicity ( double  f) const

Compute expected approximative inharmonicity.

This function provides a rough estimate of the expected inharmonicity coefficient for an average upright. It is used to improve the expectation where the spectral lines should reside in the spectrum.

TODO: This could be depending on the piano type.

Parameters
f: frequency in Hz
Returns
Inharmonicity coefficient B

Definition at line 102 of file piano.cpp.

const Key& Piano::getKey ( int  i) const
inline

Definition at line 86 of file piano.h.

Key& Piano::getKey ( int  i)
inline

Definition at line 87 of file piano.h.

const Keyboard& Piano::getKeyboard ( ) const
inline

Definition at line 83 of file piano.h.

Keyboard& Piano::getKeyboard ( )
inline

Definition at line 84 of file piano.h.

const Key* Piano::getKeyPtr ( int  i) const
inline

Definition at line 88 of file piano.h.

Key* Piano::getKeyPtr ( int  i)
inline

Definition at line 89 of file piano.h.

const std::string& Piano::getManufactionLocation ( ) const
inline

Definition at line 70 of file piano.h.

const std::string& Piano::getManufactionYear ( ) const
inline

Definition at line 67 of file piano.h.

const std::string& Piano::getName ( ) const
inline

Definition at line 57 of file piano.h.

piano::PianoType Piano::getPianoType ( ) const
inline

Definition at line 60 of file piano.h.

piano::PianoType& Piano::getPianoType ( )
inline

Definition at line 61 of file piano.h.

const std::string& Piano::getSerialNumber ( ) const
inline

Definition at line 64 of file piano.h.

const std::string& Piano::getTuningLocation ( ) const
inline

Definition at line 73 of file piano.h.

const std::string& Piano::getTuningTime ( ) const
inline

Definition at line 77 of file piano.h.

void Piano::setConcertPitch ( double  pitch)
inline

Definition at line 79 of file piano.h.

void Piano::setKey ( int  i,
const Key key 
)
inline

Definition at line 91 of file piano.h.

void Piano::setManufactureLocation ( const std::string &  loc)
inline

Definition at line 69 of file piano.h.

void Piano::setManufactureYear ( const std::string &  year)
inline

Definition at line 66 of file piano.h.

void Piano::setName ( const std::string &  name)
inline

Definition at line 56 of file piano.h.

void Piano::setSerialNumber ( const std::string &  number)
inline

Definition at line 63 of file piano.h.

void Piano::setTuningLocation ( const std::string &  loc)
inline

Definition at line 72 of file piano.h.

void Piano::setTuningTime ( const std::string &  time)
inline

Definition at line 75 of file piano.h.

void Piano::setTuningTimeToActualTime ( )

This function resets the tuning time to the actual time. This is used as default value.

Definition at line 70 of file piano.cpp.

void Piano::setType ( piano::PianoType  type)
inline

Definition at line 59 of file piano.h.

Member Data Documentation

const double Piano::DEFAULT_CONCERT_PITCH = 440
static

default concert pitch of A

Definition at line 46 of file piano.h.

const int Piano::DEFAULT_KEY_NUMBER_OF_A = 48
static

Definition at line 44 of file piano.h.

const int Piano::DEFAULT_KEYS_ON_BASS_BRIDGE = 28
static

Definition at line 45 of file piano.h.

const int Piano::DEFAULT_NUMBER_OF_KEYS = 88
static

Definition at line 43 of file piano.h.

double Piano::mConcertPitch
private

concert pitch (default 440 Hz)

Definition at line 119 of file piano.h.

Keyboard Piano::mKeyboard
private

the keyboard

Definition at line 122 of file piano.h.

std::string Piano::mManufactureLocation
private

location where the piano was produced

Definition at line 112 of file piano.h.

std::string Piano::mManufactureYear
private

manufaction year of the real piano

Definition at line 110 of file piano.h.

std::string Piano::mName
private

name of the real piano

Definition at line 104 of file piano.h.

std::string Piano::mSerialNumber
private

serial number of the real piano

Definition at line 108 of file piano.h.

std::string Piano::mTuningLocation
private

location where the piano is now

Definition at line 115 of file piano.h.

std::string Piano::mTuningTime
private

time when the tuning hast been started (format yyyy-mm-dd HH:MM:SS, UTC)

Definition at line 117 of file piano.h.

piano::PianoType Piano::mType
private

type of the real piano

Definition at line 106 of file piano.h.


The documentation for this class was generated from the following files: