DUTOIT A few years back in grad school I found some research that shows programmers pick up on more details of their work when not listening to music. They did some tests where they made two groups (music , no music) code up some specifications. In the end, both groups' code was functional just as asked. But the no music group caught some easter eggs the researchers put in like adding 2 to a variable very early on in the instructions and then subtracting 2 from the same variable at the end. The no music group left out these pointless instructions and other similar gotchas.
So in short, if you need to be more analytic and with much attention to detail, forgo the music. And if you need some creative inspiration forgo the details and let the music do the talking.