Sinclair ZX Spectrum
You can include reminders and comments anywhere you like by using !! marks. Anything written after a ! will be ignored until the next ! or the " at the end of the string is reached, e.g.

10 LET a$="abCDEFG!chorus!aCEaDG"

Channel selection

The command M is used to select which of the three channels are in operation and whether these give noise or musical tones.

You can have a maximum of three channels in use at any one time, but it does not matter whether they are all tone, all noise, or a mixture of both.

Your choice is entered with a number following the M, worked out like this

Tone channelsNoise channels

Mark each channel you want to turn on, and note down its number. Then just add them together to get the code you should use after the M. For example, if you want to use tone channels A, B, and C, you add the numbers 1 + 2 + 4 = 7, so you use the command M7. In the same way, M56 would turn on noise channels A, B, and C.

Noise can be used on any channel but the most wide-ranging frequencies are available in channel A. For the best results put your sound effects in the string which controls this channel - a$, the first string after the PLAY command.

Controlling musical instruments

Whenever PLAY is running, a signal can be sent to the MIDI port in the RS232 socket at the front of the computer. This output will drive any MIDI-compatible musical instrument such as many makes of synthesizer and drum machine, so that the instrument will play the music which has been programmed into the Spectrum 128.

Using the MIDI output lets you play more complicated music with up to eight notes at a time instead of three. All you do is to follow the PLAY command with the names of up to eight strings, (a$ to h$, for example) each of which is constructed as described above.

Do not try to send music to the MIDI port unless you have already connected the instrument (see page 3). To send the output to the MIDI port, each string should include the letter Y followed by a channel number from 1 to 16. If you use the same number in each string, up to eight notes can be played by one instrument at the same time. If you use different numbers, you can control up to eight different instruments at the same time.

Most MIDI instruments power up in OMNI mode so that they play the notes on channel 1 as well as the channel to which they are directed. To get the notes on the correct channels, the MIDI instrument must be put into POLY mode. You can do this by directly altering the instrument's MIDI channel, or by including the appropriate MIDI programming code in the string. The programming codes for your instrument should be listed in its handbook and can be sent to it from the Spectrum 128 by including the letter Z in the string, followed by the MIDI code number.

If your synthesizer understands key velocity (so that the program you send it controls the volume at which it plays) this is interpreted from the V settings in the strings. It is calculated at eight times the volume set by the V command, so it takes the values 0, 8, 16 ... 128. The key release velocity when a note is switched off is sent as 64. If the synthesizer is not designed to understand key velocity, it will play the same volume regardless.

Sinclair ZX Spectrum

  Previous Page Back Next Page