Just Intonation
Version 1.3.0 (18)
Explore scaleindependent 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  tuneStaticUT (KeyData &keys, const QVector< double > pitches, const int referenceKey, const int wolfsIntervalShift) 
Tune statically in a given unequal temperament (UT) More...  
double  tuneDynamically (KeyData &keyData, const QVector< double > intervals, const QVector< double > weights, bool optimizedJI) 
TunerAlgorithm::solve. More...  
Private Attributes  
Eigen::MatrixXi  mSelectionIndex 
double  mProgression 
const double  octaveWeightFactor = 0.5 
const double  memoryGlobalWeight = 0.00005 
const double  epsilon = 1E10 
const QVector< QVector< double > >  cJustIntonation 
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  (  KeyData &  keyData, 
const QVector< double >  intervals,  
const QVector< double >  weights,  
bool  optimizedJI  
) 
TunerAlgorithm::solve.
Main Tuninig Procedure: Tune dynamically
This function is at the heart 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.
keyData  : 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 108 of file tuneralgorithm.cpp.
void TunerAlgorithm::tuneStaticUT  (  KeyData &  keys, 
const QVector< double >  pitches,  
const int  referenceKey,  
const int  wolfsIntervalShift  
) 
Tune statically in a given unequal temperament (UT)
The sampler receives tuning deviations from the tuning module 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 key. Usually a UT works only in this reference key and its complementary keys. For example, static just intonation based on the reference key C sounds nice in CMajor but ugly 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.
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 67 of file tuneralgorithm.cpp.

private 
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 
Definition at line 75 of file tuneralgorithm.h.

private 
Definition at line 74 of file tuneralgorithm.h.

private 
Definition at line 77 of file tuneralgorithm.h.