Musical acoustics

Musical acoustics or music acoustics is a multidisciplinary field that combines knowledge from physics, psychophysics, organology (classification of the instruments), physiology, music theory, ethnomusicology, signal processing and instrument building, among other disciplines. As a branch of acoustics, it is concerned with researching and describing the physics of music – how sounds are employed to make music. Examples of areas of study are the function of musical instruments, the human voice (the physics of speech and singing), computer analysis of melody, and in the clinical use of music in music therapy. 
The pioneer of music acoustics was Hermann von Helmholtz, a German polymath of the 19th century who was an influential physician, physicist , physiologist, musician, mathematician and philosopher. His book "" is a revolutionary compendium of several studies and approaches that provided a complete new perspective to music theory, musical performance, music psychology and the physical behaviour of musical instruments.
Physical aspects.
Whenever two different pitches are played at the same time, their sound waves interact with each other – the highs and lows in the air pressure reinforce each other to produce a different sound wave. Any repeating sound wave that is not a sine wave can be modeled by many different sine waves of the appropriate frequencies and amplitudes (a frequency spectrum). In humans the hearing apparatus (composed of the ears and brain) can usually isolate these tones and hear them distinctly. When two or more tones are played at once, a variation of air pressure at the ear "contains" the pitches of each, and the ear and/or brain isolate and decode them into distinct tones.
When the original sound sources are perfectly periodic, the note consists of several related sine waves (which mathematically add to each other) called the fundamental and the harmonics, partials, or overtones. The sounds have harmonic frequency spectra. The lowest frequency present is the fundamental, and is the frequency at which the entire wave vibrates. The overtones vibrate faster than the fundamental, but must vibrate at integer multiples of the fundamental frequency for the total wave to be exactly the same each cycle. Real instruments are close to periodic, but the frequencies of the overtones are slightly imperfect, so the shape of the wave changes slightly over time.
Subjective aspects.
Variations in air pressure against the ear drum, and the subsequent physical and neurological processing and interpretation, give rise to the subjective experience called "sound". Most sound that people recognize as musical is dominated by periodic or regular vibrations rather than non-periodic ones; that is, musical sounds typically have a definite pitch. The transmission of these variations through air is via a sound wave. In a very simple case, the sound of a sine wave, which is considered the most basic model of a sound waveform, causes the air pressure to increase and decrease in a regular fashion, and is heard as a very pure tone. Pure tones can be produced by tuning forks or whistling. The rate at which the air pressure oscillates is the frequency of the tone, which is measured in oscillations per second, called hertz. Frequency is the primary determinant of the perceived pitch. Frequency of musical instruments can change with altitude due to changes in air pressure.
Harmonics, partials, and overtones.
The fundamental is the frequency at which the entire wave vibrates. Overtones are other sinusoidal components present at frequencies above the fundamental. All of the frequency components that make up the total waveform, including the fundamental and the overtones, are called partials. Together they form the harmonic series.
Overtones that are perfect integer multiples of the fundamental are called harmonics. When an overtone is near to being harmonic, but not exact, it is sometimes called a harmonic partial, although they are often referred to simply as harmonics. Sometimes overtones are created that are not anywhere near a harmonic, and are just called partials or inharmonic overtones.
The fundamental frequency is considered the "first harmonic" and the "first partial." The numbering of the partials and harmonics is then usually the same; the second partial is the second harmonic, etc. But if there are inharmonic partials, the numbering no longer coincides. Overtones are numbered as they appear "above" the fundamental. So strictly speaking, the "first" overtone is the "second" partial (and usually the "second" harmonic). As this can result in confusion, only harmonics are usually referred to by their numbers, and overtones and partials are described by their relationships to those harmonics.
Harmonics and non-linearities.
When a periodic wave is composed of a fundamental and only odd harmonics (f, 3f, 5f, 7f, ...), the summed wave is "half-wave symmetric"; it can be inverted and phase shifted and be exactly the same. If the wave has any even harmonics (0f, 2f, 4f, 6f, ...), it is asymmetrical; the top half is not a mirror image of the bottom.
Conversely, a system that changes the shape of the wave (beyond simple scaling or shifting) creates additional harmonics (harmonic distortion). This is called a "non-linear system". If it affects the wave symmetrically, the harmonics produced are all odd. If it affects the harmonics asymmetrically, at least one even harmonic is produced (and probably also odd harmonics).
Harmony.
If two notes are simultaneously played, with frequency ratios that are simple fractions (e.g. 2/1, 3/2 or 5/4), the composite wave is still periodic, with a short period—and the combination sounds consonant. For instance, a note vibrating at 200 Hz and a note vibrating at 300 Hz (a perfect fifth, or 3/2 ratio, above 200 Hz) add together to make a wave that repeats at 100 Hz: every 1/100 of a second, the 300 Hz wave repeats three times and the 200 Hz wave repeats twice. Note that the total wave repeats at 100 Hz, but there is no actual 100 Hz sinusoidal component.
Additionally, the two notes have many of the same partials. For instance, a note with a fundamental frequency of 200 Hz has harmonics at: :(200,) 400, 600, 800, 1000, 1200, …
A note with fundamental frequency of 300 Hz has harmonics at: :(300,) 600, 900, 1200, 1500, … 
The two notes share harmonics at 600 and 1200 Hz, and more coincide further up the series.
The combination of composite waves with short fundamental frequencies and shared or closely related partials is what causes the sensation of harmony. When two frequencies are near to a simple fraction, but not exact, the composite wave cycles slowly enough to hear the cancellation of the waves as a steady pulsing instead of a tone. This is called beating, and is considered unpleasant, or dissonant.
The frequency of beating is calculated as the difference between the frequencies of the two notes. For the example above, |200 Hz - 300 Hz| = 100 Hz. As another example, a combination of 3425 Hz and 3426 Hz would beat once per second (|3425 Hz - 3426 Hz| = 1 Hz). This follows from modulation theory.
The difference between consonance and dissonance is not clearly defined, but the higher the beat frequency, the more likely the interval is dissonant. Helmholtz proposed that maximum dissonance would arise between two pure tones when the beat rate is roughly 35 Hz. 
Scales.
The material of a musical composition is usually taken from a collection of pitches known as a scale. Because most people cannot adequately determine absolute frequencies, the identity of a scale lies in the ratios of frequencies between its tones (known as intervals).
The diatonic scale appears in writing throughout history, consisting of seven tones in each octave. In just intonation the diatonic scale may be easily constructed using the three simplest intervals within the octave, the perfect fifth (3/2), perfect fourth (4/3), and the major third (5/4). As forms of the fifth and third are naturally present in the overtone series of harmonic resonators, this is a very simple process.
The following table shows the ratios between the frequencies of all the notes of the just major scale and the fixed frequency of the first note of the scale.
There are other scales available through just intonation, for example the minor scale. Scales that do not adhere to just intonation, and instead have their intervals adjusted to meet other needs are called "temperaments", of which equal temperament is the most used. Temperaments, though they obscure the acoustical purity of just intervals, often have desirable properties, such as a closed circle of fifths.