www.jupiter-ace.co.uk |
Previous Page > Listings Index > Music. |
|
Music listing from Popular Computing Weekly 27 January - 2 February 1983 Music
on Jupiter Ace To start the music program, you must define a variable to set the length of the notes. In this program all notes will be the same length. The variable Qua will be used:
200 VARIABLE QUA
Now you can define the word, Music as: DEFINER MUSIC , DOES> @ QUA @ BEEP ; This enables you to store the data for the notes in a very efficient way. Now the boring bit - the data is put in as variables thus:
478 music C
426 music D 379 music E 358 music F 319 music G 284 music A 268 music BB (stands for B flat) 239 music C+ (an octave above the other C) 213 music D+ 201 music EB+ 179 music F+ 190 music E+ You can of course define further notes, but these should be sufficient for an example program. Next, a word Part 1 is defined:
: PART1 F G A C+ BB BB D+ C+ C+ F+ E+ F+ C+ A F G A ;
Next a word Part 2: : PART2 PART1 BB C+ D+ C+ BB A G A F E F G C E G BB A G ; And a third word: : PART3 PART2 APART1 D C+ BB AG F C F E F A C+ F+ C+ A F A C+ ; The word to run this demonstration program is Bach;
: BACH PART3 179 QUA @ 3 * BEEP ;
Typing in Bach should now run the program. If any problems are encountered then a word Scale should solve them.
: SCALE C D E F G A B C+ D+ E+ F+ SCALE ;
which is a clever way of producing an infinite loop (instead of Begin 0 Until, as suggested by the Ace manual) by getting the word to call itself. Scale just gives a repeating scale of notes (until you press Break, so not use Fast mode) so you can decide if a note is badly defined.
This method is more efficient in memory terms than that suggested by the manual and is a useful addition to games. The words can be used inside words as well as in immediate mode.
The program can be slowed down to a more sedate speed by
300 QUA !
which resets the variable Qua. Music
by Martin Sudworth
Note:
Update the definition of SCALE, when first printed in the magazine the word SCALE called itself and fills up the memory with return addresses. The correct definition of SCALE is:- : SCALE C D E F G A B C+ D+ E+ F+ R> DROP SCALE ; |
|