ThinkDSP
This notebook contains code examples from Chapter 4: Noise
Copyright 2015 Allen Downey
The simplest noise to generate is uncorrelated uniform (UU) noise:
Here's what a segment of it looks like:
And here's the spectrum:
In the context of noise it is more conventional to look at the spectrum of power, which is the square of amplitude:
UU noise has the same power at all frequencies, on average, which we can confirm by looking at the normalized cumulative sum of power, which I call an integrated spectrum:
A straight line in this figure indicates that UU noise has equal power at all frequencies, on average. By analogy with light, noise with this property is called "white noise".
Brownian noise
Brownian noise is generated by adding up a sequence of random steps.
The sound is less bright, or more muffled, than white noise.
Here's what the wave looks like:
Here's what the power spectrum looks like on a linear scale.
So much of the energy is at low frequencies, we can't even see the high frequencies.
We can get a better view by plotting the power spectrum on a log-log scale.
Now the relationship between power and frequency is clearer. The slope of this line is approximately -2, which indicates that , for some constant .
The estimated slope of the line is closer to -1.8 than -2, for reasons we'll see later.
Pink noise
Pink noise is characterized by a parameter, , usually between 0 and 2. You can hear the differences below.
With , we get white noise:
With , pink noise has the relationship , which is why it is also called noise.
With , we get Brownian (aka red) noise.
The following figure shows the power spectrums for white, pink, and red noise on a log-log scale.
Uncorrelated Gaussian noise
An alternative to UU noise is uncorrelated Gaussian (UG noise).
The spectrum of UG noise is also UG noise.
We can use a normal probability plot to test the distribution of the power spectrum.
A straight line on a normal probability plot indicates that the distribution of the real part of the spectrum is Gaussian.
And so is the imaginary part.