I have a three week old baby. Occasionally she refuses to sleep. Some people tell me this is the way life is, some people tell me I need to buy things to fix it. This is becoming an alarmingly common pattern in this parenting game.

Anyway one of these things "I need to buy" is a white noise generator. White noise defined as:

a random signal is considered "white noise" if it is observed to have a flat spectrum over the range of frequencies that is relevant to the context. For an audio signal, for example, the relevant range is the band of audible sound frequencies, between 20 to 20,000 Hz.

There are several things I can buy. Apps for Android, dedicated boxes that I'm sure just play a tiny clip of pre-generated noise, all the way to mega-expensive true-random white noise generators.

I want to generate my own white noise sample

I know I could download one with youtube-dl from one of the many videos out there but copyright aside, frequency compression is horrible online I want full-white-frequency goodness. If such a thing actually exists. Plus I'm a glutton for punishment and I believe that if something can be done via the command line, that's the way we should be doing it. That's how I aim to raise this one anyway.

So we have things like /dev/urandom and paplay. Is there a sensible way to take random data and channel it into the audible range of white noise and out of my speakers? Answers that write to file are okay too. The important thing is a steady range-confined sample. No squawks.

Note: answers that generate the brown note will not be appreciated ☹

  • 29
    See other answers for the techie side. Practical me says that there are CDs of surf/rain/waterfall noise that may not be mathematically pure white noise but are probably much closer to the soothing ear-candy you are looking for (and likely at the origin of the reputation of the white noise).
    – xenoid
    Commented Jun 20, 2016 at 21:22
  • 5
    Would this work?
    – Mitch
    Commented Jun 20, 2016 at 21:30
  • 6
    The post that @Mitch pointed at is not in reference to the 'brown note'. "The term "Brown noise" does not originate from the color, but from Robert Brown who discovered Brownian motion."
    – Adrian
    Commented Jun 20, 2016 at 22:05
  • 4
    Tune the radio away from any channel?
    – gerrit
    Commented Jun 21, 2016 at 10:36
  • 13
    Unless you have already taught your baby Pearson's chi-squared test, true randomness isn't too big of a deal. Commented Jun 22, 2016 at 3:14

13 Answers 13


Use the Swiss army knife for sound generation, SoX.

You install it from the official repositories, simply by typing:

sudo apt-get install sox

Updated, fancy answer (pleasing ocean waves):

After experimenting a bit with SoX, I came up with this great command which imitates the soft murmur of the sea with its soothing sound of waves that flow over a flat sandy beach on a sunny summer day...

Well, enough poetry, here's the command. Listen yourself.

play -n synth brownnoise synth pinknoise mix synth sine amod 0.3 10


This command first generates and mixes brown noise and pink noise, which I find to be the most comfortable and natural noise. Then it generates a sine wave of 0.3 Hz with an offset of 10% and uses this to modulate the amplitude of our mixed noises to produce the sound of ocean waves.


  • Timer:
    You can add a timer and limit the playback duration by specifying the number of seconds, the number of minutes and seconds (mm:ss) or the number of hours, minutes and seconds (hh:mm:ss) right before brownnoise. Here's an example for one hour:

    play -n synth 1:0:0 brownnoise synth pinknoise mix synth sine amod 0.3 10
  • Wave frequency:
    If you want the waves to hit the beach more or less frequent, simply change the frequency of the sine wave used for amplitude modification (0.3 in the above command). The number represents the amount of waves per second, so a frequency of 0.1 Hz will cause 0.1 waves per second and therefore make one wave last for 10 seconds:

    play -n synth brownnoise synth pinknoise mix synth sine amod 0.1 10
  • Minimum background noise volume:
    The sine that is used for amplitude modulation got shifted to an offset of 10%, so the brown-pink noise will always be played with at least 10% volume. If you want a stronger or weaker background noise, increase or decrease this offset to your needs. Here's an example with 20% background noise:

    play -n synth brownnoise synth pinknoise mix synth sine amod 0.3 20

Old, boring answer (plain white noise):

Now the easiest command to play white noise infinitely (until you abort it with Ctrl+C) is this:

play -n synth whitenoise

If you prefer a time limit, you may add that in the format hh:mm:ss. The following command would make noise for one and a half hour, for example:

play -n synth 01:30:00 whitenoise

It even shows you some nice stats while "playing":

$ play -n synth 00:00:05 whitenoise 

  Encoding: n/a           
  Channels: 1 @ 32-bit   
Samplerate: 48000Hz      
Replaygain: off         
  Duration: unknown      

In:0.00% 00:00:05.12 [00:00:00.00] Out:240k  [!=====|=====!] Hd:0.0 Clip:0    
  • 6
    I edited my answer and added a fancy but simple ocean wave sound generator command which will please baby's (and daddy's) ears far more than plain white noise.
    – Byte Commander
    Commented Jun 21, 2016 at 10:06
  • 2
    I love this - but the sine wave volume change isn't really very much like the sound of waves on the beach. It needs to increase in volume quite quickly as the wave breaks on the beach, then fall away much more slowly. Is there a way to achieve that?
    – Caesar
    Commented Jun 22, 2016 at 0:16
  • 7
    @Caesar there's a limit to how good you can get with these tools, but I think play -n synth brownnoise synth pinknoise mix synth 0 0 0 15 40 80 trapezium amod 0.2 10 is closer to what you're asking for :)
    – hobbs
    Commented Jun 22, 2016 at 5:21
  • 1
    @hobbs and now if the repetition frequency were not so regular ... ;-) :-P
    – Rmano
    Commented Jun 22, 2016 at 13:25
  • 3
    +1. Here's my tweaked version: play -n synth brownnoise synth pinknoise mix synth 0 0 0 10 10 40 trapezium amod 0.1 30 The longer period makes it harder to notice the regularity. The numbers mean: 0.1 = wave crash frequency (0.1 Hz = one wave every 10 seconds); 30% = noise level in between waves; 1st 10% = duration (over the 10 seconds) of the rising part of the wave; 2nd 10% = when it starts falling (they are both 10% so that the wave crashes as soon as it's done rising in volume); 40% duration of the entire wave: this means 100% - 40% = 60% of the time is spent waiting between waves.
    – Tobia
    Commented Nov 4, 2016 at 15:12

You can generate pink noise using the play command from the sox utilities:

sudo apt-get install sox
play -t sl -r48000 -c2 -n synth -1 pinknoise .1 60

Adjust the values of .1 and 60 to suit your needs. Pink noise is less harsh on the ear and is hopefully the sound you require

  • I think speaker-test does this as well, but I think pink noise is less than optimal, it's noise sure, but having no variation might not be desireable?
    – user508889
    Commented Jun 20, 2016 at 21:13
  • 4
    @bc2946088 12 hours of pure white noise can be accomplished with play -n synth 12:00:00 whitenoise Commented Jun 20, 2016 at 21:16
  • 7
    You say I can adjust them but what do the .1 and 60 arguments actually mean?
    – Oli
    Commented Jun 21, 2016 at 9:45
  • The .1 is kind of irrelevant here; the 60 is the DC offset. The lower it is the more range (in amplitute) you have in the waveform, setting it nearer to 100 will cause it have less range as it's nearly maxed out to 100% full range. Commented Oct 20, 2017 at 8:00
  • Couldn't help but notice that this play command burns my Bluetooth headset battery much faster than playing anything from YouTube. Turns out play defaults to 48kHz 32-bit quality, which is an overkill for noise - more than 2.17x data bandwidth compared to 44.1kHz 16-bit CD-audio quality. To reduce battery drain (even lower than that of your music player) use -c2 -r44.1k -b8 command line options - you are unlikely to notice any difference between 48kHz 32-bit and 44.1kHz 8-bit noises. Commented May 6, 2022 at 23:44

Not sure that this will produce real white noise that covers the whole spectrum, but a simple

pacat /dev/urandom

seems to do the trick on my system (no need to install anything new or add a repository).

  • That certainly sounds a lot like the white noise sox produces.
    – Oli
    Commented Jun 20, 2016 at 23:40
  • 2
    @linolino aren't you on Ubuntu? If you are, it has to be installed (unless you manually removed it). It is provided by pulseaudio-utils, that is even part of the live system (see the manifest). If you don't have it, then probably your installation in corrupted. I suggest that you open a new question explaining the problem and asking for help on how to restore your installation.
    – dadexix86
    Commented Jun 22, 2016 at 8:09
  • 1
    Unless they're using a server version.
    – Arronical
    Commented Jun 22, 2016 at 11:15
  • 1
    In any case, you can still use aplay instead of pacat. alsa-utils seem to be installed by default.
    – Ruslan
    Commented Jun 23, 2016 at 6:52
  • 1
    @dadexix86 actually I have got an lubuntu. Anyway somehow not working in my case after apt-get install. But ByteDefenders solution is working fine ;-)
    – linolino
    Commented Jun 27, 2016 at 16:10

I'm a glutton for punishment, so I'll give you the GUI way. Take a look at ANoise.

The default sound that it comes with is bad, but you can download other sounds like Forest Rain, Fountain, & Others. You can set it to start with the system, and even set it to stop after a certain time.

sudo add-apt-repository ppa:costales/anoise
sudo apt-get update
sudo apt-get install anoise

ANoise Code, And for For extra river sound:

sudo apt-get install anoise-community-extension1
  • +1 I use Anoise all the time. But it has a few major bugs with 16.04.
    – user423626
    Commented Jun 22, 2016 at 15:03

Open Audacity.

Go into "Generate > Noise..."

Select "Brownian" (way less aggressive than actual white noise). Amplitude and duration does not matter much.

Loop using Shift+Play button.


FFMpeg has an audio noise source filter. You can play it using ffplay:

ffplay -f lavfi -showmode 0 -i 'anoisesrc=color=brown'

The arg to -i is interpreted as a lavfi filter graph, because of -f lavfi. -showmode 0 disables ffplay's default audio visualizer window, which it shows by default for audio-only inputs.

As you can see from the output of ffmpeg -h filter=anoisesrc, you get a choice of brown/pink/white noise at whatever amplitude and samplerate you like, optionally with a finite duration.

You can also use mpv, a nice fork of mplayer, or other players that allow ffmpeg filtergraphs. e.g.

mpv  av://lavfi:anoisesrc=color=brown

This might be handy if you have a custom audio-output setup configured for your favourite player.


The installed-by-default utility speaker-test generates pink noise (which, as @nightingale, is what you really want, not white noise). It can be set to do so indefinitely by running

speaker-test -l 0

I see that nobody has used aplay yet so try the following:

aplay --channels=2 --format=S16_LE --rate=44100 --duration=3600 /dev/urandom

It is not terribly imaginative so I have added in a timer to compensate :). The duration settings is in seconds so this will run for 1 hour and then turn off, hopefully the baby will have settled by then...


Tom Swiss of unreasonable.org uses the following code (using sox) to generate white/pink noise. You'll need to first install sox (sudo apt install sox), then create a shell script with the following code:



if [ "$1" != '' ]; then

play -t sl - synth $len  pinknoise band -n 1200 200 tremolo 20 .1 < /dev/zero

Hat tip http://unreasonable.org/white_noise_generator_with_sox_for_Linux

Disclaimer: I have not tried this myself yet

  • That outputs at an 8kHz sample rate, so there's no noise energy above 4kHz. :/ Proper pink noise should have some. Interesting suggestion to use a vibrato / tremolo filter on the noise, though. Commented Jun 21, 2016 at 7:38
  • 1
    Better solution? Remove len='7:00:00', if [ "$1" != '' ];then and fi, adding support for infinite noise.
    – EKons
    Commented Jun 21, 2016 at 8:33

White noise is mathematically an even distribution of frequencies. You can produce it with random data from /dev/random or /dev/urandom. If you want to change the "tone" of the produced noise (for example to make it less "weighty" by removing lower frequencies, or to make it "damper" by removing higher frequencies) then you could use a command such as dd bs=1 if=/dev/urandom of=whitenoise.raw count=1048576 to generate some white noise, then import it into Audacity and use the high-pass and low-pass filters to adjust it to your liking (when using the filters remember that the average human ear will hear frequencies up to 20kHz).

EDIT: Audacity can also generate white noise itself.


Low-pass Brown noise

Sounds to me like a far away storm or a giant river/waterfall. Feel free to adjust frequency parameter 1k in Hz, filter poles -1 or -2, and output volume as gain parameter in dB.

play -n synth brownnoise lowpass -1 1k gain -10

There's also Renoise, a very powerful multi-platform audio sequencer, though the full version is commercial. The demo version however doesn't have many limitations, and will let you do what you want, and add filters, effects, etc. to the generated sound.


True white noise with a lowpass filter, and maybe some chorus and reverb added for a nice natural effect, would sound quite pleasing.

  1. Take any old radio, tune into a frequency where there's no station, maybe (if possible) remove or collapse the antenna and turn it on.
  2. Use aplay /dev/random. It will generate white noise and play it. I don't think you have speakers powerful enough to output infrasound (e.g. brown noise) at enough decibels to cause problems, as you don't even have very big effects with 120db and I don't think you get anywhere near that with your speakers.
  • duplicate of askubuntu.com/a/789670
    – karel
    Commented Feb 19, 2023 at 1:04
  • @karel Not completely, the other answer doesn't suggest a radio which is tuned out of every station.
    – Lampe2020
    Commented Feb 19, 2023 at 7:26
  • 1
    That's not about Ubuntu for the purpose of this Q&A.
    – karel
    Commented Feb 19, 2023 at 8:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .