# Abrazolica

Creating Colored Noise

Colored noise has a power spectral density (PSD) proportional to $1/f^{2\alpha}$ where $f$ is frequency and $\alpha$ ranges from 0 to 1. When $\alpha=0$ the PSD is constant and there is equal power in all frequencies. This is called white noise and it is produced by a random process where each point in time is an independent and identically distributed random variable with zero mean and finite variance. The distribution can be Gaussian, Uniform, Bernoulli, or any number of other distributions as long as there is no correlation between two points in time. In other words the autocorrelation function must be proportional to a delta function.

When $\alpha=1$ we have Brownian noise which is just integrated white noise. The random process here is called a random walk or Brownian motion. The discrete form of the process is defined by $y[n]=y[n-1]+w[n]$ where $w[n]$ is a discrete white noise process as defined above. This is a very simple digital filter equation called an integrator and it shows how you can get colored noise by filtering white noise.

If you send a signal (random process) $x(t)$ with power spectral density $S_x(f)$ through a linear time invariant filter with frequency response $G(f)$ then the output signal (random process) $y(t)$ will have a power spectral density given by

$S_y(f)=S_x(f)|G(f)|^2$

When $x(t)$ is white noise then $S_x(f)$ is simply a constant and $S_y(f)$ is just proportional to the magnitude squared of the filter's frequency response. To get Brownian noise from white noise you use a filter called an ideal integrator whose system function is $G(s)=1/s$. Note that here and in what follows we are going to represent things in terms of Laplace transforms, where to get the frequency response you let $s=j\omega=j2\pi f$ where $j=\sqrt{-1}$.

In general to get colored noise by filtering white noise you need a filter with a system function given by

$G(s)=\frac{1}{s^{\alpha}}$

The problem is that you cannot build a filter like this with a finite number of lumped elements (resistors, capacitors, inductors). And even if you're only interested in digitally simulating colored noise you still need an analog filter function $G(s)$ that can be expressed as the ratio of two polynomials in $s$. $G(s)$ is then turned into a digital filter function using a bilinear transform.

It is possible however to get as close as desired to $G(s)=1/s^{\alpha}$ by using the following approximation

$G_n(s) = \prod_{k=1}^{n}\frac{s+a_k}{a_ks+1}$

where $a_k = \tan^{2}(k\theta)$. The value of $\theta$ is determined by $\alpha$ and the order of the approximation. The approximation is exact in the limit $n\rightarrow\infty$. Even for values of $n$ as small as $4$, the approximation is extremely good.

When $\alpha=1/2$ you get what is called pink noise which seems to occur everywhere, from various physical and biological systems to financial systems. We have a C program called pinkgen.c which you can download from our digital signal generation page that will generate as much pink noise as you want.

For more information about generating colored noise for any value of $\alpha$, see our book Creating Noise.