When we listen to music, sound waves enter the ear and cause specific parts in the middle and inner ear to vibrate in response to the stimulation. This converts sound into an electrical signal that travels up the brain stem to the auditory cortex located in the temporal lobe on both right and left sides of the brain. If the temporal lobe becomes damaged, a person may have trouble singing a song, playing an instrument, or keeping rhythm. There is even a rare condition in which someone can't recognize musical melodies, yet has no trouble hearing speech or other sounds.
Some studies have found that music is mostly processed by the right side of the brain, while others found the left side to be more dominant. MRI scans of people listening to music have shown that music activates many different parts of the brain in different people, including the visual cortex. This is because listening to music involves many different brain functions, such as memory, learning and emotions.
But there's one section that seems to be activated in everyone: the rostromedial prefrontal cortex (RPC). It can be found near the center of the forehead, and is linked to short- and long-term memory. This part of the brain seems to be where maps of melodies are stored. Whenever a person hears a musical pattern, a matching pattern is set up in the RPC. Perfect pitch, on the other hand, seems to be related to a tiny region called the left planum temporal, which is also involved in language processing.