Sound Modelling
97
wavetable
wavetable oscillator
increment
The initial amplitude and phase can be imposed by scaling the initial phasor
e
j
0
0
and adding a phase shift to its exponent. It is easy to show
2
that the
calculation of x
R
(n + 1) can also be performed as
x
R
(n + 1) = 2 cos
0
x
R
(n) - x
R
(n - 1) ,
(9)
or, in other words, as the free response of the filter
H
R
(z) =
1
1 - 2 cos
0
z
-1
+ z
-2
=
1
1 - e
-j
0
z
-1
1 - e
j
0
z
-1
.
(10)
The poles of the filter (10) lay exactly on the unit circumference, at the limit of
the stability region. Therefore, after the filter has received an initial excitation,
it keeps ringing forever.
If we call x
R1
and x
R2
the two state variables containing the previous samples
of the output variable x
R
, an initial phase
0
can be imposed by setting
3
x
R1
= sin (
0
-
0
)
(11)
x
R2
= sin (
0
- 2
0
) .
(12)
The digital oscillator is particularly convenient to perform sound synthesis
on general-purpose processors, where floating-point arithmetics is available at
no additional cost. However, this method for generating sinusoids has two main
drawbacks:
· Updating the parameter (i.e., the oscillation frequency) requires comput-
ing a cosine function. This is a problem for audio rate modulations, where
to compute a modulated sine we need to compute a cosine at each time
sample.
· Changing the oscillation frequency changes the sinusoid amplitude as well.
Therefore, some amplitude control logic is needed.
5.2.2
The Wavetable Oscillator
The most classic and versatile approach to the synthesis of periodic waveforms
(sinusoids included) is the cyclic reading of a table where a waveform period is
pre-stored. If the waveform to be synthesized is a sinusoid, symmetry consid-
erations allow to store only one fourth of the period and play with the index
arithmetic to reconstruct the whole period.
Call buf[] the buffer that contains the waveform period, or wavetable. The
wavetable oscillator works by circularly accessing the wavetable at multiples of
an increment I and reading the wavetable content at that position.
If B is the buffer length, and f
0
is the frequency that we want to generate
at the sample rate F
s
, the increment has to be set to
I =
Bf
0
F
s
.
(13)
2
The reader is invited to derive the difference equation 9
3
The reader can verify, using formulas (29­32) of appendix A, that x
R
(0) = sin
0
, given
x
R
(-1) = x
R1
and x
R
(-2) = x
R2
.
Next Page >>
<< Previous Page