My opinion on music is an odd one in a world where most people claim music is their 'thing'. I consider it background noise. And that background noise can either help or hinder my writing. I base a song's worth by whether or not it conjures images of my book characters. If a particular song, say, reminds me of Ezra, I'll listen to it while writing about that particular character.
I have a handful of songs picked out and set aside for each character. Five Finger Death Punch's remake of 'Bad Company' works splendidly for Ezra. Redlight King's 'Bullet in my Hand' is about the relationship between Juliet and a character you'll meet much later in the Juliet Harrison series - Loic. Only recently did I find a song for Moyer Bennett, a recurring character: Five Finger Death Punch's 'Walk Away'.
There are more, but I just wanted to give you a feel of the type of music that chooses me. I tend to listen to the radio when I'm in the car, and I never know when or if I'll hear something. Music can also help me built tension for a fastpaced scene or help generate a serious moment.
Sometimes though, I simply prefer writing without it. Music has its own pace, and alot of times it's faster than I care to go, especially when extensive detail is required. I find when I listen to a fastpaced song during a heated moment, I have to later go back to the scene and write in the detail.
But while music can play an important part in my writing process, it can also negatively affect it. For Zombie Bowl, I couldn't listen to music at all. When I tried, I lost the ability to truly focus on that extremely detail-oriented perspective I needed. A key element of Zombie Bowl is atmosphere, and I couldn't really explore every nook and cranny of a scene with a faster paced song playing. So, no music. And I still haven't heard a song that triggers images about Dr. Z either.
Music has its good and bad points in writing, and for me, it just depends on my goal for each scene. It definitely has a purpose though. I just have to know how to use it correctly.