Generate Brown Noise in FFmpeg for Sound Masking

This article provides a straightforward guide on how to generate brown noise using FFmpeg, a powerful command-line tool for handling multimedia. You will learn the exact FFmpeg commands needed to create high-quality brown noise audio files, customize their duration, and play them directly from your terminal for sound masking, sleep, or focus applications.

What is Brown Noise?

Brown noise (or Brownian noise) is a signal that decreases in intensity by 6 dB per octave as the frequency increases. This results in a deep, rumbling sound that resembles a heavy waterfall or distant thunder. Because of its lower-frequency emphasis, many people find brown noise much more soothing for sound masking and concentration than white or pink noise.

The Basic FFmpeg Command to Generate Brown Noise

FFmpeg includes a built-in audio noise source filter called anoisesrc. You can generate a 1-hour brown noise audio file in WAV format by running the following command in your terminal:

ffmpeg -f lavfi -i "anoisesrc=color=brown:sample_rate=48000:duration=3600" -c:a pcm_s16le brown_noise.wav

Parameter Breakdown:

Generating Compressed Audio Formats

If you need a smaller file size for mobile devices or web streaming, you can export the brown noise directly to MP3 or AAC format.

Generate a 30-Minute MP3 File:

ffmpeg -f lavfi -i "anoisesrc=color=brown:sample_rate=44100:duration=1800" -b:a 192k brown_noise.mp3

Generate a 30-Minute AAC File (M4A):

ffmpeg -f lavfi -i "anoisesrc=color=brown:sample_rate=44100:duration=1800" -c:a aac -b:a 192k brown_noise.m4a

Creating Stereo Brown Noise

By default, the standard anoisesrc command generates a mono channel. For a more immersive sound masking experience, you can generate a stereo track. The command below creates a 2-channel stereo file:

ffmpeg -f lavfi -i "anoisesrc=color=brown:sample_rate=48000:duration=3600:channel_layout=stereo" brown_noise_stereo.wav

Real-Time Playback in the Terminal

If you do not want to save a file to your hard drive and instead want to play brown noise instantly for focus or relaxation, you can use the ffplay utility included with the FFmpeg installation:

ffplay -f lavfi "anoisesrc=color=brown"

This command runs indefinitely. To stop the playback, simply press Ctrl + C or close the terminal window.