EasyManua.ls Logo

Atari ST series - Page 84

Atari ST series
420 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
CHAPTER 4
set the volume level, and set the tone period to determine
the pitch of the tone. Enable a channel to produce a tone by
setting the corresponding tone bit in register 7 to 0. Be very
careful when setting this register, however, since the upper
two bits are used to determine the direction of data flow for
the two onboard I/O ports. The correct procedure is to read
the register first and change only the bits of interest, using
logical AND or logical OR functions. Next, set the tone pe
riod registers. The tone period is a 12-bit number (0-4095)
that determines the pitch of the tone. To set tone period
place values in two registers, one for the low byte (bits 0-7),
and one for the high nybble (bits 8-11). The relationship of
this tone period to the pitch of the note is determined by the
formula
period = dock / frequency (Hz) * 16
where
clock is the clock speed of the PSG (2,000,000 cycles
per second). This formula can be reduced to:
period = 125,000 / frequency (Hz)
or
frequency (Hz) = 125,000 / period
As the period value increases, the pitch becomes lower
in tone. The period settings for the notes of the chromatic
scale, beginning with middle C, are shown in Table 4-4.
Table 4-4. Relationship of Period, Note, and Frequency Across One
Octave
Period
Note
Frequency
478
C
261.6
451 c #
277.2
426
D
293.7
402
D#
311.1
379
E 329.66
358
F
349.2
338
F#
370.0
319
G
392.0
301 G#
415.3
284
A 440.0
268
A #
466.2
253
B 493.9
76

Related product manuals