# Studying and Modeling Guitar Harmonics Using Fourier Analysis

My goal with this project was simply to use Fourier analysis to explore the harmonics of guitar strings. As a guitar player of nine years, I have always been aware of harmonics or “overtones” on guitar but did not always understand how they worked physically, which inspired this project.

Background

In an ideal case, each individual guitar string obeys the wave equation:

where  Given some initial condition  and  for all  at t=0, the solution of the wave equation is

where  L is the length of the string. Observe that the angular frequency in the above solution is

giving us the frequency of the nth harmonic:

In English: not only does the string vibrate as a standing wave along its whole length (the fundamental frequency), but also along half its length, a third of its length, etc. Therefore, the string vibrates with a sum of periodic functions with the respective harmonic frequencies. For each harmonic, nodes, or points of no transverse motion, exist at integer multiples of L/n along the length of the string. It may now be obvious that harmonics take their name from the harmonic series:

Even subtle variations in these overtones can be noticeable, and ultimately determine the timbre of a sound. The harmonics created by guitar strings are what make the sound richer and more complex. In contrast, pure tones created by a single frequency tend to be grating to listen to.

Method

The audio samples I used for this experiment were captured using my own 1996 G&L Legacy guitar, a Fender Frontman 10 W practice amp, a MacBook Pro with GarageBand Software and the built-in microphone. I recorded very short audio samples and edited them to remove the transient “pick attack” of the note so that I was only analyzing a short clip (i.e. a small array in MATLAB) with near-constant amplitude and constant frequencies. From GarageBand I exported these clips as WAVE files in my MATLAB folder. I then imported these WAVE files into MATLAB as arrays and used the built-in fft command to perform fast Fourier transforms on the audio signals, which then allowed me to take the power spectrum and observe the frequencies present in the clip.

C Major Chord Analysis

The first part of my experiment involved analyzing a brief clip of my guitar playing a C major chord, by definition containing the notes C, E, and G. Fourier analysis revealed the following frequencies:

 Power Spectrum Amplitude Frequency (Hz) Nearest Note 13.28 132.3 C3 9.081 165.4 E3 223.6 198.4 G3 16.71 264.6 C4 30.98 333 E4 13.28 394.7 G4 2.633 593.1 D5 6.258 663.7 E5 2.815 796 G5 46.93 996.7 B5 1.125 1186 D6 1.797 1387 F6 1.458 1592 G6 2.295 1857 A#6 0.7868 1991 B6 0.5319 2324 D7 0.6912 2657 E7

The first five frequencies on the table are the fundamental frequencies of the five notes that I played. All the frequencies higher than 333 Hz are harmonics. Some of the quietest frequencies have amplitudes that are orders of magnitude lower than those of the highest frequencies, and there may be other frequencies that could be faintly heard that I could not pick out on the frequency spectrum. Most of the frequencies did not perfectly align with the defined note frequencies at concert pitch. This could be for several reasons: my guitar may not have been perfectly in tune, my guitar’s intonation may not be perfect, and the guitar’s equal temperament (i.e. uniformly spaced frets) actually does not facilitate pitch-perfect notes. These factors are all essentially tuning issues, and I wouldn’t expect that they determine the immediately recognizable timbre of the guitar.

###### High-Pass (harmonics):

One other possibility is that the guitar’s steel strings – not “ideal” strings without stiffness or damping – do not create the perfect theoretical harmonics. My suspicion is that this “imperfection” of the string creates slightly dissonant harmonics that make the sound more interesting to the human ear, and that this is a main contributor to the string’s timbre. Even in an ideal case, however, we could expect to see that some of the highest audible harmonics are actually notes that are not in the chord at all, and my data reflects this.

Fig.1: Clockwise from top left: The original waveform of the signal, the frequency spectrum of the signal, the waveform after low-pass filter, the waveform after high-pass filter.

Synthesized C Major Chord

To see if I could synthesize something close to my original C major signal, I used MATLAB to generate several sine waves of the corresponding frequencies and weighting them with coefficients αn. Without the weighted coefficients, the frequencies all appeared at roughly the same amplitude in the spectrum, with an average value of 2244 and maximum and minimum values of 2272 and 2041, respectively. I am not certain what caused these amplitudes, but I suspect it may have to do with interference of the waves. In any case, to get roughly the same amplitudes as the original guitar signal, I did some algebra:

where  is the unweighted amplitude of that frequency. Using MATLAB’s built-in audiowrite command, I was able to export the synthesized signal as a new WAVE file. Even though the frequency spectra look practically identical to the naked eye, the synthesized signal is not a convincing recreation of the original guitar signal. I suspect that there are even more frequencies present in the original signal that were not clearly visible in the graphical frequency spectrum but are audible to the human ear. Case in point, I was unable to spot a few of the highest frequencies listed above until I zoomed in much closer to the spectrum graph. Adding these to the synthesized signal made a significant audible difference, even though those high frequencies have amplitudes that are lower than some others by orders of magnitude in the power spectrum.

###### Synthesized C Major Chord:

Fig.2: Comparison of the guitar waveform and frequency spectrum (left), with synthetic waveform and frequency spectrum (right).

Natural Harmonics

In the world of guitar, there is a technique known as “playing harmonics,” which requires the player to place their finger at one of the nodes along the string, without pressing hard enough to fret the note. As a result, the string is forced to vibrate at the harmonic corresponding to the node the player touched. My goal for this section of my project was to analyze the frequency spectra of several played harmonics on the low E string of the guitar. My expectation was that the open E string would show the widest range of frequencies, while the different harmonics would only show subsets of the full range.

 Harmonic E3 B3 E4 G#4 B4 E5 G#5 A#5? D6 D#6 Open (n=1) 165.4 247.0 330.8 12th fret 165.4 496.1 12th fret h (n=2) 165.4 328.5 19th fret h (n=3) 247.0 7th fret h (n=3) 247.0 5th fret h (n=4) 165.4 328.5 414.5 661.5 4th fret h (n=5) 163.2 247.0 330.8 412.3 493.9 826.9 912.9 1166 1252 9th fret h (n=5) 163.2 247.0 326.3 412.3 826.9 1255

However, there did not appear to be a clear pattern to the frequency spectra of the different harmonics. I would attribute this lack of correlation to several sources of error, particularly the quality of my recording equipment. I used a very unprofessional recording technique: using my laptop’s built-in microphone in the vicinity of my amplifier. Most professional record engineers use special recording microphones placed very close to the amplifier speaker and secured by a stand. The onboard microphone on most laptops is designed to pick up the midrange frequencies of the human voice and was not a suitable choice for this experiment (which had no budget). Look no further than the open E string spectrum, which does not even show the fundamental frequency of E2, which is 82.41 Hz.

Fig.3: The frequency spectra of several natural harmonics on the low E string.

Sources of Error and Next Steps

Other error sources include background noise coming from the amplifier, tuning and intonation discrepancies, the equal temperament of the guitar, inconsistent picking technique, and a lack of repeated trials.

Future experiments in a similar vein could include exploration of timbre on the guitar. For example, picking at a different point along the string or using a pickup in a different position both influence the timbre, which could show up in the frequency spectrum. This is partly due to the fact that the coefficient bn of each harmonic frequency is determined by the initial pluck shape :

Sources Cited