# Guitar fundamental frequency vs pitch

When a note is played on the guitar, is the fundamental frequency always the strongest one or could a harmonic be the strongest one (in terms of amplitude). When could that happen? Also, when playing a note of, for example, 440Hz, is 220Hz also a harmonic or only larger multiples?

When I produce a spectrogram of a B3 guitar note I get this:

As you can see, the frequency of B3 (246Hz) does not seem to be the strongest frequency. Its approximate half (near 130) seems to be the strongest one.

This is the audio file (the B3 note is clear).

To generate the spectrogram, I use a STFT taken from the Librosa library:

import plot as plt

def transcribe(filename):
y, sr = librosa.load(filename, sr=40000)

D = librosa.stft(y)
plt.plot_spectrogram(D)


The plot.py module:

import matplotlib.pylab as plt

def plot_spectrogram(stft_output, xlabel='Time', ylabel='Hz'):
plt.figure()
librosa.display.specshow(librosa.amplitude_to_db(stft_output,
ref=np.max), y_axis='log', x_axis='time')
plt.title('Power Spectrogram')
plt.colorbar(format='%+2.0f dB')
plt.tight_layout()
plt.savefig('static/plots/' + 'spectrogram.png')


Generally, the amplitude of each harmonic including the fundamental depends on the physics of the instrument. Harmonics that are close in frequency to the vibrational modes (i.e. where the frequency response of the instrument exhibits a peak) will be higher. It could happen that the highest hamronic is not the first one (the fundamental frequency). For example, in the open G string of the violin the fundamental frequency has a very low (almost zero) amplitude, because there are no vibrational modes near 192 Hz. For this reason, the amplitude of each harmonic depends on the played note. I think that it could happen for every instrument that, for a particular note, the fundamental is not the strongest one.

Please note that in your picture the fundamental frequency is the one near 128 Hz. You can verify it by checking that the frequency step between contiguous harmonics is about 128 Hz. In this case it appears to be the strongest one in terms of amplitude but, as I said, it could happen that it is not.

• Thanks. Please see updated question. Why do you think B3 is not the strongest frequency in the spectrogram? – pavlos163 May 16 '17 at 14:23
• I edited the answer. Are you sure that you recorded a B3 and not a B2? – firion May 16 '17 at 14:30
• Yes, I added the audio file. – pavlos163 May 16 '17 at 14:40
• I also added the code used to generate the spectrogram. – pavlos163 May 16 '17 at 14:43
• There is a problem with your spectrogram. You specified a sample rate of 40000 but actually it is 22050. That's why displayed frequencies are wrong! – firion May 16 '17 at 14:55

Pitch is psychoacoustic. Thus, a harmonic frequency can be stronger than the fundamental, without changing the pitch heard. This is common in some stringed instruments. And a note's pitch frequency could even be missing from a notes frequency spectrum. For instance: An old telephone circuit can cut off frequencies below 200 Hz, but people still have no problem recognizing a low male voice pitched at around 100 Hz.

For many timbres, humans will hear the harmonic spacing as the note pitch. In your plot, the harmonic spacing appears to be around 130 Hz, so that will be the note pitch perceived (if played at the same sample rate at the plot axis suggest). Not 260.

• But B3 is the note played (perceived pitch should be 246Hz) – pavlos163 May 16 '17 at 14:51
• Not if you play what you plotted. – hotpaw2 May 16 '17 at 14:58
• You are right! So, in which cases in the guitar could a harmonic be stronger than the fundamental? Is it when playing high or low notes or that does not play any role? – pavlos163 May 16 '17 at 15:02
• Depends on the guitar (shape, material, construction, bridge, etc.), string type, which string, fretting, how the string is plucked, and the 3D acoustic radiation pattern's relationship to the mic (or ear) placement. Weak fundamentals are somewhat more common in the lower notes of large stringed instruments. – hotpaw2 May 16 '17 at 15:06

The note/pitch is determined only by the first frequency peak on the DFT plot. All the other amplitudes are called harmonics that only add to the timber. These harmonics (timber) are what differences a guitar note, for example, from a note on a violin.

• -1 Sid. there are some notes with missing fundamentals. you cannot assume there is sufficient energy at the fundamental frequency that it will show up as "the first frequency peak on the DFT plot." the only thing you can assume is some degree of periodicity. we call these functions quasi-periodic: $$x(t+P) \approx x(t)$$ for $P$ being the period and $$f_0 \triangleq \frac{1}{P}$$ being the fundamental frequency. – robert bristow-johnson Jan 21 '18 at 1:48