Use Non-Frames Version Previous Page Next Page
Signal Generators: Random (Noise) Generators


   ar     pinkish    xin[, imethod, inumbands, iseed, iskip]


Generates approximate pink noise (-3dB/oct response) by one of two different methods:


imethod (optional) – selects filter method:

inumbands (optional) – only effective with Gardner method. The number of noise bands to generate. Maximum is 32, minimum is 4. Higher levels give smoother spectrum, but above 20 bands there will be almost DC-like slow fluctuations. Default value is 20.

iseed (optional) – only effective with Gardner method. If non-zero, seeds the random generator. If zero, the generator will be seeded from current time. Default is 0.

iskip (optional) – if non-zero, skip (re)initialization of internal state (useful for tied notes). Default is 0.


xin – for Gardner method: k- or a-rate amplitude. For Kellet filters: normally a-rate uniform random noise from rand (31-bit) or unirand, but can be any a-rate signal. The output peak value varies widely (±15%) even over long runs, and will usually be well below the input amplitude. Peak values may also occasionally overshoot input amplitude or noise.

pinkish attempts to generate pink noise (i.e., noise with equal energy in each octave), by one of two different methods.

The first method, by Moore & Gardner, adds several (up to 32) signals of white noise, generated at octave rates (sr, sr/2, sr/4 etc). It obtains pseudo-random values from an internal 32-bit generator. This random generator is local to each opcode instance and seedable (similar to rand).

The second method is a lowpass filter with a response approximating -3dB/oct. If the input is uniform white noise, it outputs pink noise. Any signal may be used as input for this method. The high quality filter is slower, but has less ripple and a slightly wider operating frequency range than less computationally intense versions. With the Kellet filters, seeding is not used.

The Gardner method output has some frequency response anomalies in the low-mid and high-mid frequency ranges. More low-frequency energy can be generated by increasing the number of bands. It is also a bit faster. The refined Kellet filter has very smooth spectrum, but a more limited effective range. The level increases slightly at the high end of the spectrum.


Kellet-filtered noise for a tied note (iskip is non-zero).

            instr 1

   awhite   unirand    2.0

   awhite   =          awhite - 1.0            ; Normalize to +/-1.0

   apink    pinkish    awhite, 1, 0, 0, 1

            out        apink * 30000



Phil Burke
John ffitch
University of Bath/Codemist Ltd.
Bath, UK
May, 2000 (New in Csound Version 4.16)

Use Non-Frames Version Previous Page Next Page
Signal Generators: Random (Noise) Generators