Left margin, 48 bytes

FRONT COVER PAGE 1 PAGE 2 PAGE 3 PAGE 4 PAGE 5 PAGE 6 PAGE 7 PAGE 8 PAGE 9 PAGE 10 PAGE 11 PAGE 12 PAGE 13 PAGE 14 BACK COVER



SOUND EFFECTS


10 LET a$="M8UX350W507(((C)))": PLAY a$ : PAUSE 25
20 LET a$="M56UX5000W1O3(((C)))" : PLAY a$ : PAUSE 25
30 LET a$="M56W2O1N8C" : PLAY a$ : PAUSE 25


Using the PLAY command


In the examples above, you will see that each time the PLAY command appears, it is followed by up to three different letters, each followed by a $ sign in a statement like


PLAY a$,b$,c$


Each of these is the name of a string (a series of characters) which you have already given to the computer earlier in the program. The strings tell the Spectrum 128 which sounds to make.

PLAY controls three separate sound channels called A, B, and C and there can be up to three strings, one for each channel. In the MUSIC example given above, a$ tells channel A to play the melody line, b$ tells channel B to play a harmony, and c$ tells channel C to play a bass part. In the SOUND EFFECTS example, only one noise is used at a time (although up to three can be), so each one is in channel A and the command is simply PLAY a$.

In fact any of the channels can produce either a musical tone or noise, so you can mix sound effects in with your music (see Channel selection).


Constructing strings


Composing music and sound effects on the Spectrum 128 is simply a matter of creating strings containing the information you want. You can see how this works in the MUSIC example above. Each string is created with the LET command, followed by the name of the string, and its contents enclosed in "" marks. Try this example, which plays just one note - an A.


LET a$="a": PLAY a$


Any music program using PLAY also uses LET to tell it what to play, as you can see by looking at the earlier examples. The reason why these programs look more complicated than the example above is that the strings enclosed in the "" marks contain many letters and numbers to define a longer tune or more complex sound.

Any musical sound has a pitch and duration. It also has a volume and tone quality. The strings in the earlier examples contain information about all of these. The summary below lists each possible command, and they are explained in detail opposite.

PLAY command summary
This is a brief list of the commands which can be contained in a PLAY string.
Note that all letters except note names must always be in capitals.
String entryFunction
c-b or C-BGives pitch of note within current octave range
$Flattens note following it
#Sharpens note following it
OFollowed by number 0 to 8 sets current octave range
1-12Sets length of notes
&Denotes a rest
NSeparates two numbers
VFollowed by a number 0 to 15 sets volume of notes
WFollowed by a number 0 to 7 sets volume effect
UTurns on volume effect in any string
XFollowed by a number 0 to 65535 sets duration of volume effect
TFollowed by a number from 60 to 240 sets tempo of music
( )Enclose repeated phrase
! !Enclose a comment
HStops a PLAY command
MFollowed by a number from 1 to 63 selects channels
YFollowed by a number from 1 to 16 turns on a MIDI channel
ZFollowed by a number sends that number as a MIDI programming code

FRONT COVER PAGE 1 PAGE 2 PAGE 3 PAGE 4 PAGE 5 PAGE 6 PAGE 7 PAGE 8 PAGE 9 PAGE 10 PAGE 11 PAGE 12 PAGE 13 PAGE 14 BACK COVER