WaveWarp 2.0 Component
      

Signal Generators:
Functional Description
Generates a four-stage control signal envelope, where each stage has its own
selectable profile and duration. The output of this component is nominally scaled
between 0 and 1 (for use as an "Amplitude" controller).
This type of envelope is often used for shaping the amplitude of the output
of an oscillator (or wavetable generator) in order to create synthetic musical
notes with realistic transient characteristics. In such applications, the four
stages are conventionally referred to (in order of occurrence) as the Attack,
Delay, Sustain, and Release phases-- hence the name "ADSR". The number
of stages in an envelope is essentially arbitrary, though the use of four stages,
as implemented here, is particularly common. If more stages are required, it
is straightforward to combine multiple components to achieve any number of stages.
The main difference between this four-stage envelope generator and the other
control signal generators in the WaveWarp Component Library is that each stage
of the four-stage envelope can have its own time scale which may be completely
different from the other stages. For example, the first stage, i.e. the Attack,
may be set to have a rather short duration, say a few milliseconds, representing
the initial part of the transient characteristic of a musical note. The next
stage, i.e. the Decay, may be of a similar duration, but the third stage, i.e.
the Sustain, may be rather longer, up to a few seconds, for example, representing
the sustained note when holding down the key of an organ, and the last stage,
i.e. the Release, may be different again. Ultimately the same overall result
could be achieved by appropriately shaping a single-stage envelope. However,
a multi-stage architecture is considerably more convenient for the following
reasons: (i) each stage can be independently adjusted, so that, for example,
it is not necessary to re-program the entire envelope when, say, only the shape
and duration of the Sustain portion needs to be changed; and (ii) the implementation
is more practical using multiple stages when the time scales of each stage are
different: an equivalent single stage envelope would require a much larger lookup
table in order to implement the different time scales, since the required resolution
of the table would be determined by the stage with the shortest duration, and
this would have to be maintained over the long duration stages, thereby resulting
in a long table. By contrast, each stage of the multi-stage envelope can be
implemented with its own "inner counter" (and thereby be implemented,
in effect, at its own sample rate commensurate with its duration).
Although ADSR envelopes are typically used for shaping musical notes, this
is by no means the only useful application. In fact they are rather versatile
tools and can be used in a wide range of applications where synchronisation
between components is desired over multiple time scales. For example, they can
be used to accurately control the relative amplitudes of muliple signal channels
to create customised "panners" which, in turn, can be further synchronised
to any other event such as the time-varying playback rate of an audio file,
thereby creating elaborate time-stretched panning effects e.g. to play back
a spoken word in such a manner that the start of the word begins in the center
of the stereo field, then quickly pans all the way to the left (during the Attack
phase), then slowly pans from left to right during the slowed-down playback
of the main portion of the word (during the Sustain phase), then quickly pans
from the right back to the center at the end of the word (during the Release
phase).
NOTE: the sample rate at which this component is executed can be arbitrarily
set via the "Sample-rate setting for Signal Generators and Input ASCII files"
button (or the "Sample-Rate Setting" command under the "Edit" menu) on the toolbar,
which is activated whenever the component is selected on the DrawingBoard. Equivalently,
it can be set via the dialog box which (i) appears when the component is initially
dragged on to the DrawingBoard or (ii) is activated using the right-mouse-button
when the component is selected on the DrawingBoard. This procedure allows the
component to either (i) enforce a user-determined sample rate on the downstream
component(s), or (ii) to inherit the sample rate from the downstream component(s).
Different signal generators can run at different sample rates on a DrawingBoard,
as long as the rules of connectivity for multiple sample rates are adhered to
(see the WaveWarp Users' Guide for more information.)
The characteristics of the ADSR envelope are adjustable via the Parameter
Window, as summarised in the following table.
| |
Parameter |
Purpose |
| "Envelope amplitude profile"
sliders: |
Initial |
Sets the amplitude of the
envelope before the "Attack" stage starts. This is applied to
the output during the initial pre-delay. |
| |
Attack |
Sets the amplitude of the
end-point of the Attack stage such that the Attack stage starts with the
value of the "Initial" slider and ends with the value of the "Attack"
slider. |
| |
Decay |
Sets the amplitude of the
end-point of the Decay stage such that the Decay stage starts with the value
of the "Attack" slider and ends with the value of the "Decay"
slider. |
| |
Sustain |
Sets the amplitude of the
end-point of the Sustain stage such that the Sustain stage starts with the
value of the "Decay" slider and ends with the value of the "Sustain"
slider. |
| |
Release |
Sets the amplitude of the
end-point of the Release stage such that the Release stage starts with the
value of the "Sustain" slider and ends with the value of the "Release"
slider. Note: the output maintains the value of the "Release"
slider during the "off-time" when "Enable Looping" is
selected. |
| "Looping Parameters": |
"Enable looping"
checkbox |
When this checkbox is selected,
the envelope is repeated indefinitely, though with a separation set by the
"off-time" between successive cycles through the envelope.When
this is checkbox not selected, the envelope is only executed once. Thereafter,
the ouput maintains the constant value given by the "Release"
slider. |
| |
"Pre-delay" slider |
This sets the amount of
time before the envelope is executed on its first cycle from the moment
the DrawingBoard is started. This pre-delay, measured in seconds (denoted
"Total pre-delay"), is given by the slider value multiplied by
the "Slider range" selection. This combination of slider and range
selection allows for a wide range of possible time scales. |
| |
"Off-time" slider |
If the "Enable looping"
checkbox is selected, this slider sets the amount of time between successive
cycles through the envelope. This off-time, measured in seconds (denoted
"Total off-time"), is given by the slider value multiplied by
the "Slider range" selection. This combination of slider and range
selection allows for a wide range of possible time scales. |
| Individual controls for each stage: |
"Duration" slider |
Sets the time duration of
the given stage. This duration, measured in seconds (denoted "Total
duration"), is given by the slider value multiplied by the "Slider
range" selection. This combination of slider and range selection allows
for a wide range of possible time scales. The duration of each stage is
indicated in the plot (above each stage profile), though the plot time axis
is not too scale in order to maintain clarity. |
| |
"Envelope profile " selection buttons |
For the given stage, sets the
profile from a choice of built-in shapes or from an external ASCII file
(for total flexibility). The chosen profile is depicted in the plot window.
The profile is applied between the start-point and end-point amplitudes
of the given stage, as set by the "Envelope amplitude profile"
sliders. The various profile options are summarised as follows:
- "Linear" -- straight line
- "Exponential" -- exponential curve
- "Inverse Expo" -- inverse exponential curve
- "S-curve" -- "S" shaped curve
- "Inv S-curve" -- Inverse "S" shaped curve
- "Load from file" -- load from ASCII file (in WaveWarp's
wavetable format)
|
| |
"Curvature" slider |
For the given stage, this slider adjusts the
degree of curvature (i.e. non-linearity) of the selected profile, emphasising
its shape as desired. Note that the slider is disabled for "Linear"
and "Load from file" options. |
| |
"Import profile from file" dialog |
Activated when "Load from file" is selected for a given
stage. The profile is imported from an ASCII file containing an arbitrary
user-defined profile, and interpolated (to a suitable length) via the
selected "Interpolation" method (i.e. "linear" or "staircase").
If "End-point matching" is selected, the imported profile is
automatically adjusted such that the end-points of the imported stage
are aligned with the values set via the "Envelope amplitude profile"
sliders -- otherwise, the data from the imported profile is used "as
is" and the sliders are ignored for this stage.
The ASCII file format is described in the WaveWarp
Users' Guide. This simple file structure enables files to be written
by hand (e.g. via a text editor). For MATLAB®
users, the process of creating waveforms is particularly straightforward.
The "wwmatlab" sub-directory of the WaveWarp root directory contains the
necessary function m-files (plus example scripts) for exporting wavetables
from MATLAB, thereby providing ready access to MATLAB's powerful mathematical
tools for creating elaborate waveforms. (Refer to the WaveWarp
Users' Guide for a summary of all bundled m-files for working with
MATLAB in a variety of areas in addition to waveform design).
|
Algorithm
The profile of each stage is stored in a separate wavetable, and is scanned
using a linearly-interpolated table-lookup algorithm at a rate which is commensurate
with the duration of the stage with respect to the underlying sample rate of the
component (see [Moore] sections
3.1.7 and 3.2.8, and [Roa]
p. 90-98 for further information on wavetable lookup and ADSR envelopes).
Signal Implementations
| Audio signals | Control signals | Description |
| n/a | single output | Generates a control signal with an amplitude nominally between 0 and 1 |
Related components:
Example DrawingBoards illustrating usage:

      
|