AMPLEKEY – automatic AMPLE notation

Kevin Doyle
For those without the Music 4000 keyboard, this program is designed to provide a simple musical keyboard on the BBC Micro and a means to compose quickly and easily into AMPLE notation. If, like me, you know the sound of the notes you want but find using the Staff Editor or typing in lines of AMPLE notation a frustration of trial and error, then this program is for you.
The program takes key presses from the BBC keyboard and plays notes on the currently selected voice(s) whilst displaying those notes and their duration in AMPLE notation. This enables you to select an instrument and play whatever you like without having to think about the staff or AMPLE notation. Also, because the AMPLE notation is displayed as you play, you can stop at any point and copy a phrase you like into an AMPLE word. This is particularly useful when 'playing along' with an existing piece to find a suitable accompaniment.
The program uses two rows of the BBC keyboard to represent the available notes. These are arranged to mimic the layout of a musical keyboard using the upper row for the 'black' notes, the lower for the 'white'. Because the span of the BBC keyboard is fairly limited you can only play across 20 notes (an octave and two-thirds); but you can switch between any of the 11 available octaves at the press of a key.
Because the note lengths in AMPLE are measured in very small units, a facility is provided to round (or 'quantise') the note lengths played, to the nearest multiple of any number from 1 to 999. This can be very useful in composing multi-part pieces when the parts on each voice must keep time.
 The program is quite simple to use. It is in *EXEC format and should be read into your AMPLE program using:
*EXEC U.AK
To hear the effect of your key presses you must have set up a voice and instrument ready to play (e.g. by typing 1 VOICES 1 VOICE Upright SCORE). You can check this before you start by typing some notes at the % prompt. Then all you have to do is to enter 'AK' to start the program.
The first thing that happens is that the screen clears and the AMPLEKEY display appears. The display is divided into three sections:
1) On the top two lines are the title and a line showing the current note and the rounding number in effect.
2) The middle section is the area where the notes you play appear in AMPLE notation - at the start it only shows the middle octave indicator '0:'.
3) The bottom three lines show the relationship between the keys on the BBC keyboard and the musical notes they represent. Sharps are shown in green (the AMPLE notation also uses sharps).
If you press one of the keys indicated you will hear the sound and see the note appear in the 'Current note' field. If it was a sharp then the AMPLE notation '+' will appear in front. If you now press another note you will see it replace the previous one in the 'Current note' field and the previous note will appear next to the octave indicator with its length in AMPLE notation. This will continue for each note you press. If you play notes more than an octave apart the correct AMPLE notation (using '!') will be shown. To play a rest, press the space bar.
To switch to another octave range on the keyboard press the "<," or ">." keys. These move you down or up an octave respectively. You should not press the SHIFT key - nearly all the keys in AMPLEKEY only work when just the caps lock is on. The new octave will now be displayed at the start of the next line.
If you type enough notes to fill the screen (something over 120), it will scroll up, a line at a time, to accommodate more. If you would like to clear the screen and start again then press the TAB key. This again displays the current octave at the start of the AMPLE display area.
To use the 'rounding' facility press the '?/' key. Once pressed, the word 'Rounding' under the title starts to flash and the only usable keys are the up and down cursor keys (to adjust the rounding number), the SHIFT key (to increase the effect of the cursor keys by a factor of 10) and the RETURN key (to 'fix' the rounding number and return to the keyboard). Once a rounding number is established, the length of all future notes is adjusted up or down to the nearest multiple of this number. Make sure you don't set the number too high because note lengths of less than half the rounding number become 0 and will not play if copied into a word.
Because note lengths in a tune will often be the same for several notes in succession, the program will suppress the display of the note length if this is the same as the last note. This is more likely with a rounding number in effect.
To ensure a neat display, suitable for copying into an AMPLE word, the program always displays the note length at the start of each line and will not split the display of a note over two lines. You can start a new line (with the current octave displayed) at any time by pressing the RETURN key.
If you type notes in very fast the program will not be able to process these quickly enough and they will be stored in the keyboard buffer. Because this means that the note lengths will not be exactly as you played them, a warning is given by the 'Rounding' display near the top of the screen turning red. Once the buffer is empty it will change back to its normal cyan colour. The shortest note length that can be accurately recorded by the program is about 12 hundredths of a second (i.e. a note length of 12 with the 'standard' tempo of 48, 125=T).
The new octave, clear screen, new line and rounding keys described above will stop the current note playing. The length of the note will be measured to the point at which the new key was pressed.
To end "AK" and return to the % prompt, press the ESCAPE key. This clears the information from the top and bottom of the screen, but leaves all the displayed notes intact. Any note currently playing is stopped. You will now be able to copy any of the displayed notation into an AMPLE word. You can also see the equivalent staff notation by prefixing the notation with %STAFF and calling the word into the Staff Editor.
The program ("U.AK") operates in MODE 7 and uses about 1800 bytes of memory including the storage of its working variables. In order to save memory the program has been packed into the smallest space possible - it is not meant to be an illustration of good programming technique!
The version of AMPLEKEY provided is designed to be *EXECed into existing pieces. If you wish to use AMPLEKEY when developing new pieces, you should create a master program containing just AMPLEKEY. To do this, *EXEC AMPLEKEY into a new program and then SAVE it. You can then LOAD this program when starting a new piece of music and build the rest of your program around it.

Related file on this disc:
U.AK - AMPLEKEY utility (to be *EXECed into an AMPLE program)

Published in AMPLINEX 005, May 1988