gradient noise sound generator


Perlin noise is a type of gradient noise devised by Ken Perlin, and commonly used to add texture to objects rendered in computer graphics. It is deterministic: for a given input co-ordinate it always returns the same output value. To make audible noise you will typically need to define some trajectory through the co-ordinate space.

perlin3 is a csound port of Supercollider's Perlin3


aout  perlin3 ax, ay, az
kout  perlin3 kx, ky, kz


  • kx, ky, kz: the coordinates of a point in 3D space. In the current implementation the space wraps at 255 so any value is actually possible.


  • aout / kout: the perlin noise corresponding to the given coordinates

Execution Time

  • Performance



/* to be run in csoundqt >= 0.9.8 */

sr     = 44100
ksmps  = 64
nchnls = 2
0dbfs  = 1

; an empty table to plot
giplot1 ftgen 0, 0, 1000, 2, 0
giplot2 ftgen 0, 0, 1000, 2, 0

opcode tabplot, 0, Sik
    Schan, itab, kvalue xin
    outvalue Schan, itab

    tablew kvalue, accum:k(1), itab, 0, 0, 1

    ; update the plot
    if metro(20) == 1 then
        outvalue Schan, k(-1)

instr perlin3
  kspeed = line:k(1, 10, 4)
  ax = accum:a(kspeed/sr)
  az = ax*0.5
  aper1 = perlin3(ax, a(0), az)
  aper2 = perlin3(a(0), ax, az)
  asig = pinker() * 0.4

  ; remap to 0-1
  aper1 = (aper1 + 1) * 0.5
  aper2 = (aper2 + 1) * 0.5

  ilagtime = 0.1
  a1 = asig*lag(aper1, ilagtime)
  a2 = asig*lag(aper2, ilagtime)
  a1, a2 reverbsc a1, a2, 0.92, 12000
  outch 1, a1, 2, a2

  ; plot the trajectory in csoundqt
  tabplot "plot1", giplot1, aper1[0]
  tabplot "plot2", giplot2, aper2[0]



i "perlin3" 0 300

 <bgcolor mode="nobackground">
 <bsbObject version="2" type="BSBTableDisplay">
 <bsbObject version="2" type="BSBTableDisplay">

See also


Eduardo Moguillansky, 2020