DSP Implementation 493 Method The key to making a clock is in the control code. A good method for this is to
use a delay chain or rapid counter. We will start with a regular metronome and
feed each bang into a message delay chain to get a very fine-grained sequence of
control events. Most importantly, this keeps everything synchronous. We don’t
have parts of a clock sound shifting around in phase, which sounds completely
wrong; each tiny detail must appear in its correct place within each tick. Having
built a switch, it’s a few simple steps to building a ticking clock. If you haven’t
looked at the switch example I suggest you go back and complete that section
now. The only significant difference between the single switch sound and some-
thing that approximates a ticking clock is the complexity of the control code,
the tunings of the metal click noises, and the shape and size of the amplify-
ing body object. Again we will build a metal click sound based upon filtered
noise. We will then arrange those clicks into more complex patterns creating
little clusters of metal click events, which we’ll call clicks, and then arrange
these into larger clusters, which we’ll call ticks. Again we’ll use mostly metal
formants in the 4kHz to 9kHz range. Most of the parts in a clock are small, only
a few millimeters or centimeters in diameter. However, we can always build in
ratio-based scaling functions so that our clock can be scaled up from a small
wristwatch to a mighty church clock.
DSP Implementation Figure 43.2 Square decay
envelope.
Let the abstraction
be a square law envelope curve as shown
in figure 43.2. A bang at the trigger inlet passes a float given by
the first argument to a message box, where it is substituted as
the time value of the decay segment of a two-part line. The first
part of the line rises to 1
. 0 in 1
. 0ms, from where it decays to
zero. The square of the output of
is then sent to the signal
outlet. A short 1
. 0ms rise time prevents very sharp clicking but
is otherwise inaudible. We will use this abstraction to produce
metallic clicks by modulating bands of sharply tuned noise. In
figure 43.3 the new object is instantiated with a 40ms decay and
tested using a graph of 1000 samples. You should hear a short click at the audio
output and see the decay traced in the graph window.
Figure 43.3 Envelope test.
Now we include
in a higher abstraction
which produces short metallic clicks. This is shown in
figure 43.4 Three instances are created along with three
band-pass filters having a resonance of 30
. 0. The filters
are connected in parallel to a source of white noise. Noise
is taken from an inlet so that we may reuse the same
noise source for several click generators. The output of
each filter is modulated by its own decay envelope. All