In this section we will discuss activities in the particular case of
sound synthesis. We call them sound activities. Like any
activity they have a start time s, a duration d, a start program
ps, and an end program pe. A sound activity represents a sound
that starts playing at time s and lasts for d time. Note that it
can be any sound: short, long, pure, complex, simple, composed, etc...
In this section we will make the following assumptions about the sound
activities:
- they have one parameter that describes the
frequency. This frequency is measured in Hertz.
- they have one parameter that describes amplitude. The
amplitude is measured on a linear scale from 0 to 1.
- their start program schedules a synthesis process, their
stop program kills the same synthesis process.
- they have an associated synthesis voice. The synthesis
voice is charged with the creation of the synthesis process.
The start program of an activity takes two steps. First, it creates
the synthesis process by calling its associated synthesis voice. It
passes the frequency, the amplitude, and any additional parameters to
the synthesis voice (see section 5.3.3). Second, it
sends an add-event to add the synthesis process to the synthesizer.
The end program of a sound activity kills the synthesis process.
We include a remark here. Initially we accepted timbre as the
essential concept to describe a sound and considered the classical
notions of pitch and intensity as attributes of the timbre. We
therefore did not want to ``hard code'' frequency and amplitude in our
environment. Studies in the field of musical perception and cognition
seem to suggest, however, that the pitch and intensity of sound do
occupy a special role in the sound perception (see for example
[SD93] and
[PPK99]). In addition, not
introducing frequency and amplitude would have made most musical
transformations cumbersome and loaded the problem of ``timbre
representation'' on our backs. We therefore accept the frequency and
amplitude as fundamental parameters for sound. Sounds that do not fall
in this category (noises of all trades, for example) get this
interface for free. They benefit from it, if possible, and can use,
for example, the amplitude parameter while neglecting the frequency
parameter.
We also define the interface PitchedSound. This interface
defines the methods getFreq, setFreq, getAmp, and
setAmp. Any object that can handle frequency and amplitude
implements this interface and can participate in musical
transformations. We use this interface to define sound patterns and
sound motifs. They specialize the Pattern and Motif class,
respectively. An amplitude envelope and frequency curve can be set
for both objects. Associated modifiers can use these curves to change
the pattern. We will give examples in the next section.
|
|
Figure 6.12: The classes and inheritance tree for sound
activities. We used a solid line for class inheritance, and a dashed
line for Java's interface inheritance. |
We have also defined the class Note and Chord for
convenience. Both classes inherit from SoundActivity. The note
class allows the creation of sound activities with the following
parameters:
- A start location and duration.
- A synthesis voice.
- A constant pitch value in midi-cents1. This value is converted
into a constant controller returning the value in Hertz.
- An amplitude value in decibels. This value is
converted into a constant controller returning the value in
linear amplitude.
The chord class is very similar, except that it accepts a list of
pitch and amplitude values. For reasons of efficiency we choose to
model a chord as a single activity instead of a pattern. An overview
of the musical classes is given in figure 6.12. In the next section we will give
some examples of modifiers in the context of sound activities.