I've been reading about psychoacoustics and harmonics.When two notes of close frequency are played simultaneously, one can hear what is known as a beat frequency. Say two violinists are playing. One plays an A, 440Hz and the other is playing slightly sharp at 445Hz. Perceptually, you can hear a 5Hz "beat" buzzing, that arises from the sum of the two sine waves.
When the two tones are very close, the sound is no longer unpleasant, and the result sounds like a "smooth", flowing note. When the tones are less close, one hears the "buzzing", vibrating beats. But when the two tones are significantly separated, one simply hears two notes. In the 19th century, the physicist Helmholtz proposed a theory: what if humans dislike the sound of these beat frequencies, and that the more the beats are noticed, the more "rough" the sound is perceived. He developed a "roughness" curve based on some experiments:
If we go back to the example of the two violins, we can predict how pleasant the two sounds will be to each other. This gets interesting, because a violin plays more than the fundamental note; overtones are also present. So if the first violin plays an A, and the other plays a slightly offtune E, there will be roughness between the 3rd harmonic of the A (E'), and the 2nd harmonic of the E (E'). Helmholtz proposed adding together all of these interactions between harmonics to determine how pleasant the interval is. I wrote a Matlab script to add the roughness for each interaction for 6 harmonics, which produced this fascinating pattern:
This figure plots the sum of roughness for 6 harmonics, when one instrument plays a fixed note, and the other instrument changes pitch. The peaks are areas of high roughness, and the valleys are lower roughness. The notches in this plot line up perfectly with the intervals we use in music! The central valley is the interval of a perfect fifth. The other dips are other familiar intervals. This offers an explanation of why certain intervals are more "consonant" than others, and more.
In developing temperament systems, it was found that some approximations of notes are more tolarable than others. For example, we are very perceptive to a slightly-off 5th, but not to an adjusted 3rd. This might correspond graphically with the "steeper" valley of the 5th. Also, the shallower valleys reasonably match with what we consider less consonant intervals.
Helmholtz used this to explain quantitatively why a major 3rd played by a clarinet and oboe sounds better when the clarinet plays the lower tone (the clarinet sounds only odd harmonics).
I wrote this C# program to explore consonant intervals: when you click anywhere on the plot, you hear the interval at that point.
Source (including Matlab plots)
But do beats and perceived roughness really cause dissonance, or are they just correlated with dissonance? Helmholtz's theory does not explain everything. Even when beats are eliminated, the intervals sound dissonant. The notes of our scale are also found in the harmonic series. One could alternatively say that notes are consonant when their harmonics match. I found a paper here that notes many criticisms of Helmholtz and the theory of roughness. I will have to study this further.
References: "On the Sensations of Tone as a Physiological basis for the Theory of Music" by Hermann Helmholtz, translated by Ellis
Roughness Calculation Model by Vassilakis, 2007.
Sensory Theories of Musical Consonance