Pink Noise Digital Waveform Generator Program

  Download source code and executable program pinknoise.zip:

  This C program generates octave-band or third-octave-band pink noise audio waveforms. The power spectral density of pink noise is inversely proportional to the frequency, giving a negative slope of 3 decibels per octave.

  The program computes 2^19 = 524288 white Gaussian pseudorandom numbers, or about 12 seconds of audio at 44100 samples per second. The discrete Fourier transform of that time series is computed and weighted by a pink noise function. Contiguous octave or third-octave frequency bands from the resultant weighted spectrum are inverse transformed to generate band-limited noise. The rms amplitude level of the 16-bit PCM waveform is set to -15 db relative to full scale.

  The output computer file contains the broadband pink noise followed by band-limited noise segments starting at the lowest band center frequency and proceeding to the highest frequency band. The 12-second segments are separated by 1 second of silence. There are 10 octave bands or 31 third-octave bands, depending on the setting of the compile-time macro THIRD_OCTAVE. Both versions of the executable program are provided in the distribution. Band edge frequencies and amplitude statistics are shown in the files pink1.txt, pink2.txt. These text files can be compared with the program printout to verify proper operation.

  Files:

 

pink.c
Main program.
wav.c
Microsoft .WAV header.
wav.h
.WAV header data structure.
fftc.c
Forward and inverse fast Fourier transform of real sequence.
lrand.c
Pseudorandom number generator.
pink_1.exe
Windows executable program to generate octave band noise WAV file.
pink1.wav
Audio file generated by pink_1.exe, about 12 megabytes long.
pink1.txt
Printout from pink_1.exe.
pink_3.exe
Windows executable program to generate third-octave noise.
pink3.wav
Audio file from pink_3.exe, about 36 megabytes long.
pink3.txt
Printout from pink_3.exe.
msvc6.zip
Microsoft Visual C++ version 6 project files.
bcb5.zip
Borland Code Builder version 5 project files.
makefile
Unix make file.
Up to home page:
November, 2003
Steve Moshier