I mean, the study I remember (from when I was in some class 20 years ago or something, where we would have analyzed this sort of paper) showed that developers listening to music 1) completed the tasks at the same rate as the developers who were not listening to music, 2) reported the task being less boring than the developers who were not listening to music, and... 3) were much much less likely to notice that the code they had been asked to write was an elaborate maze of math that could be replaced with "return 0"; I thereby only listen to music while coding when I need to keep my morale up typing something I already pre-planned myself.
I wholeheartedly agree - I am working on a very technical new build at the moment and cannot listen to music when coding for it, but when I switch to maintaining stuff, I reach-out for my headphones.
Yeah I believe that could be true for the wider population, but the empirical evidence from my personal study into this shows that I’m completely incapable of any kind of extended concentration without entraining my neurons with repetitive beats. n = 1.
I find there's certain types of music I can and can't listen to if I want to be productive. If it's music I really like, and I'm humming along, or singing along to the lyrics in my head, I'm not gonna be able to focus on the work.
If it's more ambient music (like those "lo-fi beats to study to" livestreams that are always running on YouTube) I can usually let that run and be a replacement to the white noise coming from the fan in my room. But I still keep the volume pretty low.
For me there are gradients. Some tasks need a fair bit of concentration so I can't listen to music with vocals or a lot of dynamics. Some tasks need total concentration and I can't even listen to music at all.