# Consonance calculations (1)

Why does a major chord sound harmonious, in comparison with, say, an augmented chord ? In more general words, can we define the consonance of a given sound ?

The notions of consonance and dissonance are probably one of the most debated question in music theory and acoustics (see for example what Hindemith said: “The two concepts have never been completely explained, and for a thousand years the definitions have varied“). These notions have a long history, dating back to the time of Greek philosophers. The goal of this post is not to give a detailed review of the history of consonance theory, but rather to expose one particular approach, namely the calculation of consonance values in the framework of Plomp and Levelt observations. For a complete approach of the history of consonance, we invite our readers to refer to the following references:

• Tenney, J. , “A History of ‘Consonance’ and ‘Dissonance'”, Excelsior Music Publishing Company, New York, 1988.
• Sethares, W., “Tuning, Timbre, Spectrum Scale”, Springer, New York, 2004.

The original idea of the Greeks, and of various philosophers and scientists such as Galileo, Euler, or Diderot, was that consonant intervals are those based on small frequency ratios as consonants, an idea which originated from Pythagoras. Of course, at that time, the structure of sounds, including the presence of multiple partials forming a given spectrum, was not known. Departing from these consonance theories, Helmholtz introduced in his book On the Sensation of Tone” (which you can check out here) a theory of sensory consonance based on the auditory system itself.

If one takes two pure tones of close frequencies, the resulting sound will have beats, the frequency of which is equal to the difference of frequency between the original pure tones. Helmholtz focused on these beats through various experiments with sirens, one having a fixed frequency, and another one whose frequency he could change continuously. When the frequencies of the original signals are close, the beat frequency is low, and the slowly evolving resulting signal is not perceived as dissonant. As the difference of frequency in the input signals increases, the beats will be more and more pronounced, until the two sounds are perceived as distinct from each other. When two tones of similar frequencies are sounded together, they excite similar places of the basilar membrane in the ear: in other terms, they occupy the same critical band. The width of this critical band is therefore linked to the ability to perceive two simultaneous tones of different frequencies as a unique tone or not.

Helmholtz linked the beat frequency to the roughness of the resulting signal, and observed that this roughness peaks at a maximum for a reported beat frequency of 33 Hz. Helmholtz modelled this relationship through a mathematical formula: “In order to construct [the diagrams], I have been forced to assume a somewhat arbitrary law for the dependence of roughness upon the number of beats. I chose for this purpose the simplest mathematical formula which would shew that the roughness vanishes when there are no beats, increases to a maximum for 33 beats, and then diminishes as the number of beats increases“.

Now, to explain the consonant nature of complex sounds, which may have many partials, Helmholtz considered the pairwise interaction of all the partials of two harmonic sounds (one having a fixed frequency), and by assuming that the total dissonance is obtained additively from his function, was able to calculate the dissonance value for any frequency of the second sound. He presented his results in a famous figure, which we show below. Quite interestingly, his diagram manages to show that, in accordance with musical practice, the consonant intervals are the unison, the octave, the fifth, the fourth, the major third and the minor third (as well as the major sixth).

In the mid 1960s, Plomp and Levelt published an influential experimental work on the sensation of consonance and dissonance for pure tones. One can find these results in the following references:

• Plomp, R., Levelt, W. J.: Tonal consonance and critical bandwidth, Journal of the Acoustical Society of America, 38(4), pp. 548-560, 1965
• Plomp, R., Steeneken, H.: Interference between two simple tones, Journal of the Acoustical Society of America, 43(4), pp. 883-884,1968

A number of listeners were asked to rate the consonance of various pairs of pure tones sounded at different frequencies. This resulted in the determination of a dissonance function, which gives a dissonance value as a function of the frequency ratio of the two pure tones, expressed in units of the critical bandwidth. The typical plot of this function is presented below. The results of Plomp and Levelt provide an experimental justification of the work of Helmholtz, with the addition that the maximum of dissonance occurs at roughly one quarter of a critical bandwidth. It is therefore dependent on the frequency of the tones and not fixed to 33 Hz, as was the case for Helmholtz (which is incidentally the value of one quarter of a critical bandwidth for a frequency of roughly 600 Hz). Indeed, the critical bandwidth is roughly constant and equal to 100 Hz in the range 100-1000 Hz, and then increases proportionally with frequency.

Multiple parametrizations of the Plomp and Levelt curve have been given by various authors. Sethares (see the above-mentionned reference) has given the following formula, wherein the consonance function between two pure tones of frequencies $f_1$ and $f_2 > f_1$ is given by $d(f_1,f_2) = \exp(-3.5\cdot s \cdot(f_2-f_1))-\exp(-5.75\cdot s\cdot (f_2-f_1)),$

where $s$ is defined as $s = \dfrac{0.24}{0.021\cdot f_1+19},$

and is introduced to account for the variation of the critical bandwidth with frequency.

Following a similar approach to that of Helmholtz, Plomp and Levelt then studied the consonance of complex tones, by assuming that the total consonance results from the addition of the consonance values between all pairs of distinct partials (under the hypothesis that all partials have the same intensity). In other terms, given a complex tone whose spectrum is a set $\{f_1, f_2, \ldots\}$ of partials at frequencies $f_i$, the total consonance is given by $D = \sum_{f_i} \sum_{f_j > f_i} d(f_i,f_j).$

It is quite easy to implement the calculations of Plomp and Levelt in any language. I give below the results of a corresponding Python program. First, let’s examine the consonance of two pure sinusoidal tones, one having a fixed frequency of 250 Hz, the other one having a varying frequency between 250 and 500 Hz. This is simply the Plomp and Levelt curve at 250 Hz. Now, let’s consider two harmonic tones with 6 partials of equal intensities. The consonance vs frequency (of the second sound) is given below. We see that, after the unison and the octave, the other consonant intervals are the fifth, the fourth, the major third and the minor third, as well as the major sixth.

Of course, the calculation of the consonance value of a complex tone is not limited to harmonic sounds. Sethares has investigated complex tones whose spectrum is inharmonic, and has deduced the corresponding consonant intervals between such sounds. Following one of his example, let’s take the case of two complex sounds, whose spectrum is given by the frequency ratios 1.0, 2.758, 5.406, 8.936. This corresponds to the ideal partials of a marimba bar. The dissonance curve is given below. There are indeed consonant intervals, but since the spectra are inharmonic, these intervals do not correspond to the usual fifth, fourth, or thirds we are accustomed to.

In a next post, we will see how we can use these consonance calculations for the investigation of different tunings and temperaments.

For those interested, here is the Python code for producing the examples above.

import numpy as np
import matplotlib.pyplot as plt

#### This is the Plomp & Levelt consonance formula for two sinusoids of frequencies f1 and f2 of the same loudness

def plomp(f1,f2):
fmin=min(f1,f2)
fmax=max(f1,f2)
s=0.24/(0.021*fmin+19.)
return (np.exp(-3.5*s*(fmax-fmin))-np.exp(-5.75*s*(fmax-fmin)))

#### Given a matrix as input, where the rows represent the different sounds,
#### and the columns represent the frequencies of the spectrum of each sound,
#### this function calculate the total consonance value

def plompSpectrum(spectrum):
nSpectr, nFreq = spectrum.shape

c=0.0
for i in range(nSpectr):
for j in range(i+1,nSpectr):
for k in range(nFreq):
for l in range(nFreq):
c=c+plomp(spectrum[i][k],spectrum[j][l])
return c

###### MAIN ######

## The simple Plomp & Levelt curve

sweepingFrequency = np.arange(250.,500.,1.)
consonanceCurve = np.zeros((len(sweepingFrequency)))

for i,f in enumerate(sweepingFrequency):
consonanceCurve[i] = plomp(250.,f)

plt.plot(sweepingFrequency,consonanceCurve,'-b')
plt.xlabel("Frequency")
plt.ylabel("Dissonance")
plt.show()

## The Plomp & Levelt curve for two harmonic tones

spectrum = np.zeros((2,6))
for i,f in enumerate(sweepingFrequency):
for j in range(6):
spectrum[0,j] = 250.*(j+1)
spectrum[1,j] = f*(j+1)
consonanceCurve[i] = plompSpectrum(spectrum)

plt.plot(sweepingFrequency,consonanceCurve,'-b')
plt.xlabel("Frequency")
plt.ylabel("Dissonance")
plt.show()

## The Plomp & Levelt curve for a marimba bar with 4 partials

sweepingFrequency = np.arange(250.,1000.,1.)
consonanceCurve = np.zeros((len(sweepingFrequency)))
spectrum = np.zeros((2,4))
for i,f in enumerate(sweepingFrequency):
spectrum = [250.,250.*2.758,250.*5.406,250.*8.936]
spectrum = [f,f*2.758,f*5.406,f*8.936]
consonanceCurve[i] = plompSpectrum(spectrum)

plt.plot(sweepingFrequency,consonanceCurve,'-b')
plt.xlabel("Frequency")
plt.ylabel("Dissonance")
plt.show()


1. shalini tarke says:

hello, How can we calculate f1 and f2?

2. The values f1 and f2 are parameters of the Plomp and Levelt function, not results of a calculation.

3. Hi Alexandre,

The famous diagram by Helmholtz is split in 2 sections. In his book, they’re called “FIG. 60 A.” and “FIG. 60 B.” Here you posted the second one, which gives dissonance curves for tones in the range 1:2 to 1:4. Do you have the first one from 1:1 to 1:2?

Thanks,
Bo

4. Hi,

I have a fac simile book at home, unfortunately the Figure 60a is too small and quite unreadable.

A.