new version 1.1
a CRTC and Robot PD production
The ChaRleyTroniC Supersonic System is a new program for composition of music
on the CPC. The music can have three channels simultaneously as well as
different envelopes, volume and noise. Seven octaves of notes are available.
In addition, the Supersonic Compiler is supplied, which will transform a 16k
music file into a (probably) smaller file which can be run from your own
programs - either machine code or BASIC.
THE MAIN PROGRAM (SONIC.BAS, SONIC.BIN)
When you have run this program, the main editing screen will appear. At the
bottom of the screen is the music display, made up of lines such as:
0005 C-3 00D0 E-3 00D0 G-3 00D0
The leftmost figure (here, 0005) is the beat number. You can have 1024 beats,
numbered 0000 (the first to be played) to 1024, and they are played in order at
the speed you want.
The next part of the line is made up of three groups, each consisting of a note
and its status. Each group represents a channel - you can have one note on each
channel at once.
The note is in the format note-octave. For example, above you see the note C-3.
This means the note C in the third octave up - middle C. You can go from C-0
(the lowest) to C-7 (the highest).
Finally in each group, there is a seemingly obscure hexadecimal number - in the
above example, 00D0. This is made up of four separate values: volume envelope,
tone envelope, starting volume and noise level. Volume envelope and tone
envelope determine what the note sounds like - the subject is quite
complicated, but there is an excellent explanation in your CPC's manual which I
would refer you to. Starting volume is obvious - how loud the note is when it
starts - and noise level is the level of "hiss" in the note. Each of these four
can be varied from 0 to 15 - referred to in hexadecimal, i.e. 0-F (0-9 followed
by A-F instead of 10-15).
You can select a channel to edit by the left and right cursor keys. Similarly,
you can move up and down notes by the up and down cursor keys. CTRL and the up
cursor key will move you to beat 0000, or to move to a specified beat, press
CTRL-B and input the beat number.
To input a note, you should make sure that the right octave is selected (press
CTRL-O to cycle through) and then play the note on the computer keyboard. It's
arranged like a piano keyboard, viz:
S D G H J 2 3 4 5 6
Key Z X C V B N M Q W E R T Y U I
or < > ?
Note C D E F G A B C D E F G A B C
- next octave -
(The raised keys are sharps/flats, indicated by a # - sharp - sign in the
To change envelopes, volume or noise, press CTRL-E (volume envelope), CTRL-T
(tone envelope), CTRL-V (volume) or CTRL-N (noise). These will alter the
settings used for the next note. To change an existing note to the new
settings, whilst retaining the old note, press COPY.
When typing in music, ENTER leaves a beat (useful for rests, differing note
lengths etc.) and CLR erases a note. When you've finished your music, at the
end of each channel, press TAB - the "rpt" (repeat) legend will appear. Note
that you cannot have "rpt" as the first item on a channel.
When you want to hear your music, move to the right place and press CTRL-G (G
for go). The music will start from your current position and will continue
until you press a key.
You can define envelopes before you RUN the program, or you can type in BASIC
commands - such as ENV or ENT to define envelopes - using CTRL-C. Type CTRL-C,
and you will be allowed to enter a BASIC command. Terminate with ENTER, and it
will be obeyed and the program will continue.
CTRL-R will change the speed at which the music plays - 4 being the fastest and
255 being deathly slow! There are four save/load keys. CTRL-S and CTRL-L save
and load the music respectively, as a 16k binary file. CTRL-Z saves envelope
definitions only, and CTRL-X reloads them. So you could create a file full of
all the envelope definitions you use, and reload this for use in a tune.
However, the envelope definitions are saved with the tune too.
Finally, CTRL-U will let you cut the next 64 notes from your current position
on the current channel into a store memory (1-16). These notes can be recalled
and "attached" somewhere else in the music by CTRL-A.
THE COMPILER (COMPILER.BAS, COMPILER.BIN)
Note that the compiler must be on the same disc as the main program - or at
least the file SONIC.BIN - for it to work.
The compiler takes your saved (source) file from the main program, and produces
a machine code file - usually more compact. This file can then be used in your
The produced (destination) file is saved as a binary file beginning at address
&8000 (decimal 32768). It is not relocatable. There are two CALLs to the
routine which are possible:
CALL &8000 - set up envelopes for the tune
CALL &8003 - must be called every 1/50th of a second (e.g. at frame flyback).
When called repeatedly (50 times a second), it plays the tune.
You might also find the following firmware call useful:
CALL &BCA7 - shuts up the sound chip
From machine code, you should either work this into the main loop of the
program (if it is synchronised to frame flyback, like most demos) - calling
&8000 at the start - or construct some sort of interrupt (details in the
Firmware Manual or The Ins and Outs of the Amstrad, publ. Melbourne House).
From BASIC, you could CALL &8000 at the start of the program and then set up an
EVERY 1 GOSUB whatever routine to CALL &8003 every 1/50th of the second.
However, it's easier to write a short program to set up a machine code
interrupt, and such a program is provided on the disc under the name
INTER.BAS. This utilises the example music on the disc, HOLBERG.BIN (compiled).
If you are using it from machine code, please note that none of the main set of
registers (apart from SP!) are preserved, but the alternate set are unaltered.
You are advised to PUSH any needed registers before CALLing &8003.
This program is "Almost" Public Domain. I'm quite happy for individuals to copy
it, but I don't want any PD libraries, BBSs, fanzines or what-have-you
distributing it without my written permission. Those libraries and BBSs with
permission are (22.05.91):
Robot PD, Penguin Software, Demon PD, Technosoft PD, Arcade Fantasy BBS,
European and other non-British libraries can use it without applying for
All queries, complaints, assassination attempts and free NeXT Workstations are
appreciated at the following address: 2 Trent Road, Oakham, Rutland LE15 6HF,
UK - or contact me on the Arcade Fantasy BBS, (0533) 376056 (mail Richard
Fairhurst), all speeds up to V22bis, 8am-8pm, scrolling.