# software to determine the tuning (temperament) of a recording?

Case in point: Glenn Gould's recording of the WTC. The liner notes mention nothing about the tuning (in fact, I doubt the author understood the difference between equal and well temperament). This is one of many recordings about which I would like to know what tuning they used. I can sort-of tell quarter-comma-mean-tone by listening, but that's about it.

Thanks!

• I don't think Glenn was big on "historical" tunings, and the lack of any special mention of the tuning used would imply "standard tuning", I would say. Just because it's the "Well-Tempered Clavier" doesn't mean it has to be played on one! – Johannes Oct 12 '16 at 13:40

This should be possible in theory, but I doubt you will find any "free" software that can do it, or any software at all that doesn't require some specialist knowledge.

The basic problem is the accuracy required. The difference between a just intonation fifth and an equal-tempered fifth is about 2 cents (1 cent = 1/100 of a semitone). So let's make the plausible assumption that to accurately "measure" a temperament you need to measure the pitch of individual notes to within 1 cent.

For A = 440 Hz, the note 1 cent higher has a frequency of about 440.25Hz, so in the mid range of the piano you need to measure frequencies to that degree of accuracy.

If you use the simplest approach to this based on Fourier analysis, you would need a "constant amplitude" note with a duration of about 4 seconds to measure the frequency to within 0.25 Hz. It's not very likely that you will find single notes of that length in the recording, even given Gould's rather eclectic approach to choosing tempos!

Of course there are more sophisticated methods of determining frequency than the above, but any reasonably straightforward method needs a single "note" that is long enough to analyse.

If you can find single notes that are sufficiently long, you could try using a guitar tuner to measure the frequencies - but I don't have any practical experience of whether that would be successful.

A good piano tuner "measures" frequencies to this level of accuracy by counting the beats between two notes played simultaneously - but in the mid range of a piano that depends on listening to just two notes for long enough to accurately measure beat frequencies of about 1 beat per second. Once again, you need notes that last for a few seconds to do that by ear.

I expect if you wanted to pay a signal-processing specialist enough money, he/she would find this an interesting challenge - but "enough money" might be more than you want to spend!

• OTOH, there are notes in the scale with larger frequency deviations than the fifth. In addition, the precision of a Fourier transform depends on the number of samples, not just the temporal sample length. If you were to sample at, say 1MHz, you should be able to distinguish the fifths. – Carl Witthoft Oct 11 '16 at 11:32
• Right. IMO the deviations of the fifths in 12-edo vs just intonation are neglectable, but others like the 15ct sharp major thirds are very much not neglectable. I'd suggest something like 5ct as the required precision, which makes it all substantially more feasible. – leftaroundabout Oct 11 '16 at 15:28
• @CarlWitthoft No. If you sample a one-second signal at 1 kHz, you can resolve frequencies up to 0.5kHz with a resolution of 1 Hz. If you sample the same 1-second signal at 1 MHz, you can resolve frequencies up to 0.5 MHz with exactly the same resolution of 1 Hz. For the OP's application, the extra frequency range (1000 time bigger) doesn't help. Also, the resolution you need depends on the smallest deviation from some nominal reference point, not the average or the largest. – user19146 Oct 11 '16 at 16:00
• @leftaroundabout " IMO the deviations of the fifths in 12-edo vs just intonation are neglectable, but others like the 15ct sharp major thirds are very much not neglectable" - that doesn't make any sense. Your 15ct sharp major third is simply the sum of 5 tempered fifths! Sure, an ET major third sounds more "unjust" than an ET perfect fifth, but that's irrelevant. You can easily hear the difference between a just 5th and a meantone 5th, and that is only about twice as big as the difference between just 5th and an ET 5th. – user19146 Oct 11 '16 at 16:07
• Well... stacking up five neglectable things can add up to something non-neglectable! And the “only” twice-as-big (actually a bit more) dicrepancy to Pythagorean of the ¼-comma meantone fifth makes it just flat enough to actually sound off in a musical context (to my perception), whereas I'd not be able to tell the 12-edo fifth apart from Pythagorean. The quarter-comma fifth is in fact 5.4 cents flat, which is why I think 5ct would be a reasonable resolution for such a program. – leftaroundabout Oct 11 '16 at 17:33

This is too long for a comment, so I'm posting it as an answer.

I though it should be possible to recover tuning of the instrument using harmonics, after all due to how Fourier transform works, higher frequencies have higher precision. I have opened a recording of the last chord of C major prelude (cut out and copied several times from both left and right channels) in spectral imaging software and the harmonics I recovered form the recording do not make sense to me.

For a FFT of size 65536 and 44.1 KHz sampling (which gives accuracy of 0.67 Hz) I got the following buckets (manually picking those with high values):

``````89, 97, 194, 244, 268, 292, 357, 388, 446, 486, 491, 714, 780, 889, 974, 1072, 1169, 1268, 1365, 1368, 1475, 1563, 1665, 1756, 1765, 1956, 1970, 2065, 2154, 2166, 2267, 2467, 2552, 2751, 2778, 2880, 2941, 2968, 3473, 3543, 3768, 3946, 3983, 4149, 4497, 4761, 5016, 5543, 6618
``````

I know that harmonics of acoustic instruments deviate from the ideal series, and that it can vary in time, but I guessed the mean should be good approximation, and I hoped these differences among different strings will be similar.

Unfortunately my approach didn't work. The differences between harmonics and their ideal counterparts were just too big and unpredictable. Also, there were some larger clusters of frequencies, too large even if you were to count colliding harmonics of different notes. Sometimes good piano tuners introduce slight differences between different strings of the same note to make the sound more rich, but these are usually very small. Also, I didn't have the recording in a lossless format, so perhaps the encoding messed the sound (although I doubt it).

In other words, I have no idea why that didn't work, but the problem of recovering actual tuning seems to me much more difficult. Although the general issue is accuracy, if I were to guess the actual cause looks more like the general complexity of sound of the piano, including interference of all the other strings that were not hit, but still play.

Finally, even if we were able to recover note heights with reasonable accuracy, that might not be any known tuning (e.g. the high frequencies might be a bit more equal-tuned than the rest, while the low frequencies might be just stretched). In fact, if we go into such detail, then each acoustic piano is slightly different (in particular how they resonate), and I would expect that tuners tune pianos so that they sound good rather than just use some particular scheme, even if they try to achieve effect similar to, say, Werckmeister III tuning.