Focus · 4 min read

Sound for coding: what to play while you program

A function half-built in your head is fragile. The right sound keeps the room from knocking it over, and the wrong playlist does the knocking itself. What to play for each kind of programming work.

Drift's Focus scene: a warm violet sky with slow stars drifting over a soft horizon

Why sound for coding is a working memory problem

A programmer holds a lot in their head that is not on the screen: the shape of the function being written, the reason the last approach failed, the call site that still needs changing. That stack lives in working memory, and words are the thing most likely to overwrite it. The mind parses language whether it was asked to or not, and every parsed sentence costs a little of the stack. So the first rule for any sound for coding is no words. The second is that different kinds of programming want different amounts of sound, which is why a playlist that was fine at 10 AM is unbearable at 3 PM.

Writing new code: a steady bed with nothing to follow

When you are building something new, you want the room to disappear. Drift's Focus place is soft tones with an occasional pluck, nothing that repeats or resolves. Creek is the brighter option, running water made of many small voices with no rhythm, for developers who find tones sleepy. Pick one, set it low enough that you forget it inside 10 minutes, and leave it alone, because changing tracks is itself a context switch. The focus sounds page and the creek sounds page let you hear both first.

Debugging: turn it down, or off

Debugging is reading, not building: stack traces, log lines, the one condition that is wrong. Reading is closer to listening than most people think, and a sound that was invisible while you typed can get in the way once your eyes are hunting across text for the odd thing out. Many programmers halve the level for a hard bug, or stop it. Silence is the right setting for some work, and noticing which work is worth more than any mix.

Reading docs and reviewing: rain

Documentation and pull requests sit between the two. The reading is slower and less tense, and the office is often louder in the afternoon when the reviews pile up. Rain covers the room with an even texture and no events to track. Turn Tone down so it loses its patter and becomes a hush, and the comment you are writing keeps its thread while the sales team takes a call behind you.

Long sessions: 50/10 and a reason to look away

A long coding day is hard on the eyes and on judgement. The Focus 50/10 session runs 50 minutes of work, a soft bell, 10 minutes with the sound settled lower, then two bells to call you back. The bell is the point. Left alone, most programmers stare at a screen for two hours straight, and the last twenty minutes produce the code that gets reverted tomorrow. Stand up at the bell, look at something far away, come back. The calm focus sessions post covers the rhythms, the bells and the keyboard shortcuts.

In an office: headphones, low, with the room still audible

In an open office the sound goes through headphones, never a speaker, at a level where someone saying your name still lands. Noise-cancelling headphones help here: they remove most of the hum on their own, so the sound on top can be very quiet, which is kinder to your ears. If you are turning the sound up to beat the room, the room has won, and a meeting room for an hour is the better fix.

Three things that break a coding session

A chorus: anything with a hook pulls you into waiting for it, so instrumental or ambient only. A voice: a podcast feels like company, but it is language, and it will take the function out of your head within a minute. A playlist that ends: the silence after it is a change, and a change is an interruption. Drift's places run as long as the timer says, with no end and no advert.

Writing blockFocus on a low level, through headphones, with the 50/10 session running.
Play Focus

Questions

Is sound for coding better than silence?

For writing new code in a noisy room, a steady sound usually beats silence because it covers the room. For debugging in a quiet room, silence often wins. Try each for a week on the same kind of task.

Is music for programming a bad idea?

Not if it has no lyrics and no strong melody, and you know it so well that nothing surprises you. New music, anything with a chorus and anything that ends after forty minutes all cost attention.

What is the best background noise for coding in an open office?

A soft focus sound or rain through headphones, at a level where you can still hear your name. Noise-cancelling headphones let you keep the sound very quiet.

What to listen to while coding if I keep getting distracted?

Try less, not more. Turn the level down, switch to a sound with fewer events, or work in silence for the hard parts and bring the sound back for the routine ones.

Written by the Drift team · More from the blog