In music, harmony manifests itself as a pleasing sensation in the listener as the ear discerns more than one distinct source of sound. The sensation differs depending on the relationships of the frequencies of these sources of sound. What follows is an explanation of these relationships, and why they produce the effects they do. The text itself is put as simply as possible. If you are looking for more detailed or thorough reading, look for pipelinks.

Sound exists as waves in a material medium- alternating motions of the atoms that make up the material itself. These waves can be represented by many simpler waves that stack on top of each other like the waves in a pond that pass through each other, each of a single pitch.

The ear and brain, charged with the survival task of relating the sounds heard to real objects that exist in the environment, first represent the continuous stream of sound coming into the ear as many of these simpler waves. However, the ear is a physical mechanism, so it does not do its job with mathematical perfection. When trying to separate these simpler waves (called "partials") out of the more complicated signal, the ear can become confused with partials that are close to each other in pitch. The brain perceives this confusion as dissonance. The sensation of dissonance is related to the sensation of harmony in many of the same ways that pain is related to pleasure.

Partials that are close to each other in frequency cause confusion for the ear. Partials that are far enough apart that they can be distinguished easily do not. Partials that are so very close to each other that the ear takes them without question to be the same frequency not only do not cause confusion for the ear, but take on a variation in volume called "beating" that in the writer's opinion is central to creating the sensation of harmony in the ear as opposed to simply the lack of dissonance.

In the context of music, we can predict when partials will be close enough to be perceived as one, when they will confuse the ear, and when the partials will not interfere with the perception of each other at all. Most musical sounds- with the exception of some metallic or bar-shaped instruments- have what is called "harmonicity", in which all of the partials have frequencies that are multiples of some fundamental frequency. The relationships that the partials have to each other can be derived from the relationships that each of the fundamental frequencies has with the others.

Let us take this abstract discussion into a more concrete place. Here's an illustration of the interactions of two notes, C4 and E4, assuming A4 = 440 Hz (although we will see later that this assumption does not change anything).

+-------------------+
|    Frequencies    |
|      present      |
+---------+---------+
|    C    |    E    |
+---------+---------+
|         |         |  200
|         |         |
|         |         |
|  261.6  |         |            Fundamental frequency of C4
|         |         |  300
|         |  329.6  |            Fundamental frequency of E4
|         |         |
|         |         |
|         |         |  400
|         |         |
|         |         |
|         |         |
|         |         |  500
|  523.3  |         |            ---+
|         |         |               |
|         |         |               |
|         |         |  600          |
|         |         |               |    These partials are widely
|         | 659.2   |            ---+--  spaced; the ear has no
|         |         |               |    trouble distinguishing them.
|         |         |  700          |    
|         |         |               |
|         |         |               |
|  784.8  |         |            ---+
|         |         |  800
|         |         |
|         |         |
|         |         |
|         |         |  900
|         |         |
|         |         |                    These partials are within a
|         |  988.9  |            ---+    critical bandwidth of each
|         |         |  1000         |__  other.  Any frequencies that
|         |         |               |    are this close (within a factor
| 1046.5  |         |            ---+    of about 1.2) are difficult
|         |         |                    for the ear to distinguish and
|         |         |  1100              cause dissonance.
|         |         |
|         |         |
|         |         |
|         |         |  1200
|         |         |
|         |         |                    These frequencies are aligned
|         |         |                    and merge in the ear to become
| 1308.1  | 1318.5  |  1300      ------  one tone at 1313Hz, pulsating at the 
+---------+---------+                    difference of their frequencies,
                                         in this case, 10 Hz.

Technically, the series of partials for both notes would continue on to infinity, but the series up to this point serve as adequate illustration. These two notes have some partials that do not interact, some partials that cause dissonance, and some partials that merge. In a purely physical sense, the sensation experienced when a C and an E play simultaneously is a mixture of harmony and dissonance.

To predict whether two notes sounded together will be harmonious, dissonant, or some combination thereof, we can examine the relationships of the fundamental frequencies- in specific, the ratio of the fundamental frequencies (called the "interval" between the two notes). If two notes have fundamental frequencies that are multiples of each other, then the partials of the two notes (also multiples of the fundamental frequencies) will align with each other and produce harmony. If the interval between two notes is some simple ratio, such as 3/2 or 4/3, then the partials of one note will sometimes align and sometimes cleanly miss the partials of the other- which also produces harmony.

Oftentimes, though, the interval between notes is a hellish ratio, such as 729/512, or worse yet, not even a rational number at all- like 1.059... In this case, the partials of one note will not align with or cleanly miss the partials of the other, but they will fall within a critical bandwidth of each other and produce dissonance. The 12-tone equal temperament system of tuning used almost universally in Western music uses irrational intervals between notes- specifically chosen to be as close as possible to pleasing rational intervals. Most of the time, these irrational approximations to rational intervals work, and at any rate the typical Western listener has been conditioned to think that they do. In the example given above, with C4 and E4, the ratio is the fourth root of 2, or 1.2599... This is pretty close to the rational interval 5/4 = 1.25, though the ear can definitely tell the difference.

Summing it all up

Harmony, a pleasing sensation complementary to dissonance, occurs in a listener perceiving more than one source of sound at one time. When the component frequencies of the different sound sources align well, harmony is perceived; when the component frequencies are close but not close enough, they confuse the ear and produce dissonance. It is possible to predict from the fundamental frequency of musical sounds how a combination of notes will sound; the closer the sounds are to a simple rational interval, the more harmonious the combination.

All of that text, and I haven't even touched on triads, chords, or on the names and natures of the intervals... I'll leave that to another noder.