Classic Computer Magazine Archive COMPUTE! ISSUE 42 / NOVEMBER 1983 / PAGE 201

Apple Sounds — From Beeps To Music

Part 2

Blaine Mathieu

In the conclusion of this two-part series, the author combines the ideas and programs from Part 1 and presents the "Apple Music Writer." An effective tool for composing or reproducing songs, this utility is also easy to use because of its great variety of commands. There's a thorough discussion of how to use each command.

"Apple Music Writer" is a program which will allow any Apple owner to easily reproduce his or her favorite songs. When you run the program, the first thing you'll notice is the title, and then you'll hear part of a tune that you may recognize. After the tune stops, you will be prompted by the word COMMAND? and a flashing cursor. At the top of the screen you should see a list of the possible commands and corresponding letters. On the right side of your screen you should see a list of note names with corresponding values.

It's important that you understand and know how to use the commands, so let's review them in some detail, in the order that they appear on the screen. These commands are usable only from the COMMAND? mode; you must also RETURN after each command. You may want to experiment with them as we go along.

The Commands

A = ADDNOTE. This command will let you begin your music file (song) and keep adding to it. Every time you press A (and RETURN) you will be prompted to enter the note, a comma, and the duration. For example:


The maximum note value is 255 (actually 0 = 256). The same is true for the duration value. After you've entered your values, you will hear what the new note will sound like in the song.

E = EDIT. If you've made a mistake, you can fix it by typing E (and, as always, RETURN). You will then be asked the number of the note you want to edit. If the note you want to edit is not part of the music file, you will be reprompted for the note number. If you entered a valid note number, you will be given the old values for that note and prompted for new values. The same rules apply for entering data as in ADDNOTE. Let's say you want to edit note number one and replace the old values with new ones of 64 and 200:

NOTE #1 OLD : NOTE = 128 DUR = 200
NOTE, DURATION : 64, 200

P = PLAY. Typing P will put you into Play mode. This will play your song and print it to the screen at the same time. Because it is both listing and playing your music file, the playing will not be at the same speed as in your program. It will be slower and more pronounced. After entering P you will be prompted for the starting and ending note to Play/list. If you just press RETURN instead of entering values, the whole song will be played (defaults will be set; D is the default).

S = SAVE. This command will SAVE your music file to disk. First you will be prompted for a filename, which will be the name used when the file is SAVEd. Then you'll be prompted for the number of the first and last note of your file that you want saved to disk. The next question is FOR FUTURE ADDITION? A little explanation is in order here. There are two types of files which can be produced with this command. If you answer Y to the above question, a file will be created that can be reloaded into Apple Music Writer at any time. You should use this option if you feel you may want to add more notes or edit your song at a later date. If you enter N, a file will be created that you can easily turn into a BASIC program that will play your song when run.

If you answer the FUTURE ADDITION? question with an N, you will be asked for the starting line number of your soon-to-be-created BASIC music program. Then you will be asked if you want a FULL LOADER PROGRAM? If you answer Y, the BASIC program created will include the necessary information so that when your new program is RUN, the machine language "Note Producer" (see Part 1) routine will be POKEd in. If you answer N, the routine will not be included. You would answer N if the program you wanted to add the music to already included some sort of "Note" routine (the routine found in Program 5 of Part 1 of "Apple Sounds – From Beeps To Music").

Finally, you will be prompted to check for errors. If everything is all right, enter Y and the file will be SAVEd. If you enter N, you have to repeat the entire SAVE process. Here is an example of what the average SAVE command might encompass:

(Screen is cleared)

Your music file would now be SAVEd under the filename SONG.1. The file would consist of notes two through ten, and the generated program would start at line 100. The generated program would include the machine language "Note" routine.

L = LOAD. If you answered Y to the FOR FUTURE ADDITION? question back in the SAVE command, you can LOAD an old music file back into the computer. The catch is that you will lose any data that you entered into the computer beforehand. If you don't want to lose your data, then answer N to the question about losing your data. Just enter the appropriate filename, and you can manipulate or add to your data once again.

N = NORPLAY. As mentioned earlier, when you P (Play/list) your song, it will play at a slower speed because it has to list the note values at the same time. To alleviate that problem, you can use the NORmal PLAY command. This will play your song in the same tempo as it will normally be played by your generated program. Just enter the proper values (or defaults will be used) and listen.

D = DELETE. Upon entering D from the COMMAND? mode, you will be asked which note or notes you want to delete. If you hit RETURN after the first question without typing anything else, the default will be used and the last note in the music file will be deleted. If you enter a value for the first question, you will be asked the number of the last note up to which you want to delete. The appropriate notes will then be deleted, and you're back to the COMMAND? mode.

I = INSERT. This command is the exact opposite of the Delete command. Simply answer the few setup questions and enter the data. Note: You cannot leave the Insert mode until you have entered all the data you specified you were going to enter.

R = RESTART. This command lets you start over with a clean slate beginning with note number one.

C = CATALOG will return a fairly standard DOS catalog.

Q = QUIT. Use this command to exit the program cleanly. You will lose all your data that hasn't been SAVEd to disk. If you quit by accident, a GOTO 200 will usually let you reenter the program with no data lost.

. = DOS. What this means is that typing a period followed by any normal DOS command will execute that command. A common use for this might be:


Caution: Certain DOS commands will cause the Apple Music Writer to cease functioning, thus causing a loss of data. Take care.

H = HARD. If you have a printer connected to your Apple, you can get a simple hard copy of your music file by entering H from the COMMAND? mode. Note: You may have to edit lines 1210 and 1220 to accommodate different printers.

Hints For Easier Use

Saving. One good idea is to save two copies of your music file to the disk. One copy should be done in the FUTURE ADDITION? mode so you can edit or add to it at a later date. If you wish, the other copy can be done in the create program, or FUTURE ADDITION? N mode. Always remember to use a different filename.

Tempo. When you enter your durations, remember that if your quarter note has a value of 50, your half note will have a value of 100 and so on. You should set a plan of what duration you want a certain type of note to be and work from there. Rests are done with a note value of one.

Limits. The number of notes you can have in one song is limited. For our purposes the number is 500, but by changing the value of L in line 120, this limit can be raised.

Notes. The note listings on the side of the screen are especially helpful if you are transposing sheet music to disk. The numbers listed are for the middle octave. For the higher octave, divide the number by two; and for the lower octave, multiply the number by two. For example, the note F could be represented by the numbers 36, 72, and 144. You can also make a separate list of all the notes and their numbers. Remember, F # is the same as G-flat and so on. Also, once again, the number zero is equivalent to the number 256.

Exec. In order to use a program that you made in the FUTURE ADDITION? N mode, you must EXEC it. EXEC is a DOS command that prints a sequential text file to the screen as if it were typed from the keyboard. In this way, you can EXEC your file and RUN it as a BASIC program. Later on, you can SAVE it. Another feature is that you can LOAD an old BASIC program (game or whatever) and EXEC your sound routine into it. For this to work properly, however, you must have specified the starting line number during the save of your music file such that the line numbers of the music routine do not conflict with those of the program to which the routine is being added.

Insert. If you have a large amount of repetitive data to type in, one trick is to enter the last note of that data, then Insert the rest. This saves you from repeatedly typing A from COMMAND? mode. (This is useful only if you know beforehand exactly what data you want to enter.)

Keys. There are a number of key codes that you can use with Apple Music Writer. If at any time the screen is getting too cluttered, an ESC-SHIFT-P should do the trick. You can stop a Catalog or a Play/list at any moment with a CTRL-S, and restart it with the touch of any key. Finally, in this program, CTRL-C RETURN can be a useful but sometimes dangerous command. I would recommend using CTRL-C only if you are caught in a never-ending loop or as a last resort. If for any reason you find yourself out of Apple Music Writer, you can usually reenter the program, without losing any data, by typing GOTO 200.

Experiment. No matter how long or well written a manual, nothing can take the place of hands-on experience with a program. Before you try any big projects, be sure you know what's going to happen at all times no matter what you enter during Apple Music Writer. Overall the program is very forgiving. One last thing – the best songs on the Apple seem to be songs with few or no rests. Try using longer notes instead of rests.