Just Intonation
Version 1.3.1 (19)
Explore keyindependent dynamically adapting tuning in just intonation

Main Tuning Algorithm. More...
#include <tuneralgorithm.h>
Public Member Functions  
TunerAlgorithm ()  
Constructor of the TunerAlgorithm. More...  
void  setIntervalSize (int halftones, double cents) 
void  setIntervalWeight (int halftones, double weight) 
void  tuneStatically (KeyDataVector &keys, const QVector< double > pitches, const int referenceKey, const int wolfsIntervalShift) 
Tune statically in a given unequal temperament (UT) More...  
double  tuneDynamically (KeyDataVector &keyData, const QVector< double > intervals, const QVector< double > weights, bool optimizedJI) 
Main Tuninig Procedure: Tune dynamically. More...  
Private Attributes  
Eigen::MatrixXi  mSelectedVariant 
Previously used pitch variant. More...  
double  mProgression 
Actual pitch progression. More...  
const double  octaveWeightFactor = 0.5 
const double  memoryWeight = 0.00005 
const double  epsilon = 1E10 
const QVector< QVector< double > >  cJustIntonation 
major seventh 15/8 More...  
Main Tuning Algorithm.
This class contains the main tuning algorithm.
The static tuning function is trivial: It simply copies the given pitches in the argument to the corresponding keys.
The dynamical tuning function can operate in two different modes. If the flag 'optimizedJI' is false, then the algorithm tunes dynamically according to the given list of pitches and weigths in the arguments. If the flag is true, then the list of pitches is ignored and the chord is tuned according to the best possible choice of interval sizes from the list defined at the end of this file (cJustIntonation).
Definition at line 54 of file tuneralgorithm.h.
TunerAlgorithm::TunerAlgorithm  (  ) 
Constructor of the TunerAlgorithm.
Definition at line 37 of file tuneralgorithm.cpp.
void TunerAlgorithm::setIntervalSize  (  int  halftones, 
double  cents  
) 
void TunerAlgorithm::setIntervalWeight  (  int  halftones, 
double  weight  
) 
double TunerAlgorithm::tuneDynamically  (  KeyDataVector &  keyDataVector, 
const QVector< double >  intervals,  
const QVector< double >  weights,  
bool  optimizedJI  
) 
Main Tuninig Procedure: Tune dynamically.
This function is the essential part of the JustIntonation project. Based on the actual pattern of pressed keys, the current volume of each key and an empircal memory parameter for each key, it calculates the pitches for all pressed keys by solving a linear system of equations. For the solution we use the opensource library 'eigen'. Most of the function deals with setting up the system of linear equations A.C=B. There are three contributions: (i) equations reflecting the targeted interval pitch differences between the pressed keys, (ii) equations expressing the tendency of an already pressed to to keep its own pitch, and (iii) a single equation reflecting the constraint of maintaining a predefined average pitch. The computation results are forwarded to the corresponding signals in the TunerThread.
keyDataVector  : Array containing all information about the keyboard keys 
intervals  : Intervals according to which the tuner tunes 
weights  : Weights of the intervals in the leastsquare fit 
optimizedJI  : true if nonunique interval sizes shall be optimized 
Definition at line 109 of file tuneralgorithm.cpp.
void TunerAlgorithm::tuneStatically  (  KeyDataVector &  keys, 
const QVector< double >  pitches,  
const int  referenceKey,  
const int  wolfsIntervalShift  
) 
Tune statically in a given unequal temperament (UT)
The tuning module sends deviations to the sampler or MIDI device which are given in cents relative to the ET. Static UT's are defined by a set of timeindependent cent deviations which refer to a certain reference keynote. Usually a UT sounds good only in this keynote and its complementary keys. For example, static just intonation based on the keynote C sounds nice in CMajor but unacceptably out of tune in DMajor.
This function copies the given pitch deviations from the table to the actual pitches of the active keys. The pitch deviations are assumed ro repeat on each octave. As static temperaments do not exhibit harmonic progression, the average pitch progression is zero. The location of the wolfs interval can be shifted according to the conventions.
keys  : Array of all keys 
pitches  : 12 pitches defining the static temperament 
referenceKey  : Root key to which the temperament refers 
wolfsIntervalShift  : Index from which the circle of fifths starts 
Definition at line 70 of file tuneralgorithm.cpp.

private 
major seventh 15/8
Definition at line 84 of file tuneralgorithm.h.

private 
Definition at line 79 of file tuneralgorithm.h.

private 
Definition at line 78 of file tuneralgorithm.h.

private 
Actual pitch progression.
Definition at line 75 of file tuneralgorithm.h.

private 
Previously used pitch variant.
Definition at line 74 of file tuneralgorithm.h.

private 
Definition at line 77 of file tuneralgorithm.h.