When the office is almost too much to stomach, music can deliver much-needed relief on the job. Before you press Play, however, have a handle on when your tunes will be most beneficial for you and your brain.

Learning = Stop

Learning requires your brain to analyze and remember instructions and facts. When music is on, however, your brain has to process auditory data on top of processing the instructions and facts. Because of this multitasking, the brain can interpret the instructions and facts improperly, either associating them in odd ways or making mistakes about what’s important enough to store. Thus, if you have to learn something at work, it’s best to turn off your music, especially if you’re learning verbally or through reading and the music has lyrics.

Noisy = Play

If your workspace is noisy, the brain will try to handle all the individual pieces of data in the noise. All that data processing takes energy you otherwise could use to focus on your job. It also increases levels of the stress-hormone cortisol and decreases levels of dopamine. Those hormonal changes negatively affect the prefrontal cortex, hindering executive function. Thus, productivity can go down, even if doing your required task doesn’t require you to learn. In this scenario, listening to music can actually help, because it blocks out the other excessive input that could overwhelm you and keeps you calm.

Repetitive Job = Play

Various studies have indicated that, in general, people who listened to music while they worked on repetitive tasks performed faster and made fewer errors. These results occur because music you like triggers the release of feel-good neurotransmitters such as dopamine, serotonin and norepinephrine, which help you feel relaxed and happy and, therefore, focus better. This is true even when the task you’re doing is complex–surgeons routinely listen to music in the operating room specifically because it relieves the stress that could compromise their focus and performance. An improved mood from music also affects how you interact with your co-workers. If you feel better, you usually are more respectful, patient, and cooperative, which can lead to better teamwork.

New Music = Stop

When you listen to music that’s new to you, the activity involves an element of surprise or novelty. Your body releases dopamine in response to this “newness,” causing you to feel some degree of pleasure. That ultimately can make the music more appealing than whatever other task you’re trying to do, drawing your attention to the tune and compromising your work focus.

The Chorus to Remember

Music can make a huge difference in your workday. Feel free to crank up the volume if noise has you working like a snail, you’ve got a case of the Mondays, or you’ve got something mundane or familiar to do. Ideally, though, make your playlists out of songs you already know, and if your tasks involve any sort of linguistic processing, focus on lyric-free options. Lastly, if you have something to learn, pump up your mood with music before you get started.