SPACE SOUNDS
by Stephen Fowler
from Sinclair Answers #1 (1984)

THE SOUNDS OF BATTLE

Want to add more sound to your astro games? We provide some spaced-out
sound effects routines.


Zaps, zooms, launchings, landings, rapid fire and menacing music - all
essential ingredients of an all action, fast-moving space arcade game.
The trouble with including sound effects in your own programs is the
time it can take to get them just right. Trial and error can take
forever, so this article features a program to generate all action
space sounds, and how to include them in your own work.

Two programs are listed - for 48K Spectrums, and for the 16K version.
The sounds produced are slightly different for the two computers, and
if you run them you will hear the following effects: a missile being
fired, including the whine of it in flight and an explosion; a second
missile being fired; the high pitched engine noise of a distant
spacecraft; the rapid fire of missiles in space; more rapid fire; a
spaceship landing; menacing music; a spaceship taking off, including
engines warming up; the landing of a large spacecraft; a landing of a
second spacecraft; the second spacecraft taking off.

Of course, when you add the sounds to your own programs they can be
made in any order and at any time; this selection is just to give you
an idea of what to expect. For nearly all of these sounds there is a
mix of a high- pitched background noise and a much lower pitched main
noise. The Spectrum cannot produce sounds simultaneously, but the
effect can easily be achieved by switching very rapidly from one sound
to the other. This method adds realism, in particular the landings and
launchings include the sounds of a powerful engine accelerating and
decelerating.

The procedure to add any of the above sound effects to your Basic
programs is quite simple, just work through the following stages.

The first statement in your program should be CLEAR 64099 (or CLEAR
31885 for 16K owners): this sets RAMTOP to allow for the machine-code
programs to fit above it. A few lines of Basic are required to POKE 74
decimal numbers above RAMTOP (see lines 3 to 30 of Spacesnds).

Include the two Basic subroutines to generate sounds (see lines 30 to
39 of Spacesnds).

Now, whenever you want a sound effect, include two lines of Basic in
the following way:

LET A$="AAABBBCCCDDD"
GO SUB 36

Replace AAA with the number of bursts required, plus one. The number
can be from 0 to 255, but must be typed in the form of three digits
(for example, type 1 as 001 or 12 as 012). If you type in 015, for
example, you will get 14 bursts of the sound. The other three numbers,
BBB, CCC and DDD, are typed in a similar format to AAA. BBB affects
the frequency of the sound, a larger number slows it down. The last
two numbers determine the start and finish of the sound. CCC must be
less than DDD, and the larger the difference between the numbers, the
longer the sound will last.

It is important to remember that A$ must be exactly 12 characters
long. We suggest that when you start using this program that sounds
are kept short, just so you don't blow your eardrums listening to the
high-pitched scream of an intergalactic megamissile exploding in your
head, and taking ten minutes to do it. For missiles and the like, the
above two lines should suffice (along with the statement LET M=USR
65100, which generates the sound), but for a more controlled and
complicated sound, such as the noise of a spacecraft landing, a short
routine is needed -

LET A$="AAABBBCCCDDD"   [as above]
GO SUB 31               [to process A$]
FOR I = start TO finish [enter numbers]
POKE 65147,I            [or POKE 65155,I]
LET M = USR 65100       [generate sound]
NEXT I

For the 16K Spectrum change the numbers 65147, 65155 and 65100 to
31933, 31941 and 31886 respectively. The examples in the Spacesnds
listing should help clarify the procedure.

These programs are compatible with the Movearea utilities (listed in
this issue on page 51) that enable easy moving of your drawings. By
co-ordinating movements and sounds, very realistic scenes can be
animated. All that now remains to be done is for you to write an
exciting, zappy new game - and send us a copy!


--
Another Fine Product transcribed by:
Jim Grimwood (jimg@globalnet.co.uk), Weardale, England
--
