Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 9, NO. 7 / JULY 1983 / PAGE 202

Modification of celestial music. Bob Perkins.

I read with great interest the article "Celestial Music" by Leo Christopherson in the March 1982 issue of Creative Computing. I was, however, unhappy that in his approach the Apple was incapable of producing musical lines of more than 120 notes. His method of packing a machine language program into a DATA statement is interesting, but restrictive.

I recoded the machine language portion, and have presented the source code here (as Listing 1) for others with assemblers. It is only two bytes longer than Christopherson's original, but will now accept any length of musical line.

Mr. Christopherson also asserted that while Atari users could utilize all free memory for their music programs. Apple users could not. By using the pointers at 109-110 ($6D-$6E) this program enables all free memory.

There is a hitch, however. All variables, including string variables, must be defined previously. The definitions themselves are irrelevant, but all pointers must be set up and space allocated beforehand. In this program I have set aside space for an array, which allows musical data to be entered in the form of a FOR-NEXT loop as opposed to a DATA statement. Bear in mind that all variables, including string variables, must be defined before the data are POKEd into memory.

The routine can be CALLed from two different locations: the first, at 768, will automatically set the pointers to the end of the variable table. The second, at 776, allows the user to use any point in memory as a starting point for the data set. This allows storing of multiple songs back to back if the user keeps track of their starting locations in memory.

Listing 2 is a Basic program which converts alphabetical musical notation burden themselves with cryptic numerical key codes. I found that entering durations was more effective if left as numerical data, and not converted to whole, half, quarter, and so on.

The slight delay coming to and from the data fetch leaves an audible pause, so though a whole and half note might have a duration of 16+8, a single note of duration 24 is more accurate.

The Applesoft program appears in somewhat tragged shape in order to have as much correlation as possible between the modification presented here and Christopherson's original program. More music could have been added very easily, as could better program flow. So get to work!