Introduction
Want to make music with your Electron? Then you have three options. In descending order of sophistication and cost, they are:
- Buy a Music 5000 Synthesiser from Hybrid Technology
- Buy the Complex Sound Systems Sound Expansion Cartridge
- Muck about with the Electron's existing SOUND and ENVELOPE commands!
We'll be looking at the first two options in later editions of EUG. In this edition, we'll look at one of many simple ways to produce music on the Electron.
Music Program
Some time ago, while I was browsing through the Acorn Electron User Guide (Not exactly light reading!), I came across a little program called Tune Player on page 126. It used the INSTR command to read the characters in a string, where each letter represented a note in a major scale. I thought there was a lot of potential in this and, with the help of Alison, my 'other half', started to tinker with the program. After a few set-backs, we came up with this new program.
Please note that INPUTLINE at line 60 is all one word and allows the INPUT of strings that contain commas. When run a prompt >= will appear on the screen. Type the letters and numbers that correspond to the notes you want played. (Please see the keyboard diagram for what notes the letters/numbers stand for). If you need to include pauses in your tune, you must insert commas - these tell the Electron to play a note at volume '0', i.e. silence!
If you want a longer note, enter the letter or number twice or more. When you have entered the notes of your masterpiece, press RETURN and your tune will play forever - or until you press ESCAPE.
If you want your tune to play at a slower speed, change the last '1' of the SOUND command in line 500 to '2' or higher.
A simple way to stop your tune permanently is this:
Firstly, press ESCAPE, then type:
2000 REM RETURN
then use the cursor keys to copy your initial INPUT string. If you then LIST the program before you RUN it, your last INPUT will be available for you to copy or change. Although this method is not exactly 'hi-tech' or user-friendly, it is possible to build up some quite long and complex passages of music as the second program illustrates. It's really only the first program with a few changes.
Line 60 has been changed to call PROCinit. Line 80 has had the extra strings to be read added to it. PROCinit has been 'tagged' on the end and contains the strings needed to play highlights from the "William Tell" overture.
Well, that's about it for this edition but play about with the program and see what you can come up with. If you manage to write an interesting little ditty, send a listing of the strings or, better still write your own more-efficient program...
Will Watts, EUG #0