CREATING
THE
WAVEFORM
DATA
The
waveform used as an example
in
this section is a simple sine wave, which produces a
pure tone.
To
conserve memory, you normally define only one full cycle of a waveform
in memory. For a steady, unchanging sound, the values
at
the waveform's beginning
and ending points and the trend
or
slope of the
data
at
the beginning and end should be
closely related. This ensures
that
a continuous repetition of the waveform sounds like a
continuous stream of sound.
Sound
data
is organized as a set of eight-bit
data
items; each item is a sample from the
waveform. Each
data
word retrieved for the audio channel consists of two samples.
Sample values can range from -128
to
+127.
As an example, the
data
set shown below produces a close approximation
to
a sine wave.
Note
that
the
data
is stored
in
byte address order with the first digitized amplitude
value
at
the lowest byte address. the second
at
the next byte address, and so on. Also,
note
that
the first byte of
data
must
start
at
a word-address boundary. This is because
the audio DMA retrieves one word
(16
bits)
at
a time and uses the sample
it
reads as
two bytes of data.
To
use audio channel 0, write the address of "audiodata" into
AUDOLC,
where the
audio
data
is
organized as shown below. For simplicity, "AUDxLC"
in
the table below
stands
for the combination of the
two
actual location registers (AUDxLCH and
AUDxLCL). For the audio DMA channels
to
be
able
to
retrieve the
data,
the
data
address
to
which
AUDOLC
points must
be
located
in
the
low
512K bytes of RAM.
Audio Hardware 137