Noise Generation

Theory and Implementation

Noise is indispensable in signal processing tests, acoustic measurement, dithering, simulation, and many other contexts. This page collects the basic theory and navigation to each method's dedicated page. Each method is detailed in its own page.

1. Classification of Colored Noise

Noise is classified by the frequency dependence of its power spectral density (PSD) $S(f)$. In general it is written $S(f) \propto 1/f^\alpha$, and the exponent $\alpha$ determines its "color".

Name Exponent $\alpha$ PSD Notes
White noise $0$ $S(f) = \text{const.}$ Uniform across the band, the baseline for theoretical analysis
Pink noise ($1/f$) $1$ $S(f) \propto 1/f$ Equal energy per octave; used in acoustic measurement
Brown noise ($1/f^2$) $2$ $S(f) \propto 1/f^2$ Random walk; low-frequency dominant
Blue noise $-1$ $S(f) \propto f$ High-frequency dominant; used in dithering
Violet noise $-2$ $S(f) \propto f^2$ Derivative of white noise
Table 1: Classification of colored noise by the spectral exponent $\alpha$

2. Pink Noise ($1/f$ noise) Theory

Pink noise is characterized by a power spectral density inversely proportional to frequency, with the distinctive property that the energy per octave is constant. It is widely used in acoustic measurement, music production, and the modeling of natural phenomena. Spectra of this form are also called "$1/f$ fluctuations" and appear ubiquitously in nature.

Proof of the equal-energy-per-octave property

Suppose the power spectral density of pink noise is $E[|X(f)|^2] = f^{-1}$. For any center frequency $f_0$, the power up to one octave above ($2f_0$) is:

$$p(f_0) = \int_{f_0}^{2f_0} E[|X(f)|^2]\,df = \int_{f_0}^{2f_0} f^{-1}\,df = \bigl[\log f\bigr]_{f_0}^{2f_0} = \log(2f_0) - \log(f_0) = \log 2$$

The result does not depend on $f_0$: every octave band has the same power, namely $\log 2$. This is why pink noise is the standard test signal for acoustic measurement — viewed through an octave-band analyzer, every band reads the same level.

Main generation methods

Method Principle Accuracy Use case
IIR filter Apply a $1/\sqrt{f}$ filter to white noise Approximate (design-dependent) Real-time processing
Voss-McCartney Sum of independent random sequences updated at different rates Approximate (depends on number of stages) Low-cost implementations
IFFT method Set $1/\sqrt{f}$ in the frequency domain and inverse FFT Exact Offline generation
Shelving cascade 11-stage cascade of $-3$ dB shelving filters, optimized via sangi $L_p$ homotopy High accuracy ($\pm 0.0084$ dB, symmetric equiripple) High-precision real-time
Biquad (2nd-order IIR) cascade 6- or 7-section biquad cascade with sangi $L_p$ homotopy + alternating optimization (7 sections achieves equiripple) Very high accuracy (6 sections $\pm 0.0075$ dB / 7 sections $\pm 0.0049$ dB) High-precision real-time
Table 2: Overview of pink-noise generation methods

Method selection guide

Use case Recommended method Error Compute Memory
Simplicity / educational / FPGA Voss-McCartney ($K=16$ stages) $\pm 0.6$ dB Very low (2 random + add/sub) Low (16 state variables)
Embedded / instrument timbre Paul Kellet IIR (6 parallel sections) $\pm 0.1$ dB Low Low (6 state variables)
Offline / sample-rate independent IFFT method Exact Medium (one FFT) High ($O(N)$)
Balanced (audio applications) 11-section shelving cascade $\pm 0.0084$ dB Medium Low (11 state variables)
Measurement / highest precision 7-section biquad cascade $\pm 0.0049$ dB Medium-high Low (14 state variables)
Table 3: Use-case selection guide (20 Hz–20 kHz, sangi-optimized)

Pages for each method

Each major generation method below has its own dedicated page. Reading them in order takes you from theory to implementation, but each page also stands on its own for readers focused on a single method.

White

White Noise (incl. M-sequence)

i.i.d. random / Box-Muller, Marsaglia polar, Ziggurat / M-sequence (MLS)

The ideal noise where each sample is i.i.d. Covers three Gaussian-conversion methods (Box-Muller / Marsaglia polar / Ziggurat) with their geometric construction, a use-case decision tree, performance tiers, and implementation pitfalls; plus 16/24-bit LFSR-based $\pm 1$ binary M-sequences — their principles, properties, applications (CDMA / GPS / impulse-response measurement) with C++/sangi code examples.

Pink

Paul Kellet's IIR Filter

6 parallel 1st-order IIR, $\pm 0.1$ dB @ 10 Hz–4 kHz

The classic method of applying a $1/\sqrt{s}$ IIR filter to white noise. Derives the difference equation, transfer function $H(z)$, frequency response, and analyzes the sample-rate dependence.

Pink

Voss-McCartney Method

Sum of $K$ random sources, $\pm 0.6$ dB at $K=16$

The classic method of summing random sources updated at different rates. The original Voss (1978) and McCartney's $O(1)$/sample optimization (1990). Frequency response analysis with C++/sangi implementation.

Pink

IFFT Method

Sample-rate independent, exact $-3$ dB/oct, arbitrary $1/f^\beta$

Sets $|X[k]| \propto k^{-\beta/2}$ with random phase in the frequency domain and takes the inverse FFT. Unifies arbitrary $\beta \in [-2, 2]$ colored noise generation; also covers Kasdin's 1995 discrete-time recursive filter. Can be used in real time by looping the buffer. Memory-vs-periodicity tradeoff.

Pink

Cascade of Shelving Filters

11-stage 1st-order IIR, $\pm 0.0084$ dB symmetric equiripple

Places $-3$ dB shelving filters at octave spacing across 11 stages, then optimizes with sangi's $L_p$ homotopy and equiripple penalty to achieve a symmetric equiripple approximation of $\pm 0.0084$ dB over 20 Hz–20 kHz.

Pink

Biquad Cascade and Method Comparison

6/7-section biquad, $\pm 0.0049$ dB symmetric equiripple

Cascades 2nd-order IIR sections and optimizes with sangi. 6 sections give $\pm 0.0075$ dB; 7 sections give $\pm 0.0049$ dB symmetric equiripple. The page ends with an accuracy comparison and a unified error plot of the four methods (Kellet / shelving / biquad-6 / biquad-7).

Brown

Brown Noise ($1/f^2$)

Random walk / red noise

The $1/f^2$ noise generated as a cumulative sum of white noise. Covers statistical properties, generation methods, and the low-frequency divergence problem with countermeasures.

Foundation

Pseudo-Random Number Generators (PRNG)

MT19937 / xoshiro / LCG

Comparison of PRNGs that underpin noise generation. Mersenne Twister, xoshiro, linear congruential generators (LCG), and the std::random facilities — when to use which.

3. Applications

  • Acoustic measurement — measuring frequency response of speakers and rooms with pink noise
  • Dithering — using blue or white noise to spread quantization distortion
  • Simulation — stochastic modeling in Monte Carlo methods
  • Communications — channel-noise simulation (AWGN channel)
  • Music / sound design — noise waveforms as sources for synthesizers
  • Impulse-response measurement — room-acoustic measurement using TSP (time-stretched pulse)

4. References

Frequently Asked Questions

Q. What is the $1/f$ property of pink noise?

Pink noise has a power spectral density inversely proportional to frequency ($S(f) \propto 1/f$). The power in any octave band $[f_0, 2f_0]$ equals $\int_{f_0}^{2f_0} 1/f\, df = \log 2$, independent of the center frequency $f_0$. This "equal energy per octave" property is why pink noise is widely used in acoustic measurement, music production, and modeling of natural $1/f$ fluctuations.

Q. How do white, pink, and brown noise differ?

They are distinguished by the frequency dependence of their power spectral density $S(f)$. White noise has $S(f) = $ constant (uniform across the band); pink noise has $S(f) \propto 1/f$ (equal energy per octave); brown noise has $S(f) \propto 1/f^2$ (cumulative sum of white noise, low-frequency dominant). Blue noise ($S \propto f$, high-frequency dominant) and violet noise ($S \propto f^2$, derivative of white noise) also exist.

Q. Which pink-noise generation method should I choose?

By use case: (1) For lightweight implementations (embedded systems, musical timbre), the Paul Kellet IIR filter (6 parallel sections, $\pm 0.1$ dB) is ideal. (2) When sample-rate independence is required, the IFFT method gives exact $-3$ dB/oct (with $O(N)$ memory). (3) For balanced accuracy (general audio applications), the 11-section shelving cascade ($\pm 0.0084$ dB) works well. (4) For maximum precision (measurement instruments), the 7-section biquad cascade ($\pm 0.0049$ dB symmetric equiripple) is best. The latter two methods, optimized with sangi's $L_p$ homotopy, produce symmetric equiripple approximations. See the "Method selection guide" above and each dedicated page for details.