All matter in the natural world resonates. When an object is acted on by a force (push or pull action), or struck (as in an instrument) it produces a tone, or note.
When an object in the natural world produces a sound, the frequencies in that tone are actually several simultaneous rates of vibration that relate mathematically as integer multiples of each other. Each object, instrument, voice, etc. has a unique signature series of overtones that defines it. This is called timbré (TAHM-br, French word).
The sound reaches us, and via mechanotransduction, we turn the mechanical stimulus of air on the tiny hairs lining our ear canal into various biochemical signals. Our brain interprets the data and detects spatial location and reverb. Furthermore, it assigns pitch, which does not exist in the physical world, but is something our brain uses to separate the spectrum of sound, much like color.
The processing takes place in the cerebellum, which evolutionary speaking, is most ancient structure of our brain. This is also where emotion and movement take place. Neurons fire synchronously, providing coherence in music.
Music is organized sound
When we began to consciously organize sounds, cultures collectively started to deem certain pitches "legal", and create frameworks of legal pitches into scales. Every known system of scales is divided into 12 intervals, and are comprised of whole steps and half steps of "semi-tones".
The relative intervals of tones in a scale are the basis of melodies. Melody can go through transformations in loudness, rhythm and timbre and still retain their identity as long as the relative distances between tones remains the same.
In addition to pitch and the scales we deem acceptable, our mental framework assigns several other dimensions to music.
All of these dimensions can be perceived and analyzed separately, without affecting the others.