What do you reach for at the end of a bad day? If you’ve got a playlist for that, you already know the power of music.

But its medical benefits go beyond boosting your mood. Once a marginal alternative therapy, music is now recognized as constructive in reaching patients with disorders such as autism or Alzheimer’s.

The field has come a long way in the 20 years since Suzanne Hanser founded the Music Therapy Department at Boston’s Berklee College of Music. Hanser specializes in pain management and just completed an experiment at Boston Medical Center’s family medicine unit, using music therapy to aid in pain management and anxiety relief to cut the use of conventional medications, which often have negative side effects.

How it works: You may remember this trick from the Harry Potter books, but the first step is finding a happy memory and the music associated with it. “It might be something associated with marriage, birth or something their mother sang to them as a child,” Hanser explains. Then they create a mix of those songs for the patient to play when they’re in pain, whether physical or psychological.

Music balances brain and body chemistry: “Not only can listening to music that’s important to you allow the release of serotonin and dopamine, it’s also aiding release of the deeply relaxing neurochemicals, and that’s balancing the system. It gets rid of stress hormones. We’re not only bringing those positive neurochemicals, but we’re getting rid of the bad stuff. And there aren’t any side effects with music.”

There’s no  “right” music for every mood : Taking the recommendation of listening to a mellow track, or even nature sounds, to calm down may backfire. “If you’re really anxious, and you put on some slow music with long melodies and flowing themes, it might be so far from your emotional state that it’s not resonating with you,” says Hanser .

No one-size-fits-all cure: “My research puts an important personal meaning to therapeutic music,” so getting to know the patient’s musical taste is the key to designing a therapy that works for them. “For some people, they get into another zone with New Age music, while others find it agitating.”