Imagine being a kid with a piano keyboard in front of you, told you can play anything you want. Now imagine scientists watching exactly what happens in your brain during that moment of pure creative freedom.

That's exactly what Dr. Karen Barrett did at the University of California, San Francisco. Barrett, an assistant professor who studies how music affects health, wanted to understand something researchers hadn't explored much before: not what happens in the brains of expert musicians, but what happens in the brains of children just being kids.

"There's all this work in creativity about expertise," Barrett explained on a podcast interview. "These trained musicians have had years of practice. But what about the beginners? What about kids?"

Kids are famous for creativity. Their brains are still building themselves, growing and changing faster than adult brains do. Barrett wanted to catch that raw creativity in action.

She invited children aged 7 to 17 into her lab and taught them something simple on a small keyboard: just one musical scale. Then she placed them inside a special brain-scanning machine called an fMRI, which takes pictures of brain activity. She asked them to play that scale from memory. Then she asked them to improvise — to make up their own music, right there on the spot.

What she found was striking. When the children improvised, something remarkable happened in their brains: a region called the dorsolateral prefrontal cortex went quiet. That's the part of the brain that helps us judge ourselves, that little voice that says "that sounds weird" or "maybe don't do that." In other words, improvisation seemed to switch off the brain's self-criticism center.

At the same time, another region lit up: the medial prefrontal cortex, which is involved when we want to express our own creative voice.

When Barrett plotted the brain images, she saw mostly blue — deactivation — with pockets of red activation where the creative areas kicked in.

"Improvisation is a form of generative creativity," Barrett said. "You're suddenly on the spot, within a certain context, trying to create music."

Barrett herself grew up surrounded by music. Her father was a scientist and classical guitarist; her mother played piano. She started piano at age 5 and later combined her love of music with her love of science, eventually landing at UCSF to study how music affects the brain.

The findings suggest that the ability to create freely isn't just something only trained professionals can do. It might be hardwired into all of us — especially children. And that could matter for how we think about education, therapy, and creativity at any age.

"I think improv has made me less rigid," Barrett said. "There's no right or wrong way; there just is. If you make a mistake, do it over and over again, and it's no longer a mistake."