The defacto tuning for almost all contemporary western music is 12 tone equal temperament. It is a good solution given the constraint that tuning an instrument in real-time during the performance and even between different musical pieces in a single sitting can be a tedious and time-consuming task. The most famous example is probably the piano where the tuning requires a separate profession.
We believe that 12 tone equal temperament is not necessarily the best tuning system for every melody if retuning is an easy operation like in electronic music. InTune aims to compute a better tuning tailored to a given musical piece.
Here is the algorithm:
- Assign a unique variable to each note instance in the score.
- Write down the total cost and construct the linear system from partial derivatives of it.
- Use SciPy's function for solving
$Ax=b$ for band matrix$A$ .
Let us put all notes in an ascending order w.r.t their onset time. Let
Differentiating the loss function we get
We get
Since neighborhood is a symmetric relation we have
Note that
Now we can write our problem in the form of a matrix equation
One would typically choose a neighborhood of size 30 (30 notes to the left and 30 notes to the right), so given that the whole score typically consists of thousands of note instances, the matrix