White Noise Generator
White, pink, and brown noise for focus and sleep — synthesized in your browser
Equal energy at every frequency — masks distractions
Not all noise sounds the same, and the color you choose matters more than the volume. This generator synthesizes white, pink, and brown noise live in the browser with the Web Audio API. There are no looped audio files, no streaming, and no uploads — the waveform is computed sample by sample, with click-free fades and a 15, 30, or 60 minute sleep timer.
The Three Noise Colors, Compared
The naming comes from the shape of the frequency spectrum, not from sound or tint.
| Color | Spectrum slope | Character | Often used for |
|---|---|---|---|
| White | Flat (equal energy per frequency) | Bright, hissy, like a fan on high | Masking sudden sounds, testing speakers |
| Pink | -3 dB per octave | Balanced, softer, like steady rain | Focus, office masking, sleep onset |
| Brown | -6 dB per octave | Deep, warm rumble, like a waterfall | Deep sleep, calming, low-frequency masking |
White noise puts the same energy at every frequency, so its top end dominates perceptually. Each octave higher doubles the number of frequencies carrying energy, which is why a flat spectrum sounds so bright.
How Each Color Is Synthesized
White draws uniform random samples in the range -1 to 1 for every position. It is the raw material for the other two.
Pink runs the white stream through three parallel first-order low-pass rows, each keeping a leaky state updated as state = leak * state + input * white. The rows use leaks of 0.99765, 0.963, and 0.57 with inputs of 0.099046, 0.2965164, and 1.0526913; a direct path adds 0.1848 * white. The summed result is boosted by a fixed 0.05 gain and clamped to stay in range. This approximates a -3 dB/octave falloff, the same slope as pink light.
Brown integrates the white stream with a leak that prevents unbounded drift: next = (prev + 0.02 * white) / 1.02. The output is multiplied by 3.5 to bring the very quiet integrator output up to a usable level. Integration emphasizes low frequencies, producing the characteristic rumble.
How to Use
- Choose a color from the three buttons. A one-line description under them explains the current selection.
- Press Play. The sound fades in over 200 ms rather than starting abruptly.
- Adjust the volume slider; changes apply immediately with no restart.
- Switch colors freely while playing to compare them at the same volume.
- Tap 15, 30, or 60 for a sleep timer, or Off to cancel one.
The Sleep Timer and Fade Behavior
Choosing a preset starts playback if it is not already running and begins a countdown shown as MM:SS. The remaining time is computed as duration - elapsed, clamped at zero, and the display ceils partial seconds so it never reads 0:00 while sound is still playing. When the countdown expires, the volume ramps to silence over 200 ms and playback stops. That ramp is deliberate: cutting a raw signal creates a transient you would hear as a click, and an abrupt silence can be as disruptive to sleep as an alarm.
Every other transition uses the same ramp. Starting, stopping, and switching colors all interpolate gain linearly across 200 ms, which is why the tool never pops.
Masking, Volume, and Color Choice
Masking works by overlap. Your ears detect a sound when energy appears in a frequency band above the background level, so a steady signal spread across the same bands raises that floor and hides the detail. White noise covers the widest range and is best against sharp, high-pitched interruptions such as a door latch or a phone notification. Pink noise concentrates more of its energy where speech lives, which makes it effective against nearby conversation and keyboard clatter. Brown noise leans low and is better at covering traffic rumble and footsteps from another floor.
The practical rule is to match the masker to the nuisance: if the offending sound is bright, choose a brighter color; if it is a low thud, choose brown. Raising the volume always masks more, but it also risks becoming the thing that keeps you awake.
For focus, start with pink at a volume just below the level where you notice it; the goal is to raise the noise floor above keyboard clatter and distant conversation, not to compete with it. For sleep, brown at low volume leans on the low end, which carries through walls and pillows less than white’s high frequencies. If you share a bed, white noise is the most likely to be heard by a partner because its brightness travels. Try each color for a few minutes before deciding; the difference between pink and brown is most obvious once your ears have adjusted.
Limitations Worth Knowing
The synthesis runs on the main thread when the audio buffer is generated, so a very old device may stutter for a moment at startup. Because the noise is freshly randomized each session, the “sound” is never the same twice — that is normal and avoids the obvious looping of a one-minute audio file, but it also means you cannot reproduce an exact track.
Mobile browsers are the main practical restriction: backgrounding the tab or locking the screen often suspends the audio context, so the timer may not help if the phone stops playback the moment the screen goes dark. Keep the screen on if you rely on the timer on mobile.
Related Tools
- Tone Generator — Produce sine, square, and other waveforms at exact frequencies.
- Audio Visualizer — See waveforms and frequency spectra as audio plays.
- Sleep Calculator — Work out the best bedtime or wake-up time around sleep cycles.
Frequently Asked Questions
Why does pink noise sound quieter than white noise at the same slider setting?
Pink noise carries less energy in the high frequencies, where human hearing is most sensitive, so it reads as softer even at an identical volume. The generator also applies a fixed output gain of 0.05 to the pink filter bank to keep its RMS in a usable range, which bakes in a further level difference from white.
What filter values produce the pink and brown noise?
Pink uses Paul Kellet's economy filter bank, three first-order low-pass rows with leak/input pairs of (0.99765, 0.099046), (0.963, 0.2965164), and (0.57, 1.0526913), summed with a direct white path at 0.1848 gain. Brown uses a leaky integrator with a step of 0.02 and a 3.5 output gain.
Does the sleep timer stop the audio instantly when it reaches zero?
No. At zero the gain ramps down to silence over 200 ms, so the transition does not create an audible click or a sudden drop that could wake you. The countdown updates once per second and rounds partial seconds up so it never shows 0:00 while time remains.
Can I leave the generator running all night?
On a desktop browser, yes; playback continues in a background tab while the audio context stays active. Many mobile browsers suspend audio when the tab is backgrounded or the screen locks, so the sound may stop. There is no audio file to loop and no upload, so leaving it running does not create network traffic.
Why does switching from white to pink mid-playback not stop the sound?
The generator crossfades one type into the other instead of tearing down the audio graph. New samples are scheduled while the old source fades out, so you hear a smooth change of color rather than a gap.
Can I mask tinnitus with these tones?
Some listeners find steady broadband noise softens the perception of ringing, and white or pink at very low volume is the usual starting point. This tool is not a medical device; if tinnitus is persistent or distressing, speak with a hearing specialist rather than relying on self-treatment.
Reviewed by the HandyTools Hub team · Last updated