You are on page 1of 4

Using Perlin noise in sound synthesis

Artem POPOV
Gorno-Altaysk,
Russian Federation,
art@artfwo.net

Abstract This paper is focused on synthesizing single-


Perlin noise is a well known algorithm in computer cycle waveforms with Perlin noise and its suc-
graphics and one of the first algorithms for gener- cessor, Simplex noise. An overview of both algo-
ating procedural textures. It has been very widely rithms is given followed by a description of frac-
used in movies, games, demos, and landscape gen- tional Brownian motion and several techniques
erators, but despite its popularity it has been sel- for adding variations to noise-based waveforms.
dom used for creative purposes in the fields outside Finally, the paper describes an implementation
computer graphics. This paper discusses using Per- of a synthesizer plugin using Perlin noise to cre-
lin noise and fractional Brownian motion for sound
ate musically useful timbres.
synthesis applications.

Keywords 2 Perlin noise


Perlin noise, Simplex noise, fractional Brownian mo- Perlin noise is a gradient noise that is built
tion, sound synthesis from a set of pseudo-random gradient vectors of
unit length evenly distributed in N-dimensional
1 Introduction space. Noise value in a given point is calculated
by computing the dot products of the surround-
Perlin noise, first described by Ken Perlin in his
ing vectors with corresponding distance vectors
ACM SIGGRAPH Computer Graphics article
to the given point and interpolating between
“An image Synthesizer” [Perlin, 1985] has been
them using a smoothing function.
traditionally used for many applications in com-
Sound is a one-dimensional signal, and for
puter graphics. The two-dimensional version of
the purpose of sound synthesis Perlin noise of
Perlin noise is still widely used to generate tex-
higher dimensions is not so interesting. While
tures resembling clouds, wood, and marble as
it is possible to scan Perlin noise in 2D or 3D
well as procedural height maps.
space to get a 1-dimensional waveform, it’s nec-
essary to make sure the waveform can be seam-
lessly looped to produce a musically useful tim-
bre with zero DC offset.
For one-dimensional Perlin noise, the noise
value is interpolated between two values,
namely the values that would have been the
result if the closest linear slopes from the left
and from the right had been extrapolated to the
point in question [Gustavson, 2005]. Thus, the
noise value will always be equal to zero on in-
Figure 1: 2D Perlin noise as rendered by Gimp teger boundaries. By sampling the resulting 1-
plugin “Solid noise” dimensional noise function, it’s possible to gen-
erate a waveform that can be looped to produce
Despite its popularity, Perlin noise has been
a pitched tone (Figure 2).
seldom used for creative purposes in the fields
outside the world of computer graphics. For
music applications, Perlin noise has been occa-
3 Simplex noise
sionally used for creating stochastic melodies or Simplex noise is an improvement to the original
as a modulation source. Perlin noise algorithm proposed by Ken Perlin
Figure 2: Perlin noise (left) and Simplex noise Figure 3: 3 octaves of Perlin noise (left) summed
(right) with the gradients used for interpolation to generate a fBm waveform (right)

himself [Perlin, 2001]. The advantages of sim- while successively incrementing their frequen-
plex noise over Perlin noise include lower com- cies in regular steps by a factor called lacunarity
putational complexity, no noticeable directional and decreasing the amplitude of the octaves by
artifacts, and a well-defined analytical deriva- a factor called persistence with each step [Vivo
tive. and Lowe, 2015].
Simplex noise is created by splitting an N-
n
dimensional space into simplest shapes called X
simplices. The value of the noise function is a f Bm(x) = pi · noise(2i · x) (2)
sum of contributions from each corner of the i=0

simplex surrounding a given point [Gustavson, Lacunarity can have any value greater than 1,
2005]. but non-integral lacunarity values will result in
In one-dimensional space, simplex noise uses non-zero fBm values on the integer boundaries.
intervals of equal length as the simplices. For To keep the waveform seamless in a sound syn-
a point in an interval, the contribution of thesizer, lacunarity has be an integer number.
each surrounding vertex is determined using the A reasonable choice for lacunarity is 2, since
equation: bigger values result in a very quick buildup of
the upper harmonics (Eq. 2).
(1 − d2 )4 · (g · d) (1) Fractional Brownian motion is often called
Perlin noise, actually being a fractal sum of sev-
Where g is the value of the gradient in a given eral octaves of noise. While typically the same
vertex and d is the distance of the point to the noise function is used for every octave, different
vertex. noise algorithms can be combined in the same
Both Perlin noise and Simplex noise produce fashion to create multifractal or heterogeneous
very similar results (Fig. 2) and are basically fBm waveforms [Musgrave, 2002].
interchangeable in a sound synthesizer1 . For
brevity, Perlin noise or noise will be used to 5 Waveform modifiers
refer to both algorithms for the scope of this
5.1 Gradient rotation
paper, since Simplex noise is also invented by
Ken Perlin. One technique traditionally used to animate
Perlin noise is gradient rotation [Perlin and
4 Fractional Brownian motion Neyret, 2001]. When gradient vectors in 2- or
more dimensional space are rotated the noise is
Fractional Brownian motion (fBm), also called
varied while retaining its character and detail.
fractal Brownian motion is a technique often
This technique has been used for simulating ad-
used with Perlin noise to add complexity and
vected flow and other effects. A similar tech-
detail to the generated textures.
nique can be applied to 1-dimensional noise to
Fractional Brownian motion is created by introduce subtle changes to the sound.
summing several iterations of noise (octaves),
Rotating gradients is a computationally ex-
1
In some cases Perlin noise adds additional low fre-
pensive operation and cannot be used with 1-
quency harmonics to the sound which may or may not dimensional noise, since the noise is built from
be desirable. linear gradients instead of directional vectors.
Figure 4: Gradient offsets applied to fBm (left) Figure 5: Simplex noise (left) with domain
modify the waveform (right) while preserving warping (right)
the timbre

It is still possible to apply this technique to


1-dimensional noise by adding a variable offset
value to the gradients and symmetrically wrap-
ping it when the maximum allowed gradient
value (1) is reached.
(
2 − g, g>1
g0 = (3)
−2 − g, g < −1
In a sound synthesizer, gradient rotation does
not change the timbre significantly. It does alter
the amplitudes of the upper harmonics slightly
(Fig. 4), adding variations that can be used in Figure 6: Andes, a JUCE-based synthesizer us-
a polyphonic (poly-oscillator) synthesizer. ing Perlin noise
5.2 Domain warping
Since the domain of noise is distorted with
Another classic technique for adding variation the noise itself, the symmetry of the waveform
to Perlin noise is called domain warping. Warp- will remain generally the same as seen on Fig. 5.
ing simply means that the noise domain is dis-
torted with another function g(p) before the 6 Implementation
noise function is evaluated.
The presented ideas have been implemented as
Basically, noise(p) is replaced with
a basic synthesizer plugin called Andes (Fig-
noise(g(p)). While g can be any function,
ure 6). The plugin has been developed using the
it’s often desirable to distort the image of
JUCE2 framework and is currently available in
noise just a little bit with respect to its regular
the form of VST, AU, and standalone program
behavior.
for Windows, MacOS, and Linux3 .
Then, it makes sense to have g(p) being just
At the time of writing, Andes supports gradi-
the identity plus a small arbitrary distortion
ent rotation, basic warping, up to 16 octaves of
h(p) [Quı́lez, 2002]. In the most basic case the
noise, and adjustable persistence, which allows
distortion can be the noise itself (Eq. 4).
a usable range of unique sounds to be produced.
The sound of noise is susceptible to aliasing at
f (p) = noise(p + noise(p)) (4) higher frequencies, but oversampling has not
For the purpose of sound synthesis it is bet- been implemented so far.
ter to expose warping as an adjustable param- The resulting sounds resemble early digital
eter. Warping modulation can be implemented synthesizers, but also have a unique character
by adding a coefficient that is used to control to them and can be described as “distinctively
the warping depth (Eq. 5). digital”.
2
https://juce.com
f (p) = noise(p + noise(p) · w) (5) 3
https://artfwo.github.io/andes/
6.1 Predictable randomness level normalization is one of the biggest issues
A synthesizer plugin cannot have completely yet to be resolved.
randomly sounding timbres when the synthe- The general idea of using unconventional, i.e.
sizer is used in certain contexts such as a multi- graphics algorithms in sound and music presents
track DAW project. The amplitude and tim- a lot of challenges, but also opens many different
bre of the synthesizer cannot change in un- possibilities in both the technical and aesthetic
predictable ways to make sure the track won’t aspects.
break the mix.
Predictable randomness in Andes is achieved 8 Acknowledgments
by saving the random seed for generating gra- The author would like to thank Maria Pankova
dients in the plugin state (preset). The 32-bit for helping the idea of making a noise-based
Mersenne Twister 19937 generator from C++ synthesizer to emerge and for assistance with
standard library is used explicitly to make sure maths in the early stages of Andes develop-
the random numbers generated from the same ment. Thanks also goes to Alexey Durachenko
seed will stay the same across different architec- for suggesting useful optimizations to the Sim-
tures and platforms. plex noise implementation.
The set of gradients covering the entire al-
lowed range of octaves is created and stored in References
memory every time the plugin is instantiated or Stefan Gustavson. 2005. Simplex noise de-
when a new seed is created using the plugin UI. mystified. http://staffwww.itn.liu.se/
The additional advantage of using precom- ~stegu/simplexnoise/simplexnoise.pdf.
puted set of gradients is that computationally F. Kenton Musgrave. 2002. Procedural frac-
expensive random number generation is moved tal terrains. In Texturing and Modeling: A
out of the audio processing code. Procedural Approach, chapter 9.
6.2 Output level normalization Ken Perlin and Fabrice Neyret. 2001. Flow
A big issue with Perlin noise is normalizing the noise. In Siggraph Technical Sketches and Ap-
output level to fixed values. This issue is cur- plications, page 187, Aug.
rently not resolved in Andes, but a possible di-
rection to explore is early computing of peak Ken Perlin. 1985. An image synthesizer.
values during the stage of generating gradients. SIGGRAPH Comput. Graph., 19(3):287–296,
July.
6.3 Waveform symmetry
Ken Perlin. 2001. Noise hardware. In
The symmetry of waveforms is another thing to
M. Olano, editor, Real-Time Shading ACM-
consider when developing a noise-based synthe-
SIGGRAPH Course Notes, chapter 2.
sizer.
Current Andes implementation uses com- Íñigo Quı́lez. 2002. Domain warp-
pletely random gradients. The first noise oc- ing. http://www.iquilezles.org/www/
tave is built from 3 gradients (at points 0, 1, articles/warp/warp.htm.
and 2). Sometimes, this results in cusps and Patricio Gonzalez Vivo and Jen Lowe. 2015.
unwanted distortion when the both outermost Fractal brownian motion. The Book of
gradients are either positive or negative. Alter- Shaders, https://thebookofshaders.com/
nating signs for even and odd gradients in the 13/.
gradient table can further improve the synthe-
sizer usability.
Setting signs for even and odd gradients ex-
plicitly can also help reduce the domain range
for the noise function.
7 Conclusions
Perlin noise, Fractional Brownian motion and
multifractal synthesis are interesting directions
to explore for sound applications. Although
Perlin noise can be used to make sounds, the
approach still remains to be improved. Noise

You might also like