Skip to content
o.o
Go back

Rain Ambience

Listen & Download

🌧 Rain Sound

00:00.0 ELAPSED
bit
/
rate
/
ch
75%

Original volume: — adjust the slider to change playback volume

Ad Space

What Is This Sound?

This is a synthesized rain sound created entirely using the Web Audio API — no audio samples or recordings involved. Every raindrop-like texture you hear is generated in real-time by your browser using pure mathematics and signal processing.

Rain is one of the most commonly requested ambient sounds for focus, sleep, relaxation, and meditation. This version produces a continuous, gentle rainfall ambiance that loops seamlessly.

How Is Rain Sound Created with Code?

The sound of rain is essentially filtered noise. Here’s the breakdown of how this works:

Step 1: Generate White Noise

White noise contains all frequencies at equal intensity — it sounds like a harsh “shhh.” In code, we create it by generating random values between -1 and 1 for each audio sample:

const bufferSize = 2 * audioContext.sampleRate;
const buffer = audioContext.createBuffer(1, bufferSize, audioContext.sampleRate);
const data = buffer.getChannelData(0);
for (let i = 0; i < bufferSize; i++) {
  data[i] = Math.random() * 2 - 1;
}

Step 2: Apply a Bandpass Filter

Raw white noise doesn’t sound like rain. To get that characteristic rain texture, we pass the noise through a bandpass filter centered around 800Hz with a low Q factor. This removes the harsh high frequencies and the muddy low frequencies, leaving the “patter” quality of rain:

const bandpass = audioContext.createBiquadFilter();
bandpass.type = "bandpass";
bandpass.frequency.value = 800;
bandpass.Q.value = 0.5;

Step 3: Add Natural Variation with an LFO

Real rain doesn’t have a constant volume — it ebbs and flows. We simulate this with a Low Frequency Oscillator (LFO) that gently modulates the output volume:

const lfo = audioContext.createOscillator();
lfo.frequency.value = 0.3; // Very slow oscillation
const lfoGain = audioContext.createGain();
lfoGain.gain.value = 0.1;
lfo.connect(lfoGain);
lfoGain.connect(gainNode.gain);

Step 4: Connect the Signal Chain

The final signal chain is: Noise → Bandpass Filter → Gain (with LFO modulation) → Speakers

Ad Space

The Science Behind Rain Sound

Why Does Filtered Noise Sound Like Rain?

Rain produces sound through thousands of individual water droplets hitting surfaces at random intervals. Each droplet creates a tiny burst of broadband noise. When combined, these random impacts create a texture that is statistically very similar to band-limited noise — which is exactly what we’re generating with code.

The center frequency of 800Hz corresponds to the dominant frequency range of actual rainfall hitting hard surfaces, as documented in acoustic research.

Frequency Spectrum

ParameterValue
Noise TypeWhite noise (broadband)
FilterBandpass at 800Hz
Q Factor0.5 (wide bandwidth)
LFO Rate0.3Hz (gentle variation)
Output Level-10dB (comfortable listening)

Common Uses

Technical Details

PropertyValue
FormatWAV (PCM 16-bit / 24-bit / 32-bit float)
Sample Rate44,100 Hz / 48,000 Hz
ChannelsMono / Stereo
Duration3 seconds (loopable)
GenerationWeb Audio API
LicenseFree for personal and commercial use

Ad Space

Frequently Asked Questions

Can I use this sound in my project?

Yes. The sound is generated by code in your browser. The output WAV file is yours to use freely in any personal or commercial project.

Why does the downloaded file sound slightly different each time?

Because the sound is generated using random noise, each render produces a unique waveform. The overall character remains the same, but the exact sample values differ — just like real rain is never exactly the same twice.

How do I make it loop seamlessly?

The downloaded 3-second WAV file can be looped in most audio software or game engines. For seamless looping, import it into a DAW and apply a short crossfade at the loop point.

Can I modify the sound?

Absolutely. You can adjust the filter frequency (try 400Hz for heavier rain, or 1200Hz for lighter drizzle), change the Q factor, or modify the LFO rate to create different rain intensities. The code is explained above — experiment with the values.


Related Sounds

Share this post on:

Previous Post
Babbling Brook