Listening to music while you work “significantly impairs” creativity. That was the conclusion of a study published earlier this year in the journal Applied Cognitive Psychology that examined the effect of different types of background music on creative problem solving.

For the study, UK researchers presented people with a series of word puzzles designed to measure creativity and “insight-based” processes. The study participants completed the puzzles either in a quiet space or in one with music playing in the background. Whether that music was familiar or unfamiliar, vocal or strictly instrumental, people’s scores on average fell on the creativity test compared to their scores in the quiet condition. “The findings challenge the view that background music enhances creativity,” the study authors wrote.

But don’t pitch your headphones or desk speaker just yet. More research on music and creativity has found that, depending on the kind of creative task a person is grappling with, certain types of music may be helpful.

A 2017 study in the journal PLOS ONE found that listening to “happy” music—defined as classical tunes that were upbeat and stimulating—helped people perform better on tasks that involved “divergent” thinking, which is a core component of creativity. Divergent thinking involves “making unexpected combinations, recognizing links among remote associates, or transforming information into unexpected forms,” the authors of that study wrote. Basically, divergent thinking is coming up with new, outside-the-box ideas or strategies.

“We can only speculate why happy music stimulates divergent thinking,” says Simone Ritter, coauthor of the PLOS ONE study and an assistant professor at Radboud University Nijmegen in the Netherlands. One theory put forward in her study is that the stimulating nature of lively music somehow energizes the brain in ways that promote a “flexible thinking style,” which leads to unconventional or innovative ideas.

There are other theories. Research has shown that listening to music can lower anxiety and improve mood, and these shifts could facilitate creative insights. “For breakthrough moments of creativity, positive mood is generally helpful,” says Mark Beeman, chair of psychology at Northwestern University and principal investigator at NU’s Creative Brain Lab. Meanwhile, if someone is anxious, “this [anxiety] tends to cause them to focus more, which is not helpful,” he says.

How could focusing on a creative problem be a bad thing? Beeman has spent two decades studying the brain and its creative processes, which he explores in his 2015 book The Eureka Factor: Aha Moments, Creative Insight, and the Brain. He explains that the process of creative problem solving tends to unfold in predictable stages.

The first stage, he says, involves studying a problem or dilemma, assessing the obvious solutions, and realizing that none of them works. “At this point, if you keep focusing too hard on a problem, that tends to make it more difficult for the brain to come up with different or novel ideas,” he says. He likens it to a dim star that disappears when you stare straight at it. “To see the star, you have to look at it out of the corner of your eye, and creative ideas may be like that too,” he says. “You need to take your focus off the strong, obvious ideas to avoid squashing the others.”

This is where music comes into play. Once a person has closely examined a problem and hit a roadblock, the next creative stage is one Beeman calls “incubation.” During this stage, “there’s some kind of continuing process in the mind where you’re still mulling the problem at an unconscious level,” he says. This incubation period often produces “aha!” insights or realizations—like when you can’t recall a word, but then it pops into your head later in the day, after you’ve thought you’d stopped thinking about it.

But not all activities foster incubation, Beeman says. “If you’re reading email or doing other demanding tasks, there aren’t enough background resources to do any work on the problem.”

Listening to music, on the other hand, may be just the kind of mild diversion that relaxes the brain’s focus while still allowing it to do its fruitful new-idea incubating, he says. And indeed, there’s evidence that listening to music can stimulate the brain’s default mode network, which is a collection of connected brain regions that research has linked to creative insight.

Beeman doesn’t dispute the results of the new study that found music impairs creative problem solving. He says music might not help people solve the type of verbal puzzle the study employed—which he himself helped design and validate years ago in an effort to better measure some aspects of creative thinking. This specific type of puzzle requires “multiple cognitive processes,” he says, some of which require “focused attention.” And all types of distraction—music included—may impair focused attention.

So if a person is in the midst of the first stage of creativity, the one that involves analyzing a problem and eliminating the obvious choices or solutions, background music probably isn’t helpful. “It’s either a distraction or you just block it out,” he says.

But if you’re stuck on a problem and you’re looking for creative inspiration, taking a break to listen to music or engage in idle “mind wandering” may allow the brain the freedom it needs to “dredge up” new ideas or insights, he says. He also cites research linking mind-wandering to creative inspiration.

In those cases, what type of music should you turn on? “I think that will vary a lot depending on the individual,” Beeman says. “For most, I think something that’s pleasant and familiar—not so novel that it’s distracting—would be helpful.”

Contact us at letters@time.com.