Sinclair ZX Spectrum
As you saw on the previous page, you set the pitch of any note by giving its musical name - eg, C E G. Sharp notes are prefixed by # (eg #C) and flat notes by $. Your 'instrument' covers two octaves in the key of C, and uses letters c to b for the notes in the lower octave, C to B in capitals for the higher one.

Any number of notes within these two octaves can be played one after another, e.g.

10 LET a$="cfedafgCFEDAFGCC"
20 PLAY a$

If you want to span more than just two octaves, you can change the overall pitch of your 'instrument' by using the octave command 0 followed by a number from 0 to 8. if you do not specify an octave (as in the example above) it is automatically set to 5 (the range containing middle C). The octave command remains in force for all notes which follow it until a new octave command is given.

This program lets you hear the same tune played in a higher octave (just add the O7 to your earlier program)

10 LET a$="O7cfedafgCFEDAFGCC"
20 PLAY a$

Try changing the octave number progressively to hear the full pitch range which your Spectrum 128 can produce. Notice that some of the very lowest notes in octaves 0 and 1 will not be reproduced at the right pitch except through the MIDI output. The Spectrum 128 will simply play them at the lowest pitch possible.

Since each pitch range covers two octaves, two adjacent ranges overlap. For example, the high part of 04 contains the low part of 05 (see the diagram below). Note that you can extend any range slightly by using a series of sharps (####) or flats ($$$$) to raise the pitch of individual high notes or lower the pitch of low ones.

Note duration

If you do not specify the length of each note, they will all be played at the same length (as crotchets) as in the examples above. You can fix the length of any note or series of notes by prefixing it with a number from 1 to 12. This program lets you hear the different note duration with numbers from 1 to 9.

10 LET a$="1C2C3C4C5C6C7C8C9C"
20 PLAY a$

Pitch values for making music with PLAY

This diagram shows how you can create different notes using the Spectrum 128's octave command.
The command O followed by a number from 0 to 7 sets the Spectrum 128 to a range of two octaves beginning with a C. The diagram shows complete range of notes covered by O4. O5, and O6.
Adjacent octave ranges overlap, so the same notes appear in the upper part of one range and the lower part of another. Individual notes within an octave range are set by using the letters c to b in lower case for the lower notes and C to B in capitals to give the notes in the upper octave.
Placing a # before any note letter gives a sharp note - a $ flattens it.

Octave diagram, 33596 bytes

Sinclair ZX Spectrum

  Previous Page Back Next Page