# Experiments in tuning frequency determination

Continuing where I left off a few days ago, let’s look at how well this technique works at determining the tuning frequency of some sequence of notes in a 12-tone equal tempered system. I have synthesized a whole bunch of random pitches (tuning frequency \(f_t = 442.33\) Hz) with overtones (not perfect harmonics) and noise (additive Gaussian white) and what not to create a complex polyphonic texture I title untitled #2 (Nov. 15, 2010).
The sonogram of this composition is seen at top in the figure below.

Aligned with the sonogram are the estimates of the tuning frequency using the method I presented before: for a window of data, find the peaks in the magnitude dB spectrum, find the one peak that has the most harmonically related overtones, select that as the fundamental, and compute the tuning frequency based on the assumption that the fundamental is a note in the equal tempered system, and that the tuning frequency is somewhere near 440 Hz (to avoid an infinity of solutions). (This is in contrast to the method presented in E. Gómez, “Tonal description of music audio signals,” Ph. D. thesis, Music Technology Group, Univ. Pompeu Fabra, Barcelona, Spain, 2006, which assumes each harmonic is a note in the equal tempered system, and estimates the tuning frequency by a weighted average (using spectral magnitudes) of their deviation from a tuning frequency of 440 Hz.) In this figure we see that by and large (by golly) the majority of estimates (.) is on top of the true tuning frequency (dashed gray line).

Now, what about real data?! Here is an oboe tuning at some frequency for A4. And for this we see below its sonogram, as well as the estimates of the tuning frequency, which centers just shy of 442 Hz. Notice in the high overtones that the oboist is a bit wavery. The red histogram shows the distribution of tuning frequency estimates.

Now what happens when you don’t have the liberty of tuning with the orchestra before you begin playing? Can we estimate the tuning frequency used prior to a recorded performance? For instance, this piece by Vivaldi, we find the estimates seen below. Our distribution is much fatter this time, but we see that this small orchestra is tuned to a system north of 442 Hz to almost 445 Hz! I wonder instead, since there are so many strings, that this estimate is off. Perhaps the estimate can be made more robust if we can use several pitches at the same time.

Now let’s do a little archeological work. What tuning frequency was used by Max Mathews in digitally synthesizing one of the first singing voices at Bell Laboratories in 1961? From the figure below it looks like 430 Hz on the nose! (However, I wonder if this comes instead from the original recording being retarded about 3%.)

Now, what happens when we analyze a music performance that is not in an equal tempered system? Say, Fairouz singing “La te3tab 3alayyi”? Well, we don’t get such a good agreement of a tuning frequency, but there appears to be some.

To reproduce some or all of these figures, please have a download of my MATLAB code. Note that you will need MIRtoolbox, mpg123, and mp3info.