Listen & Download
🌧 Rain Sound
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
| Parameter | Value |
|---|---|
| Noise Type | White noise (broadband) |
| Filter | Bandpass at 800Hz |
| Q Factor | 0.5 (wide bandwidth) |
| LFO Rate | 0.3Hz (gentle variation) |
| Output Level | -10dB (comfortable listening) |
Common Uses
- Focus & Productivity — Rain sounds mask distracting background noise, helping with concentration during work or study sessions
- Sleep Aid — The consistent, non-threatening nature of rain sound helps many people fall asleep faster
- Meditation & Relaxation — Used as ambient background for mindfulness and breathing exercises
- Game Development — Use the downloaded WAV as ambient audio in games set in rainy environments
- Video Production — Layer over footage as ambient sound design
- App Development — Integrate into relaxation or focus timer apps
Technical Details
| Property | Value |
|---|---|
| Format | WAV (PCM 16-bit / 24-bit / 32-bit float) |
| Sample Rate | 44,100 Hz / 48,000 Hz |
| Channels | Mono / Stereo |
| Duration | 3 seconds (loopable) |
| Generation | Web Audio API |
| License | Free 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.