Pink Noise Digital Waveform Generator Program

  Download source code and executable program

  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.



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