Some people wake up at the drop of a pin; others snooze through their alarms every morning. Whether you can sleep through noise has a lot to do with the brain waves you produce while you sleep, according to a new study published in Current Biology. And good news for insomniacs: it might one day be possible to manipulate these waves to ensure a good night’s rest.

Previous research has shown that when people sleep, the thalamus—a brain structure that connects the high-level thought areas with the sights and sounds of the outside world—produces brief, high-frequency brain waves called spindles. Scientists speculated that these spindles shut out environmental sounds during sleep. To find out, Jeffrey Ellenbogen, chief of the division of sleep medicine at Harvard University’s Massachusetts General Hospital, and his colleagues asked 12 healthy people to spend three nights in his sleep lab. The first night the researchers measured spindle activity while the subjects slept individually in quiet rooms. The second and third nights the researchers relentlessly bombarded each snoozing participant with recordings of common noises such as toilets flushing, phones ringing and people talking, starting each noise at a low volume and repeating it more and more loudly until the subject was aroused from sleep. Then they repeated the process as soon as the person fell asleep again.

The researchers discovered that “the more spindles one has, the more likely they are able to stay asleep when they are confronted with sounds,” Ellenbogen explains. Compared with subjects who produced few spindles on the first night, those who produced many had to be bombarded with louder sounds to wake up. Because spindle production dwindles with age, the findings could explain why older people frequently complain of poor sleep.

In future research, Ellenbogen plans to explore why some people produce more spindles than others. Eventually he hopes to find drugs or devices that will boost natural spindle production and induce better sleep. “The capacity of our brain to block out at least some sound is truly amazing, given that our ears are wide open all night long,” he says.