# Algorithm Spells the End for Professional Musical Instrument Tuners

At first glance, tuning a musical instrument seems a straightforward task. However, any professional tuner will tell you that the reality is rather different.

Pluck a string and the sound it produces is the result of its fundamental frequency and its harmonics at frequencies that are whole number multiples of the fundamental. Clearly, harmonics have a simple linear relationship with the fundamental.

The problem arises because music consists of repeating patterns of notes based on octaves. Since the frequency of a note doubles from octave to octave, the frequencies grow exponentially as the octaves increase.

And therein lies the problem. The linear increase in the frequency of harmonics can never exactly match the exponential increase required when the notes are arranged in octaves. So there is always a compromise.

Western musical scales consists of notes that differ by a constant frequency ratio of 2^1/12, a system known as equal temperament. These notes are equidistant on a logarithmic scale but not on a linear scale.

In this system, notes that are an octave apart can all be in tune but other intervals, such as perfect fourths or fifths, are always slightly out of tune.

To get around this, a professional tuner ‘stretches’ the interval between some notes to correct these intervals. And that’s where things get tricky.

The amount and type of stretching differs depending on the type of instrument (and even between instruments of the same type) and so cannot be calculated by electronic tuners, which have otherwise revolutionised tuning.

Some electronics devices allow users to select an “average stretch” for a specific type of instrument. But even then, many musicians say that the results are not as good as those that a skilled professional tuner can achieve.

Clearly, there is something about the human ear that produces better results than an ‘average stretch’.

Today, Haye Hinrichsen at the University of Wurzburg in Germany proposes a solution to this problem that may make it possible for electronic tuners to match the performance of the best human tuners. His idea is that tuning can be considered a problem of entropy minimisation.

When humans listen to two notes an octave apart, say A2 and A3, they compare not just the fundamental frequencies but also the harmonics. In theory, the second, third and fourth harmonics of A2 should correspond exactly with the first, second and third harmonics of A3 (and so on). The notes are in tune when the harmonics lock exactly.

However, the problems outlined above ensure that the higher harmonics do not match exactly and the slight mismatch produces a beat frequency that a professional tuner tries to minimise.

However, this process must depend sensitively on the acoustic properties of the inner ear, which is limited in the resolution with which it can distinguish frequencies.

This limitation is the crucial factor that Hinrichsen says his new method can reproduce.

He begins by tuning in the conventional way using the equal temperament method and then dividing up the audio spectrum with a resolution that matches the human ear’s.

The problem is then one of entropy minimisation. Since the entropy of two spectral lines decreases as they begin to overlap, the problem of finding the best possible compromise when matching harmonics is equivalent to minimising the entropy of the system.

So the new method is to measure the entropy of the system, apply a small random change to the frequency of a note and measure the entropy again. If it has dropped, the system is considered to be more in tune and another random change is applied until the process finds a minimum value for the entropy.

That’s an interesting idea. It’s clearly not perfect probably because there are many local minima that the algorithm can get stuck in.

But Hinrichsen compares his algorithm to the work of a professional tuner and it doesn’t come off badly at all.

And since it’s just a simple algorithm it could easily be added to the features of relatively cheap electronic tuners available in shops. “The implementation of the method is very easy,” says Hinrichsen.

That may cause some sleepless nights in the music world. It may well be that the professional tuner’s days are numbered.

Ref: arxiv.org/abs/1203.5101: Entropy-based Tuning of Musical Instruments