
As Richard Forsen has noted (SYNC 2:34), a series of tones can be generated by a series of FOR-NEXT loops. However, we are not accustomed to hearing this pitch scale of tones, and the duration of the tones varies inversely with the pitch. The Robot Composer corrects these deficiencies in this pitch scale and generates rhythmic, melodic tunes.
The series of FOR-NEXT loops used to generate tones occupies lines 500 to 559. Each of these loops has a multiplier for N which corrects the tendency for low notes to be longer. The basic unit of duration, N, is set by line 100. Most of the remainder of the program is used to select the pitch, P, from the tone generator. Because some tones made by the generator are not notes in the familiar diatonic scale, lines 418 to 428 skip such tones. The FOR-NEXT loops corresponding to these skipped tones are spacers and are necessary for the generation of the remaining tones in the diatonic scale. Lines 402 and 405 bounce the pitch off the top and bottom of the scale if the limits of the scale are exceeded.
Lines 5, 10, and 490 set the length of the tune and the value of S, an additive variable for the pitch scale, P. The variable S first drops in value and then rises again towards the end of the tune. Because high values of P are associated with low notes, and vice versa, the pitch will initially rise and then fall.
Lines 20 and 150 set the length of melodic phrases within the tune and determine within phrases the pitch increment and variability of the pitch transition from one measure to the next. Lines 200 to 400 determine length and rhythmic composition of the measures, as well as the average pitch increment and variability from one note to the other.
In the program as presented, pitch tends to stay generally within the limits of the pitch scale; small changes can be made in the additive variables in lines 150 and 400, but if large changes are made, the pitch will constantly bounce off the scale limits causing the music to be less interesting. A rising pitch in measures may be produced by changing the -4 in line 150 to a -5, and a -3 will produce a pitch decrement between phrases. Substituting a -5 for -4 in line 400 will produce a rise in pitch within measures and -3 will produce a decrement. Of course, pitch increments in phrases can be combined with decrements in measures or vice versa.
Other functions can be substituted for line 10:
10 LET S=-1+(K-5)*(K-5)
produces a more rapid initial rise and more rapid decline than the original line 10. By subtracting these functions from a constant, they may be inverted. By changing K, G, and J, the length of tune, phrase, and measure can be changed. You will have to make corresponding changes to lines within the FOR-NEXT loops.
Rhythm may be changed by modifying lines 100, 200, and 205. For instance:
100 LET N=6
200 FOR J=1 TO 4
205 LET N=N-1
produces a happy rhythm. A drum roll sound will be produced at the end of each measure if the limit of J is greater than N. A wide variety of rhythms is possible using these two examples and changing the values in lines 100 and 205 and the limit in line 200.
To produce only a single tune, line 498 may be omitted.
If a piece of insulated wire is laid under the computer and attached to the antenna of an FM radio, the sound will be transmitted without static to the FM receiver. You can now play your music through a high quality music system.
Make changes cautiously, trying out the program between small changes; even renumbering seems to have an effect on tone quality, and introducing more complicated functions seems to make the sound unpleasantly “fuzzy.” If you attempt to lengthen the pitch scale, you will change the frequencies of all the notes; and you will no longer have a diatonic scale. A longer pitch scale is possible, but it is necessary to shorten the rest of the program to get it into 1K.
5 FOR K=1 TO 8
10 LET S=2*ABS(K-5)
17 LET P=S
20 FOR G=1 TO 4
100 LET N=2
150 LET P=P+RND(7)-4
200 FOR J=1 TO 4
205 LET N=N+1
400 LET P=P+RND(7)-4
402 IF P<1 THEN LET P=RND(7)
405 IF P>19 THEN LET P=5+RND(12)
418 IF P=3 THEN LET P=P+1
419 IF P=5 THEN LET P=P+1
420 IF P=6 THEN LET P=P+1
421 IF P=8 THEN LET P=P+1
422 IF P=9 THEN LET P=P+1
423 IF P=11 THEN LET P=P+1
424 IF P=13 THEN LET P=P+1
425 IF P=14 THEN LET P=P+1
426 IF P=16 THEN LET P=P+1
427 IF P=17 THEN LET P=P+1
428 IF P=18 THEN LET P=P+1
485 GOSUB 497+P*3
490 NEXT J
492 NEXT G
496 NEXT K
498 GOTO 5
500 FOR I=1 TO 13*N
501 NEXT I
502 RETURN
503 FOR I=1 TO 13*N
504 NEXT I
505 RETURN
506 FOR I=1 TO 12*N
507 NEXT I
508 RETURN
509 FOR I=1 TO 12*N
510 NEXT I
511 RETURN
512 FOR I=1 TO 11*N
513 NEXT I
514 RETURN
515 FOR I=1 TO 11*N
516 NEXT I
517 RETURN
518 FOR I=1 TO 10*N
519 NEXT I
520 RETURN
521 FOR I=1 TO 10*N
522 NEXT I
523 RETURN
524 FOR I=1 TO 9*N
525 NEXT I
526 RETURN
527 FOR I=1 TO 9*N
528 NEXT I
529 RETURN
530 FOR I=1 TO 8*N
531 NEXT I
532 RETURN
533 FOR I=1 TO 8*N
534 NEXT I
535 RETURN
536 FOR I=1 TO 8*N
537 NEXT I
538 RETURN
539 FOR I=1 TO 8*N
540 NEXT I
541 RETURN
542 FOR I=1 TO 8*N
543 NEXT I
544 RETURN
545 FOR I=1 TO 8*N
546 NEXT I
547 RETURN
548 FOR I=1 TO 8*N
549 NEXT I
550 RETURN
551 FOR I=1 TO 8*N
552 NEXT I
553 RETURN
554 FOR I=1 TO 7*N
555 NEXT I
556 RETURN
557 FOR I=1 TO 7*N
558 NEXT I
559 RETURN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.