It's called the cocktail party effect, and it's a unique ability that's been a scientific mystery:
You're in a noisy room filled with voices. Yet you're able to shut out almost all of them, focusing only on the one person you're listening to.
To study this capability, UCSF neurosurgeon Edward Chang and his team took advantage of one of the rare opportunities researchers have to watch the human brain in action: during brain surgery on a patient with severe epilepsy.
Epilepsy surgery involves several stages. Before operating, neurosurgeons must identify where seizures are taking place, while also mapping out parts of the brain that are critical to functions like motor control and speech. To do this, surgeons remove the skull and place a grid of electrodes directly on the brain’s outer surface, or cortex. The electrodes record activity throughout the brain in real time.
Patients (who are conscious, believe it or not) are then asked to perform specific functions like counting to ten, and the electrodes tell scientists where in the brain the processing is taking place. Often patients allow neuroscientists to tack on a couple of extra exercises, purely for the sake of science. That's where Chang and his team came in.