For the last three months, I have been running an experiment on myself. xeve tracks both my Spotify listening history and my coding sessions — every heartbeat from VS Code and every track from Spotify, timestamped and stored side by side. I wanted to answer a question that every developer has an opinion on but few have data for: does music actually help you code?
The short answer is: it depends entirely on the kind of music, your familiarity with it, and what kind of coding you are doing. Here is what three months of correlated data revealed.
The Setup
xeve's Spotify integration polls the Spotify API every 30 seconds and records the currently playing track, artist, album, and genre. Simultaneously, the VS Code extension sends heartbeats on every keystroke, file save, and file switch. The correlation engine aligns these two data streams by timestamp, which means I can see exactly what I was listening to during any coding session and how that session compared to others.
Over 90 days, I logged roughly 340 hours of coding time and 280 hours of music. Not all coding happened with music — about 60 hours were in silence, which turned out to be one of the most interesting data points.
Finding 1: Instrumental and Electronic Music Correlates With Longer Sessions
The clearest signal in the data was session length. When I coded while listening to instrumental music — ambient electronic, lo-fi beats, film scores, post-rock — my average uninterrupted coding session lasted 47 minutes. When I coded with lyrical music (pop, hip-hop, rock with vocals), the average dropped to 28 minutes.
This was not a subtle difference. The instrumental sessions were 68% longer on average. They also had fewer app switches per hour — roughly 4 switches/hour with instrumental music versus 7 switches/hour with lyrics. App switches are a rough proxy for distraction: leaving VS Code to check Slack, glance at a browser tab, or open a terminal counts as a context switch.
The probable explanation is straightforward: lyrics compete for the same language processing circuits your brain uses to read and write code. Instrumental music does not. This is well-established in cognitive psychology research, but seeing it in my own data — with exact numbers attached — made it visceral.
Finding 2: Podcasts Are the Worst Background for Coding
I occasionally listen to tech podcasts while coding, usually during rote tasks like writing tests or updating configs. The data was unambiguous: podcast sessions had the shortest average duration (19 minutes) and the highest app-switch rate (11 switches/hour). Even worse, the coding that happened during podcast sessions tended to be shallow — more file browsing and config editing, less sustained work in a single file.
This makes intuitive sense. A podcast is literally someone talking to you. Your brain cannot help but process the speech, which means every sentence is a potential interruption. Even when the content is tangentially related to what you are coding, the act of comprehending spoken words pulls attention away from the symbolic manipulation that programming requires.
My takeaway: podcasts are for commutes and walks, not for coding. Even for "mindless" tasks, silence or instrumental music produces better focus.
Finding 3: Silence Is Shorter But More Varied
This was the surprise. I expected silence to produce the longest sessions — no distractions, pure focus. Instead, coding sessions that started in silence averaged 32 minutes, which is shorter than instrumental music sessions (47 minutes) but longer than lyrical music (28 minutes).
However, silent sessions had a unique characteristic: they had the highest file diversity. I touched more different files per session in silence than with any music. The pattern suggests that silence is better for exploratory coding — reading code, navigating a codebase, jumping between files to understand a system — while instrumental music is better for sustained production in a single area.
This aligns with something I have noticed anecdotally: when I am debugging a complex issue or tracing a data flow across multiple files, I instinctively turn off the music. When I am heads-down implementing a feature I already understand, I put on the same lo-fi playlist I always use.
Finding 4: Familiarity Matters More Than Genre
The most actionable insight from the data was about familiarity. I have a playlist I have listened to hundreds of times — a mix of Tycho, Bonobo, Emancipator, and similar artists. When coding to this playlist, my sessions averaged 52 minutes. When coding to new music I had never heard — even if it was instrumental and the same genre — sessions averaged 35 minutes.
New music, regardless of genre, introduces novelty. Your brain notices new melodies, unexpected chord changes, unfamiliar rhythms. That novelty is pleasant (which is why we seek out new music) but it is also a low-grade distraction. Familiar music fades into the background. It creates a consistent sonic environment without demanding attention.
The neuroscience supports this. Research on the "mere exposure effect" shows that repeated exposure to a stimulus reduces the cognitive load of processing it. A song you have heard 200 times requires almost zero conscious attention. A song you have never heard requires active listening, even if you do not intend to actively listen.
Finding 5: The Pavlovian Effect Is Real
After about six weeks of consistently starting my coding sessions with the same playlist, I noticed something in the data: time-to-first-commit (the gap between opening VS Code and making the first meaningful save) dropped from an average of 12 minutes to 7 minutes. The same playlist was becoming a cue — a signal to my brain that it was time to focus.
This is classical conditioning applied to productivity. The playlist becomes associated with deep work. After enough repetitions, pressing play triggers the same mental state that deep work produces. It is not magic — it is habit formation. But it is measurable, and the data shows it working.
What I Changed Based on the Data
After analyzing three months of correlated Spotify and coding data, I made three changes:
- One coding playlist, always. I stopped cycling through new music during work. I have one playlist of familiar instrumental tracks that I use exclusively for coding. New music is for evenings and weekends.
- No podcasts during code. Ever. Even for "easy" tasks. The data is too clear. Podcasts go on the walk or the commute.
- Silence for exploration, music for production. When I am reading unfamiliar code or debugging, I work in silence. When I know what I am building and I am heads-down implementing, the playlist goes on.
How to Track This Yourself
xeve's correlation engine automatically computes relationships between music listening and coding output. Connect your Spotify account in the integrations settings, and the dashboard will start showing your music patterns alongside your coding sessions. After a few weeks of data, the correlations page will surface your own patterns — which may be completely different from mine.
That is the key point. Generic advice about music and productivity is just that — generic. The research says instrumental music helps on average. But you are not an average. You might code best with death metal or complete silence or ambient rain sounds. The only way to know is to measure your own data and look at what actually correlates with your best sessions.
Track it. Measure it. Let the data tell you what works for you.