“Santa-C” Holiday Program

Authors

Publication

Pub Details

Date

Pages

See all articles from SUM v3 n11

This program contains two novel approaches to BASIC programming of the 2068 computer that I developed in teaching the subject in adult education classes. One is a departure from the text-book method of programming BEEP (music?) and the other is the concurrent playing of BEEP music with animation. We get by with such a mixture in this instance because the melody is the familiar, bouncy jingle called, SANTA CLAUSE IS COMING TO TOWN. It’s from the score shown in figure 1. This is a display type of program. Run it, look, and listen.

Here, for those interested in how it works, is an explanation. First off, BEEP music on the 2068, as the Manual presents it and is usually written, is awkward. Programs require many BEEP and/or DATA lines to store the values of duration and pitch. Duration usually has decimal values and pitch may have negative ones. Values such as this are a nuisance to enter because the keyshifting to get commas, decimal points, and negative signs is time consuming and error prone.

SANTA-C takes a different approach. It assigns duration to a sequence of lower case variables, using letters “a” to “j” where they have arbitrary values from .25 to 20. These values are, for the prime notes of the scale, a geometric progression and double in value . from one prime note to the next longer one. Some notes may have values that are mid-way to the prime ones. Lines 1010 and 5130 of the LISTing assign such values to the variables, so the quarter-note getsS a value of 4, the whole-note a value of 16, a thirty-second note a value of 0.5, etc. Rests, periods of silence, use these same values.

At this stage it is necessary only to establish their proper time relationship to each other so that a quarter-note has a duration of one-guarter of a whole-note. The tempo or playing speed of a song can then be varied simply by changing the denominator, here 48, that appears in the BEEP lines 1135, T2337: and 1335. Increasing the 48 increases the tempo.

SANTA-C uses the same pitch values that are given in the manual. But these can be negative if any note has ae pitch below middle C of the scale. When the melody has such a note, an arbitrary constant of 10 is added to all notes of the song to eliminate negatives. and then, in the BEEP line, a compensating 10 is deducted. Refer to and compare lines 1135, 1235, and 1335.

These two departures from the conventional allow us to use strings to store the duration and pitch values of a sequence of musical notes and rests. Every note that we are likely to encounter can be represented by just three characters, a lower case letter and 2 digits. Such strings can easily be sliced into pieces of 3 characters each in a FOR-NEXT loop. The first of these characters contains the duration value; the second and third contain the pitch value. These values are converted to numerical ones and adjusted if need be and then sent to a BEEP line that renders the proper tone.

Why use strings instead of DATA lines? For many applications on the 2068, strings are more concise and easy to manipulate. DATA lines always involve commas, and sometimes negative signs and decimal points. Workable, but confusing and tedious because of the key shifting

required. All of the music for the jingle this program produces is contained in the 3 strings of lines 1020 to 1040. DATA lines would require nearly five times’ the program space for the same information.

Normally the 2068 can do only one thing at a time, either BEEP or take some action. So BEEP music and animation do not readily mix. SANTA-C mixes the two however, and gets away with it because the tune selected is somewhat a bouncy strain that seems to blend with the prancing steps of the reindeer. The program is arranged so that it plays a note, does one part of the animation picture, plays the next note, does a second part of the picture, plays the next note, etc. (Ed. note: try adding sleigh bells. Try adding SOUND 0,34;1,0;2,26;3,0;4,12;5,0;6,0;7,0;8 16;9,16;10,16;12,8; 1

Products

 

Downloadable Media

Image Gallery

Source Code

Scroll to Top