13

Looking at this file of a A4 note from a piano, I get this spectrogram (simply using Python code performing a FFT):

Piano A4 FFT analysis

Piano A4 spectrum with harmonics values assuming a 440 Hz tuning

I'm trying to understand it (I'm not an expert in harmony). The vertical lines are the locations expected for the harmonics. We see the A4 fundamental at 440 Hz, then the first 4 harmonics of this A4 in decreasing amplitude at the correct locations, so far, so good.

After this, the peaks are continuously sliding from their expected locations, so it rather seems there is a new note at about 2670 Hz, closest are A4 6th harmonics (2640) and E7 tuning (2637), followed by what looks like its two shifted harmonics, the process repeats at about 4000 Hz. I think it's a new note rather than an harmonics because its amplitude exceeds the neighboring harmonics (not sure I'm right).

I can't get the sense of that.

Another attempt with A4 tuned at 458 Hz to have the 11th harmonics matching, this time other peaks don't align with their expected frequencies:

Piano A4 FFT analysis

Piano A4 spectrum with harmonics values assuming a 458 Hz tuning

Update: I did this analysis to compare timbres from a tuning fork and from different instruments and detect possible procedural errors. In addition of the previous piano (which maybe a digital one), I got a Steinway sample, and also a sax to verify @ttw 's explanation (verified):

Comparing timbres of different instruments using FFT

Comparing different instruments using the same tool-chain (tuning fork, piano, piano, sax)

Another explanation could be the E7 string starts resonating with the A4, can someone shed some light on this? Is this usual?

mins
  • 377
  • 1
  • 8
  • 3
    That could depend on various aspects, including some resonance of the room, but it's likely that your assumption about the E7 string is correct: remember that the higher notes of a piano don't have any dampers (usually they are the last 18-20 notes). – musicamante Mar 19 '21 at 15:04
  • @musicamante: Thanks, that's interesting. Are the notes of the last octaves (of a piano) tuned as exact multiples of the, say, 3rd octave (I mean are the comma issue or the temperament playing a role) – mins Mar 19 '21 at 15:10
  • 3
    That depends. Piano tuners generally "stretch" octaves, with higher notes a bit higher than lower ones (see [stretched tuning](https://en.wikipedia.org/wiki/Stretched_tuning)). – musicamante Mar 19 '21 at 15:14
  • Seems also to me that the shift gradually increases. If the fundamental is not at 440Hz sharp, but at 441Hz, the 10th harm will be at 4410 and not 440. Maybe getting the maxima of this spectrum as a list would be useful to check that. – Tom Mar 19 '21 at 15:15
  • We're looking at 6th harmonics. I wonder if it has to do with the fact that the hammers typically hit the string at 1/6 – 1/7 of the length? Other than that, indeed top strings of the piano are not muted, so they can resonate freely – user1079505 Mar 19 '21 at 15:16
  • @musicamante This picture is in fact an excellent visualisation of the need for stretched tuning. Perhaps you should add it to the Wikipedia article! – Kilian Foth Mar 19 '21 at 15:31
  • 1
    It would be interesting to see a second graph made after covering the undamped strings with something to damp them. That would clarify whether or not they are influencing the initial graph. – Aaron Mar 19 '21 at 19:16
  • Question for the pianists in the room: are there several strings under this A key? – Tom Mar 19 '21 at 20:16
  • @mins, I have a question: is this the same file repitched, or are you generating and recording new sounds? – Bennyboy1973 Mar 19 '21 at 21:37
  • Well that's very interesting. I can think of a few things to try: (1) use an oscillator plugin in an audio program to generate a complex sound, and run it through the same transform. (2) try multiple live-recorded piano sounds. It may be that some kind of compression or other effect might have corrupted the sound or something? – Bennyboy1973 Mar 19 '21 at 23:52
  • How about procedural samples, like a multi-oscillating synth? If those show the same effect, then there's something with the FT. – Bennyboy1973 Mar 20 '21 at 00:58
  • @mins All these new samples are so fun to look through, and something I could never do myself. You're a legend! – Bennyboy1973 Mar 25 '21 at 20:48
  • Can you not damp the higher strings with a blanket or similar to see whether the effect is reduced or eliminated as @Aaron suggested about five comments back? If you suspect specific strings of resonating you could just damp those with a piece of rubber. As user1079505 says below it, ttw’s answer is not supported by its Wikipedia reference. – PJTraill Mar 25 '21 at 20:54
  • Ah, I see that your problem is apparently that you just have an MP3 file, not the instrument – but that ought not to be insurmountable. If you can test an actual piano, then I suggest you also make separate spectrograms of the strings that might be resonating. – PJTraill Mar 25 '21 at 21:01

3 Answers3

10

The harmonic series, 1, 1/2, 1/3, 1/4,... only agrees with the physics for thin low-tension strings. A piano (even at the top) has relatively thick, high-tension strings. The harmonics tend to get sharper. There's a formula taking into account thickness and tension. Basically, the higher frequencies are raised by the square root of the tension over the density.

https://en.wikipedia.org/wiki/String_vibration From some requests, I've added supplements. (I left out the mechanism of inharmonicity; it comes from the stiffness of the string as discussed in the two references.)

Wiki has a summary: https://en.wikipedia.org/wiki/Inharmonicity

This paper shows in more detail the fourth-order differential equations governing the strings. http://www.simonhendry.co.uk/wp/wp-content/uploads/2012/08/inharmonicity.pdf

ttw
  • 24,207
  • 1
  • 31
  • 76
  • 5
    I don't believe the quoted article in the wikipedia discusses inharmonicity at all. The factor of square root of tension over density is constant for each harmonic so it doesn't contribute to inharmonicity. Inharmonicity is related to string stiffness, which is related to its material, thickness, and also string length. – user1079505 Mar 19 '21 at 17:38
  • The point is that tension and density do cause the string's overtones not to match the harmonic ratios. (The same argument applies to Pythagaros' argument about ringing hammers which do not follow the series either. – ttw Mar 19 '21 at 18:20
  • Like @user1079505, I see no dependence on _n_ in that factor, so that the predicted frequencies should just be multiples of the fundamental. Can you find another formula that predicts something else, or do a worked example to show how that formula predicts a 9th overtone that is not a multiple of the fundamental? I have added a [plea for an explanation](https://en.wikipedia.org/wiki/Talk:String_vibration#Explanation_of_inharmonic_overtones%3F) to the discussion page of that article. – PJTraill Mar 25 '21 at 21:28
  • See also this study of actual [piano strings inharmonicity](http://www.afn.org/~afn49304/youngnew.htm). – mins Mar 25 '21 at 23:38
2

The explanation and understanding can be found in the physics of vibrating systems (and a little bit in basic definitions).

A harmonic series is defined by the relationship fn = n*f1m n = 1, 2, 3, ...

If f is a frequency, say 110Hz, then the harmonics are 220, 330, 440, ... etc.

A "simple" wave form or signal has a single frequency in it and is described by a trig function, sin(2 pi f t) or cos(2 pi f t). In this sequence the lowest frequency is called the fundamental. The set of all such functions can be used to describe almost any function which is quite amazing. In math we say that the set of all functions {sin(2 pi f t), cos(2 pi f t)} for a basis for a function space. Expanding any curve as an infinite series of these basic waves is the foundation of signal analysis or harmonic analysis and synthesis (the latter being the construction of a generic function by adding together sines and cosines).

In algebra the simplest function might be a straight line, having 2 parameters, a slope and intercept. So describing a line with an infinite series of sines would seem foolish. But in vibration and wave theory the simplest function is in fact a sine. The aforementioned functions are the simplest solution to the wave equation and describe a wave train of a single wavelength or frequency. In music this would be a single pitch, in optics it would be a single color (monochromatic).

Each such eave has three parameters that describe it, a frequency, an amplitude, and a phase. Frequency you know, amplitude is related to volume or power, and phase just tells you how the wave looks at t = 0 sec. Two waves with the same f and Amp but different phase are the exact same shape but shifted.

Now for the physics.

All continuous vibrating system, tight string, air column in a tube, stiff plates, etc have an infinite set of solutions to the basic wave equation characterized by the frequency (and some other parameters). Not all of these frequencies obey the harmonic sequence but the two that come very close are (1) the tight vibrating string, and (2) standing air waves in a long thin tube. These cover most of the instruments in an orchestra.

So, how do all these vibrations come into a single note? The presence of multiple harmonics in a single note plucked on a guitar for example are the result of the attack. The initial conditions that determine how the string is set in motion. The shape of a plucked string will not be a sine or cosine but can be described as an infinite series of these functions. So when you play a musical instrument including your voice you excite all these harmonics.

The harmonic relation is pretty simple and actually rare. Most real material systems, including strings, do NOT obey the simple wave equation but contain stiffness terms that are linear, but higher order. As a result vibrations in a stiff bar, or very tight short string plucked or hammered with enough force will exhibit non-harmonic over tones. I've done harmonic analysis on very long tuning forks back in college and you can easily tweak out an octave and an augmented 5th. In fact if you are a well trained musician you can hear it! And, since the lobe pattern is frequency dependent if you turn the fork you will hear different notes dominate the sound field at your ear. It's pretty cool.

I would never expect the "harmonics" of a musical instrument to truly follow the harmonic sequence due to the fact they do not obey ideal physics equations. There are some good sources that describe the corrections to the simple models. In particular anything by Fletcher and Rossing.

-1

First of all- WOW! So interesting, I hope you come back here and do a lot more of these!

I think what's happening here is the difference between natural harmonics and equal temperament. If you can find a sample of someone playing the song in just temperament for a long time and then equal temperament, you might throw up. Not exaggerating, it's really quite jarring.

Let's start with the relationship between natural harmonics and equal-tempered notes to see if that's our cause: (from Wikipedia) enter image description here

So I don't think vibrating high strings are the culprit. If they were, then I'd expect a variety of reinforced harmonics due to sympathetic vibration, not an even drift. Even if a (human, I mean) tuner were deliberately sharpening upper notes due to some kind of psycho-acoustic effect, you'd still expect 7th harmonics to be way more off than say octave harmonics.

It seems to me, however, that being very slightly off in the primary pitch would lead to the effect you've found. Can you take your A440 example and compress the whole graph so that the 12th harmonic lines up properly? I think you'll just find that you've tuned to a 440.1 or something.

Bennyboy1973
  • 3,933
  • 1
  • 5
  • 17
  • Give me a couple minutes plz. . . I'm currently editing this answer already but doing some thinkin' and some math. – Bennyboy1973 Mar 19 '21 at 19:26
  • 1
    What's the actual source for the natural/equal-tempered pitches? The Wikipedia link just points to the image. – Aaron Mar 19 '21 at 19:50
  • Oops. . . try now! – Bennyboy1973 Mar 19 '21 at 20:05
  • 2
    Look at the answer from my comment by the OP under the question, he tried starting from another frequency (445) but not everything matches. Furthermore, equal temperament is not based on harmonics, even if some land quite close. The op asks why the spectrum he gets is not composed only of clean harmonics being multiple of the fundamental. As only one note is played temperament should not play a role. – Tom Mar 19 '21 at 20:12
  • I know equal temperament is not based on harmonics. It's based on 2^(n/12), which is why the 3rd is a little off and the 7th and tritone are way off as per the chart I listed. That's why I concluded that it cannot be resonating high strings which are the culprit-- sympathetic resonance would reinforce overtones of unequal spacing, not a geometric drift. – Bennyboy1973 Mar 19 '21 at 20:48
  • @Tom it looks like you arrive at pretty much the same conclusion as me: that it's likely a precision issue? – Bennyboy1973 Mar 19 '21 at 21:36
  • No, as the op said, even of you shift that does not match... That's what I thought too, hence the second graph – Tom Mar 19 '21 at 22:03
  • Hmmmm. . . looking at the 2nd graph, we can see 2 things right away. First, the primary is clearly not 458Hz. 2nd, the shift gradually increases, seems to maximize at around the 7th harmonic, and then shifts back the other way. I'm pretty stumped about that-- is there an EQ effect on the original sound? Is there any possible precision issue with floats used in the Fourier Transform? I quite intrigued right now, tbh. I mean, the loudest overtone, the perfect fifth, is WAY off, which seems pretty unintuitive. – Bennyboy1973 Mar 19 '21 at 23:49
  • @Bennyboy1973 I did my own analysis of the sound he linked and got similar results. And maybe I'm fooling myself because I have prior knowledge, but it sure seems like I can hear the inharmonicity too. I don't think it's a software issue. – Edward Mar 20 '21 at 03:38
  • Yeah, there's a definite beat or wah to it, like piano tuners used to listen for when doing relative tuning. To me, that means that the strings in a single note aren't pitched exactly the same. I played an A on my upright, which thanks to Covid hasn't been tuned in well over a year. It is now officially a honky-tonk piano, and it was beating like crazy. But I played it on an electric keyboard with concert samples, and I STILL hear that wobble. – Bennyboy1973 Mar 20 '21 at 03:48
  • 1
    Temperament is irrelevant because the data here concern the spectrum of a single pitch. The overtones of the A4 do not depend on the frequency to which the E5 is tuned, or the C♯5, or anything else. – phoog Mar 22 '21 at 01:13
  • 1
    No, but a single piano note actually consists of between 1 and 3 physical strings. On my piano (the upright), middle A consists of 3 strings. If they're detuned, how does that actually work out? Do they kind of average out, like out-of-synch metronomes which will eventually land on the same beat? or will they show up in the FT as a curve instead of a sharp spike, or does the beat get interpreted as a sub-harmonic, or what? I'm kind of getting excited about this question, because I know hopelessly little about how strings on a single note interact. – Bennyboy1973 Mar 22 '21 at 01:19
  • @phoog also I think it's not quite true-- I think higher strings, which aren't dampened, WILL contribute to the waveform of lower notes, through sympathetic vibration. But if you see my answer above, you'll see why I discounted that as an important contribution. – Bennyboy1973 Mar 22 '21 at 01:23
  • 1
    As you demonstrate, E note is just 2 cents off in the harmonic series of A; it's almost perfectly in tune. So playing A note will certainly excite a string tuned to E. The question is rather whether it explains what the OP observed. – user1079505 Mar 22 '21 at 21:02
  • That's right, it wont. I'd expect octaves and fifths to resonate very strongly, and 7ths and tritone to resonate poorly, since the equal-tuned strings would be most off from the natural harmonics. The 5th is very strong in the provided diagram (seemingly TOO strong), but I think that's due to hammer position, which they say is about 1/6th up the string. – Bennyboy1973 Mar 23 '21 at 00:06