What is Pink Noise and how is it different from White Noise?

Utpal Kumar   3 minute read      

Pink noise, also known as 1/f noise or flicker noise, is a type of random signal that has equal energy per octave. It is called pink because it is analogous to pink light, which has a power spectrum that is inversely proportional to its frequency.

Introduction

Pink noise, also known as 1/f noise or flicker noise, is a type of random signal that has equal energy per octave. It is called “pink” because it is analogous to pink light, which has a power spectrum that is inversely proportional to its frequency. Pink noise is an interesting case because it occurs often in nature, and is often preferred by composers of computer music.

How is Pink noise different from White Noise?

Pink noise and white noise are both types of random signals, but they differ in terms of their spectral characteristics.

  1. Spectral Distribution:
    • White noise: It has a flat spectral distribution, which means it has equal power across all frequencies. In other words, it contains an equal amount of energy at all frequencies.
    • Pink noise: It has a spectral distribution where the power decreases per octave. This means that as the frequency increases, the power at each octave decreases by half. Pink noise has more energy in the lower frequencies compared to white noise.
  2. Frequency Characteristics:
    • White noise: It contains all frequencies at equal intensity. Each frequency component is statistically independent of one another, and there is no correlation between successive samples.
    • Pink noise: It has a more balanced frequency content, with equal energy per octave. It exhibits long-range correlations, meaning that each sample depends on the previous samples. The decay of the correlations follows a 1/f (flicker) pattern, hence the name “1/f noise.”
  3. Perceived Sound:
    • White noise: It sounds like a hiss or static and is often used to mask background sounds or for testing audio equipment.
    • Pink noise: It has a more balanced and soothing sound. It is often used in audio engineering, acoustic testing, and music production. Pink noise is sometimes used in sleep and relaxation applications due to its calming properties.

Synthesis of White Noise in Python

To generate white noise in Python, we can use the NumPy library, which provides a function called numpy.random.randn() to generate white noise.

## Generating White Noise
import numpy as np
import matplotlib.pyplot as plt

def generate_white_noise(samples):
    white_noise = np.random.randn(samples)
    return white_noise

# Generate 1000 samples of pink noise
samples = 1000
white_noise = generate_white_noise(samples)

# Compute the frequency spectrum using FFT
spectrum = np.fft.fft(white_noise)
freq = np.fft.fftfreq(samples)

# Consider only positive frequencies
positive_freq = freq[:samples // 2]
positive_spectrum = spectrum[:samples // 2]

# Plotting the pink noise
fig, ax = plt.subplots(2, 1, figsize=(10,6))
ax[0].plot(white_noise)
ax[0].set_title("White Noise")
ax[0].set_xlabel("Time")
ax[0].set_ylabel("Amplitude")

ax[1].plot(positive_freq, np.abs(positive_spectrum))
ax[1].set_xlabel("Frequency")
ax[1].set_ylabel("Magnitude")

plt.savefig('white_noise_synthesis.png', dpi=300, bbox_inches='tight')
plt.close()
White Noise and its Spectral Content
White Noise and its Spectral Content

Synthesis of Pink Noise in Python

To generate pink noise in Python, we can use the NumPy library, which provides a function called numpy.random.randn() to generate white noise. Then, we can then apply a filter to the white noise signal to convert it into pink noise.

## Generating Pink Noise
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(10250)

def generate_pink_noise(samples):
    b = [0.049922035, -0.095993537, 0.050612699, -0.004408786]
    a = [1, -2.494956002, 2.017265875, -0.522189400]

    pink_noise = np.random.randn(samples)
    pink_noise = np.convolve(pink_noise, b)
    pink_noise = np.convolve(pink_noise, a, mode='valid')
    return pink_noise / 0.091420942

# Generate 1000 samples of pink noise
samples = 1000
pink_noise = generate_pink_noise(samples)

# Compute the frequency spectrum using FFT
spectrum = np.fft.fft(pink_noise)
freq = np.fft.fftfreq(samples)

# Consider only positive frequencies
positive_freq = freq[:samples // 2]
positive_spectrum = spectrum[:samples // 2]

# Plotting the pink noise
fig, ax = plt.subplots(2, 1, figsize=(10,6))
ax[0].plot(pink_noise)
ax[0].set_title("Pink Noise")
ax[0].set_xlabel("Time")
ax[0].set_ylabel("Amplitude")

ax[1].plot(positive_freq, np.abs(positive_spectrum))
ax[1].set_xlabel("Frequency")
ax[1].set_ylabel("Magnitude")

plt.savefig('pink_noise_synthesis.png', dpi=300, bbox_inches='tight')
plt.close()
Pink Noise and its Spectral Content
Pink Noise and its Spectral Content

References

  1. Richard F. Voss, John Clarke; ’’1/f noise’’ in music: Music from 1/f noise. J Acoust Soc Am 1 January 1978; 63 (1): 258–263. https://doi.org/10.1121/1.381721

Disclaimer of liability

The information provided by the Earth Inversion is made available for educational purposes only.

Whilst we endeavor to keep the information up-to-date and correct. Earth Inversion makes no representations or warranties of any kind, express or implied about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services or related graphics content on the website for any purpose.

UNDER NO CIRCUMSTANCE SHALL WE HAVE ANY LIABILITY TO YOU FOR ANY LOSS OR DAMAGE OF ANY KIND INCURRED AS A RESULT OF THE USE OF THE SITE OR RELIANCE ON ANY INFORMATION PROVIDED ON THE SITE. ANY RELIANCE YOU PLACED ON SUCH MATERIAL IS THEREFORE STRICTLY AT YOUR OWN RISK.


Leave a comment