LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Anyone know how to generate PINK noise in a Labview VI?

I need an audio Pink noise source for some sleep studies, White noise VI's are available but what about Pink noise, anyone done a VI for pink?
0 Kudos
Message 1 of 5
(6,480 Views)
To quote someone else:

"White noise is a sound that contains every frequency within the range of human hearing (generally from 20 hertz to 20 kHz) in equal amounts. Most people perceive this sound as having more high-frequency content than low, but this is not the case. This perception occurs because each successive octave has twice as many frequencies as the one preceding it. For example, from 100 Hz to 200 Hz, there are one hundred discrete frequencies. In the next octave (from 200 Hz to 400 Hz), there are two hundred frequencies."

"Pink noise is a variant of white noise. Pink noise is white noise that has been filtered to reduce the volume at each octave. This is done to compensate for the increase in the number of frequencies per octave. Each octave is reduced by 6 decibels, resulting in a noise sound wave that has equal energy at every octave."

Therefore my understanding of how you would create pink noise is to 2nd order low pass filter white noise, with the 6dB point (cutoff frequency) at 200Hz. The second order filter will give you the 6dB/ocatave dropoff as frequency increases.

If you have LabVIEW 7 you may do this with two express VI's. Here's what I did:

- Express VI: Simulate Signal
- Signal type: DC
- Offset: 0
- Check the option for Add Noise: White Noise / Gaussian White Noise
- Set Samples per second (Hz) to: 44100 (This gives us good CD quality white noise 🙂

- Express VI: Filter
- Type: Lowpass
- Cutoff Frequency (Hz): 200
- IIR/FIR: IIR
- Topology: Butterworth
- Order: 2

When these are finished, wire the Simulate Signal--DC with Gaussian Noise Output to the Filter--Signal input. The output of the filter will be pink noise.

For comparison use two of the Spectral Measurement Express VI, one for the input signals to the filter (white noise) and one for the output signals (pink noise). Configure these to show power spectrum or power spectral density and create graph indicators for their outputs. Map the x-axis of these graphs to logarithmic, auto-scaling off (with the same scale values for both), and you will see that the filter input signal has a fairly constant spectral density, while the output signal has a fairly linear decay as frequency increases.
0 Kudos
Message 2 of 5
(6,480 Views)
Looking at what I just wrote, the cutoff frequency of the filter may only be at 3dB, with 6dB/octave dropoff after that, so I may not be exactly right in the details, but this should get you pretty close to what you want. Off the top of my head, if you wanted 6dB at the cutoff frequency (instead of 3dB) you could put two first-order filters in series with the same cutoff frequency of 200Hz.
0 Kudos
Message 3 of 5
(6,480 Views)
There is actually a VI that can generate any kind of "1/f^a" type of noise. Pink noise corresponds to 1/f noise that is a = 1.

The VI allows you to specify a bandwidth and will internally create and use the necessary filters to continuously create the noise with the characteristic you specify.

I have created a quick example VI (LabVIEW 7.0 required). Note that the VI also returns the actual response characteristic of the used filter so you can evaluate if the generated signal fulfill your requirements, and you can then modify the cut-off frequencies and filter order until you are happy with it.
Message 4 of 5
(6,480 Views)
If you have the Sound and Vibration Toolkit 2.0 or later, there is a VI in the Sound and Vibration>>Generation palette that directly outputs a pink noise waveform.
Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
Message 5 of 5
(6,480 Views)