Specifications

64 Shaping sound
SECTION 6.3
Other functions
From time to time we will use other functions like exponentiation, raising to
a variable power, or doing the opposite by taking the log of a value. In each case
we will examine the use in context. A very useful technique is that arbitrary
curve shapes can be formed from polynomials
Polynomials
*~ 2
*~ 0.5
*~
*~
*~
+~
*~ 0.45
+~
*~ -5
*~ -18
*~ 23
phasor~ 670
phasor~ 670
x * 2x -18x^3 + 23x^2 - 5x
pd grapha
B
pd grapha
A
fig 6.15: Polynomials
A polynomial is expressed as a sum of different
power terms. The graph o f 2x
2
gives a gently
increasing slope and the graph of 18x
3
+23x
2
5x shows a simple hump weighted towards the
rear which could be useful for certain kinds of
sound control e nvelope. There are some rules
for making them. The number of times the
curve can change direction is determined by
which powers are summed. Each of these is
called a term. A polynomial with some factor
of the a
2
term can turn around once, so we say
it has one turning point. Adding an a
3
term
gives us two turning points and so on. The
multiplier of each term is called the coefficient
and sets the amount that term effects the shape. Polynomials are tricky to work
with because it’s not easy to find the coefficients to get a desired curve. The
usual method is to start with a po lynomial with a known shape and carefully
tweak the coefficients to get the new shape you want. We will encounter some
later like cubic polynomials that can be used to make natural sounding envelope
curves.
Expressions
Expressio ns are objects with which you can write a single line of a rbitrary
processing code in a programmatic way. Each of many possible signal inlets
x, y, z correspond to variables $V (x, y, z) in the expres sion and the result is
returned at the outlet. This example shows how we generate a mix of two
sine waves, one 5 times the frequency of the other. The available functions are
very like those found in C and follow the maths syntax of most programming
languages. Although expressions are very versatile they should only be used as
a last resort when you cannot build from more primitive objects. They are less
efficient than inbuilt objects and more difficult to read. The expr e ssion shown in
Fig. 6.16 implements Asin(2πω) + Bsin(10πω) for a p e riodic pha sor ω and two
mix coefficients where B = 1 A. The equivalent patch made from primitives
is shown a t the bo ttom of Fig. 6.16.