The general argument that music can aid learning is true, but itdepends on a variety of variables, including the nature of the music, the nature of the task, and variability in individual cognitive capacity. Empirical evidence has suggested that listening to upbeat instrumental or "groovy" music will enhance cognition and mood. For instance, a PLOS ONE study published by The Times found that people who listened to fast-paced rhythmic music completed tasks some 7% faster without sacrificing accuracy and also reported feeling more upbeat. Researchers attributed these benefits to the rhythmicity of the music, which can boost alertness and mental agility. However, the impact of music on learning is not always positive. Studies show that music can be useful in the context of routine, repetitive activities when it can keep boredom at bay and boost motivation but distracting when one needs to focus very hard on more complicated tasks. This is particularly true for music with words, which has been shown to disrupt reading comprehension as well as other tasksinvolving high cognitive processing. Also, there are huge individualdifferences. Research conducted in Frontiers in Psychology indicates that people with higher working memory capacity perform better underbackground music when studying. Nevertheless, people with lower working memory capacity perform better without background music.
https://www.discovermagazine.com/mind/how-does-music-impact-your-brain-and-workflow