The text books describe harmony as any combination of notes sounded simultaneously. For our purposes we will assume that this combination should produce agreeable sounds - it doesn't always!
The classical approach to and study of harmony is quite complex and beyond our scope. One of its main topics is counterpoint, which is when two or more melodic lines are played simultaneously. The canon or round is a form of counterpoint. An example is the song 'London's Burning', in which a number of voices sing exactly the same melody at staggered intervals throughout the piece.
Other examples of counterpoint include the invention and the fugue which were popular in classical music. J. S. Bach produced many brilliant examples of each. His most famous is probably his Toccata and Fugue in D minor, normally played on the organ and popularised, if that's the word, in horror films such as 'Phantom of the Opera'.
Although such studies are perhaps more relevant to modern day classical musicians and composers than to song writers and groups, many good arrangers and musicians have the ability to create interesting music with more than one melody fine. Many electronic music albums display such writing and it can also be found on some rock and progressive music albums.
The jazz musician turns harmonies and melodies upside down and the study of jazz harmony is a separate subject altogether.
Our main concern, at least in the initial stages of our musical experiments, is likely to be trying to decide what chord will fit a particular melody line and, having found the chord, how its harmony can best be brought out.
When we put a tune into our computer, we are likely to be faced with one of two situations. We may have a melody line and a list of chord symbols or we may have a full-blooded piano or organ score with lots of notes and secondary melody lines running through the piece. Each presents its own problems when we try to convert it for the computer.
With the first we wonder what to put in and with the second we wonder what to leave out. The best advice anyone can give is to do what sounds best; but of course we need a starting point
As we have mentioned in other chapters, it is often a good idea to have a bass line running through the piece. This not only provides a good harmonic foundation but, as the notes are low, it gives the piece a sense of fullness.
As we are working with chords it is easy to use the notes of the chord in the bass. The root note is the note which gives the chord its name. This will quite definitely establish the key of the chord. For variation we can alternate the root with the fifth which should preferably be lower than the root but this is not essential. If the chord sequence; was C, Amin, Fmaj6, G? and the music was in 4/4 time and we wanted two bass notes in each bar they might look like this:
(C2 G1) (A1 El) (F1 C1) (Gl D1)
We can go on to add the third and, from there, we could add 'passing notes' which smooth out the bass line by avoiding large interval jumps. This can result in a walking bass often found in swing music such as that played in slow foxtrot or quickstep tempo.
This example is based on the above chord sequence and has four bass notes in each bar:
(C2 Gl C2 B1) (A1 E1 A1 Gl) (F1 D1 E1 Fl) (G1 G1 A1 B1)
The bass does not have to include every note in the chord and you don 't need to have a bass note on every beat. If the distance between one note and another is small, the bass itself forms a sort of melody line. Movement from one note to an adjacent note is known as stepwise movement and can generally be recommended. In this chord sequence: F, A, Dmin, C, F, this sort of movement would sound effective:
C1 C#1 D1 E1 F
Rather than construct a bass line as a separate entity, we can use the two other channels to provide an accompaniment to the melody. This was the basic premise behind the musical arrangements in the programs in Chapter 9. If you look again at Figure 9.1, you will see how channel 3 and channel 2 combine to produce the accompaniment.
Channel 2 actually has two roles. In bar 1 for example, first it plays a bass note then it joins channel 3 to play a chord. The overall accompaniment is rhythmic and is typical of a piano arrangement. There is no attempt to produce a separate bass line or a secondary melody line.
The Dance of the Sugar-plum Fairy follows a similar pattern. Only at the end does the upper melody hold on to a note while a lower line plays a downward run. Note the introduction which uses all three channels before the first one leaves to play the melody.
The Liberty Bell arrangement is also similar, but you can hear lower notes moving in upward and downward patterns to complement the main melody. This is simple counterpoint although it does not run right through the piece and you can hear how it adds another level of interest to the music.
Assuming you have decided upon a melody and basslaccompaniment line you still have another channel to arrange. If you can double up with the bass channel, as channel 2 does in Rondo, you effectively gain an extra voice. Bearing in mind the beneficial effects of stepwise movement you can proceed to fill in the gaps between melody and bass.
It is not easy to give hard and fast rules about allocation of the in between notes. Generally, any note of the chord will suffice and, with only three voices, it is usually better not to duplicate the melody or bass note unless it is as part of a rhythm accompaniment. If you are torn between one note and another in a chord, see if the previous note can move to this note by stepwise movement. Other than that, try out the alternatives and let your ears be the judges.
It is sometimes more of a problem trying to decide what to leave out of an arrangement than it is to think of notes to put in. Many piano and organ arrangements have lots of stepwise movement in them, usually a good bass line and often a counter melody in places.
Again, we need a channel for the melody line. Allocation of notes to the other channels will depend upon the type of accompaniment required. If you can see two clear melody fines running through the piece, as would be evident in a fugue, etc, then obviously use these, and add the third channel either as a bass or in places between the melodies to reinforce the harmony. Which to choose should be apparent from the arrangement.
Pruning decisions must be made when a melody is supported by one or two other notes and when an accompaniment consists of a cluster of notes. In the former case, the best advice is usually to forget any supportive melody notes, concentrate on the melody itself and use the spare channel for the accompaniment.
A handful of notes m rue accompaniment section may not always have the root note of the chord in the bass. Simply using the lowest note illustrated is not always enough. If the lowest notes form a stepwise progression, however, you can usually use them and let the third voice play the chord root.
If the chord is not named on the music and there are so many notes involved that the actual chord is difficult to work out, as a guide try placing the third voice closer to the accompaniment than to the melody. Otherwise, if you can work out what the basic chord is, you can discover which notes are part of the chord and will support the harmony, which notes are passing notes and which notes may be contributing to a little counterpoint or secondary melody line.
With only three channels it is not always possible to produce complicated harmonies and, if in doubt, the best idea is to stick to a melody line with chord notes in the bass and the third channel. You can alter them afterwards if they need adjusting. Your ears are your best guide but, initially, if you follow these general guidelines you will produce reasonable results.
You can see from the above that harmonising a tune requires a little thought. It would be nice if we could enter a melody line and let the computer work out a harmonic accompaniment for us. There are keyboards on the market which do just that. If you play a single note melody line, the keyboard will add another line to harmonise with it. The harmonic additions are controlled by a chip, of course, a computer dedicated to just that task.
The next program is presented tongue-in-cheek and adds a pseudo-harmony to a melody line.
1 REM PROGRAM 12.1
2 REM Pseudo Harmony Additions
3 REM Insert In PROGRAM 9.1
4
300 PRINT Note$;TAB(6);Pitch;
310 SOUND1,Env,Pitch,Dur
311 PROCHarmonise
315 SOUND2,Env,Pitch-P,Dur
316 PRINTTAB(12);Pitch-P
420
430 DEF PROCHarmonise
440 HarmPoint=RND(12)
450 ON HarmPoint GOTO 460,470,470,470,
470,480,480,480,490,490,500,510
460 P=8:ENDPROC
470 P=12:ENDPROC
480 P=20:ENDPROC
490 P=28:ENDPROC
500 P=32:ENDPROC
510 P=48:ENDPROC
This adds a second 'melody' line to the single-channel version of Mozart's Rondo Alla Turca. You can see why I have called it pseudo-harmony by looking at PROCHarmonise at line 430. All it does is to add one of six different intervals to the melody fine. The result is, predictably, erratic.
We can reduce the random effect by restricting the intervals to, for example, thirds and fifths: we can take the randomness away altogether by playing a single interval, such as a third, throughout. We can do this by setting P equal to 12. The result sounds quite good but, as it lacks variation, it can soon become boring. Also, as the thirds are calculated on a semitone basis and not a scale basis, the result is a little mechanical and, at times, sounds out of key. For example, to add a third to the note E3 in this musical extract we should add C3. The program would add C#3.
The concept of a program which will harmonise any given melody line is intriguing, and although Program 12.1 harmonises on a purely random basis we can add rules to it as we did to Program 10.1. Harmonising a melody can be a creative act or it can be a mechanical process which gives us licence to produce something in between.
The construction of such a program would necessarily require a little knowledge of chords and harmony. So, rather than trying to delve too deeply into what is, perhaps, one of the most complex aspects of music, I will leave a few suggestions with which the more ambitious and musically knowledgeable programmer can experiment.
The addition of rules can be simplified in a number of ways. Restricting the melody to the key of C seems a reasonable first step and giving the computer a set of chords to work with could be the second. A list of chords might include C, C7, Dmin, Emin, F, Fmaj7, G, G7, and Amin. This could be expanded to include other chords slightly further harmonically removed from the key of C.
Rules could include using stepwise movement, either to move directly from one chord to another or as a bridge to span the notes in two different chords.
The Circle of Fifths could be used whenever possible, but further rules would have to govern movement around the Circle to avoid straying too far from the home key and to ensure that we ended up there at the end of the piece.
The application of some rules may require that the melody be scanned more than once so that the computer can make initial observations about the harmony of the piece before, for example, working out a stepwise fine. Commercial instruments do not have this opportunity.
We could even use Program 12.1 as a starting point and add a routine to ensure that intervals were adjusted to fit the key of the piece or the scale used by the chord in use at the time. This would produce far better results than the mathematical intervals computed by the original program, as the key of the piece would not be disturbed.
Finally, if you want another tune to perform harmony experiments upon, the next program has extracted the DATA statements necessary to play a single line version of The Liberty Bell. These are for insertion in Program 12.1.
This will enable you to compare your program with the original one in Program 9.6.
1 REM PROGRAM 12.2
2 REM DATA Statements For
3 REM Liberty Bell
4 REM For Use in PROGRAM 12.1
5
110 FOR N=1 TO 110
180 DATA C3,3
182 DATA A2,6,A2,3,A2,3,G#2,3,A2,3
184 DATA F3,6,C3,3,C3,6,A2,3
186 DATA A#2,6,A#2,3,A#2,6,C3,3
188 DATA D3,15,A#2,3
190 DATA G2,6,G2,3,G2,3,F#2,3,G2,3
192 DATA E3,6,D3,3,D3,6,A#2,3
194 DATA A2,6,A2,3,A2,6,A#2,3
196 DATA C3,15,C3,3
198 DATA A2,6,A2,3,A2,3,G#2,3,A2,3
200 DATA A3,6,F3,3,F3,6,C3,3
202 DATA B2,6,G3,3,G3,6,G3,3
204 DATA G3,15,F3,3
206 DATA E3,6,G3,3,G3,3,F#3,3,G3,3
208 DATA D3,6,G3,3,G3,3,F#3,3,G3,3
210 DATA C3,6,B2,3,C3,6,B2,3
212 DATA C3,9,C3,9
214 REM 2nd Part
216 DATA A2,3,G#2,3,A2,3,D3,6,C3,3
218 DATA A2,9,F2,9
220 DATA D2,9,G2,9
222 DATA F2,15,F2,3
224 DATA G2,3,A2,3,A#2,3,E3,6,D3,3
226 DATA C3,9,F3,9
228 DATA E3,9,D3,9
230 DATA C3,15,C3,3
232 DATA D3,6,D3,2,E3,1,D3,3,C#3,3,D3,
3
234 DATA E3,9,E3,9
236 DATA F3,6,F3,2,A3,1,G3,3,F3,3,G3,3
238 DATA A3,15,A3,2,A3,1
240 DATA G3,6,F3,3,D3,6,A#2,3
242 DATA A2,9,F2,9
244 DATA G2,9,E2,9
246 DATA F2,12
248
250
260
270
Transposition is an everyday occurrence in the music world, but it o-ften baffles new musicians. Like other musical disciplines, it requires a little study and thought but do not be put off by some of the more detailed discussions. Try the examples, run the program and refer back to the text when necessary.
Transposition is when a note or tune is played higher or lower than it is written. This normally results in a change of key, but if a tune is moved up or down a complete octave, although the key stays the same, this is still a transposition. You may have had to make such decisions in Chapter 9 when arranging tune data to play on the computer.
Referring to Figure 2.4, if the music shows a note written to correspond to, say, C4 on the keyboard, you may decide that you want the tune to be played lower. If you substitute C3 for the note, you are transposing it down an octave.
Most transpositions do not occur simply over a straight octave, but tend to move up or down within the octave. For example, playing E4 instead of C4 would be an upward transposition of two tones and a transposition from the key of C to the key of E. Although the two sets ofnotes maintain the same relationship to each other, eg Twelfth Street Rag is still recognisable as Twelfth Street Rag in whatever key it is played, the transposition is not quite so straightforward an operation to perform: we must take into account the difference in key signatures and any accidentals which occur.
Although the principle of transposition is easy to understand, the physical transfer on paper of notes from one key to another can cause many problems for the less experienced musician. As you gain musical experience and grow} better able to recognise the difference between intervals - which are the same in whatever key you are playing - then transposition will become more instinctive and less of a mathematical chore.
For convenience, we have included an instant transposer in most of our programs, namely the variable Key. It was originally introduced in Program 3.1. This can be increased or decreased to play the music in any key of our choice; the only restriction is that, if we try to lower the key too far, some of the pitch values produced may fall below 0. Note, this does not affect the original data in the computer, only the way the sound chip interprets it.
This demonstrates one of the many advantages of computers and digital information handling. As information is stored as a series of numbers it is easy to perform mathematical operations on the numbers to produce new values. This principle has been used in programs throughout this book, not least of all in the One Line Wonder Composer program of Chapter 11.
So, if the music is already in the computer, we can transpose it to any key simply by altering one variable but if we need a physical copy of the music there is little alternative other than to write it by hand. Even here, though, the computer can help us. Before describing how, let us see why music is transposed in the first place.
Tunes are transposed for three reasons. First of all, although throughout this book we have only used the treble and bass clefs, there are other clefs. These are normally only found in orchestral scores, and most modem band arrangements only use one other clef, the Alto or C clef. It looks a little like the figure '3' preceded by a thick fine and a thin line. The middle of the '3' falls on the centre line of the stave, which in this clef represents middle C.
Alternative clefs are used for instruments whose ranges do not fit comfortably into the treble and bass clefs. The alto clef is used primarily for the viola. Unless you are involved with orchestral scores - or play the viola - you are unlikely to meet those other clefs: but if you do, you'll know what they are.
Many instruments are known as transposing instruments because they sound in a different key to that in which the music is written. Examples are the E flat Alto Saxophone, the B flat Tenor Saxophone, the B flat Clarinet and the B flat Trumpet. These names tell us what key the instruments play in, but others such as the English horn, which sounds a fifth lower than the written music, give us no clues,
This is sometimes a difficult idea to grasp but again, unless you are involved with such instruments, you are unlikely to need to make use of such information. For the sake of completeness, however, here are two examples. Music for the E flat Alto Saxophone is written a. sixth higher than it sounds on the piano keyboard so the key signature is written a sixth higher than the concert key (ie the piano key) of the piece. Music in the key of F would be written in the key of D for the saxophone and an F note would be produced by writing a D note in this key. The B flat Trumpet is scored a tone higher so, if the piece was in the key of C, the trumpet's part would be written in the key of D.
These transpositions do not involve another clef. They are simply written in a different key and, when the instruments play them, they sound in the correct key- So, if you are writing a piece of music in a particular key and wish to include a part for a transposing instrument you will have to transpose its part to a different key.
These aspects of orchestral instruments are the first reason why music is transposed. The second reason involves altering a piece of music to fit a singer's vocal range. Quite often a piece of music in a certain key will be perfect for one singer but too high or low for another. This depends upon the vocal range of individual singers, which varies enormously from one to another. Professional singers, therefore, often need the services of a transposer who will write out a song accompaniment in the best key for their voice.
Incidentally, some less musical singers have been known to claim that they always sing in C or F or some other key. This, as I am sure you will realise, is nonsense as the range of a song depends not only upon the key but upon the highest and lowest notes of the melody.
The third reason for transposing a tune is simply because it sounds good. An upward key change of a semitone in a song gives the tune a special kind of lift and creates a musical excitement. Harmonically, a key change is often preceded by moving from the root chord to that of an augmented fifth and it sounds very effective. For example, to move from C to C# you would play the chords C, G#7, C#, The progression certainly gives the music a lift. The song 'Can't Smile Without You', popularised by Barry Manilow, contains three key changes which definitely add to its appeal.
Transposition is a purely mechanical act. To transpose from one key to another, simply count the difference in semitones and apply this offset to the original notes. For example, to transpose from the key of A to the key of F, count how many semitones from one note to the other - in this case four - and apply this offset to all other notes. In this way, D will become A# (Bb) and F will become C#, etc. You can use Figure 2.4 to help work this out.
Counting in semitones in this way automatically takes into account the accidentals, but we must know whether the notes are sharp, flat or natural before we begin. A C in the key of A is a C ,so we must make sure we count from that note. The key signature tells us whether a note is sharp or flat, but we must make the necessary adjustments ourselves for accidentals.
Given that transposition may be desirable if not always necessary, how can we use the computer to help us? First thoughts might lead us to believe that, if we could feed in the original notes, the computer could be made to print out the new notes. In practice, however, it would probably take longer to enter the notes than it would to do the necessary calculations. Probably more useful would be a note comparison table which fists the notes in the old key against the notes in the new key.
Thirteen keys are fisted in Figure 2.5 (although F# and Gb are enharmonics, they are written differently) which gives us 156 different permutations. We can use our BBC micro to display the original key and the new key along with the note positions and the note names, and use this as a help sheet to aid conversion.
Line 70 contains an FX call to disable the ESCAPE key. Do not remove the REM until your program is fully debugged.
10 REM PROGRAM 12.3
20 REM Transposition Program
30
40 ON ERROR GOTO 2270
50
60 *TV255,1
70 REM Disable ESCAPE key:*FX220,1
80
90 REM Switch on CAPS LOCK
100 *FX202,32
110
120 PROCSetUp
130
140 End=FALSE
150 MODE7
160 PROCMenu
170 IF End CLS:END
180
190 MODE4
200 PROCWindows
210 PROCDisplayScales
220 GOTO150
230 END
240
250 DEF PROCSetUp
260 TClef=844:LClef=628
270 TR$=CHR$130+"TRANSPOSITION PROGRAM
"
280
290 REM Treble Clef Characters
300 VDU23,229,32,32,32,160,64,0,0,0
310 VDU23,230,39,39,167,167,38,36,248,
240
320 VDU23,231,228,230,102,51,24,12,7,3
330 VDU23,232,160,32,32,32,120,164,38,
39
340 VDU23,233,1,3,12,24,48,97,227,230
350 VDU23,234,34,34,36,36,40,48,32,96
360 VDU23,235,35,35,35,35,35,35,35,35
370 VDU23,236,0,0,0,0,0,8,20,34
380 TC$=CHR$9+CHR$236+CHR$8+CHR$10+CHR
$235+CHR$8+CHR$10+CHR$234+CHR$8+CHR$8+CH
R$10+CHR$233+CHR$232+CHR$8+CHR$8+CHR$10+
CHR$231+CHR$230+CHR$8+CHR$10+CHR$229
390
400 REM Bass Clef Characters
410 VDU23,237,31,127,192,128,128,184,1
20,56
420 VDU23,238,128,192,224,115,51,48,48
,48
430 VDU23,239,48,51,51,48,48,32,64,128
440 VDU23,240,1,2,4,8,16,32,0,0
450 BC$=CHR$237+CHR$238+CHR$8+CHR$10+C
HR$239+CHR$8+CHR$8+CHR$10+CHR$240
460
470 REM Semibrieve
480 VDU23,224,0,28,34,66,68,56,0,0
490
500 REM Crotchet
510 VDU23,225,0,28,62,126,124,56,0,0
520
530 REM Natural
540 VDU23,226,64,76,84,100,76,84,100,4
550
560 REM Flat
570 VDU23,227,64,64,92,102,70,76,120,0
580 F$=CHR$227
590
600 REM Sharp
610 VDU23,238,36,36,126,36,36,126,36,3
6
620 S$="#":REM S$=CHR$228
630
640 REM Offset for Lower Scale Notes
650 DIM OffSetArray(12,12)
660 RESTORE 840
670 FOR TScale%=0 TO 12
680 FOR LScale%=0 TO 12
690 READ OffSetArray%(TScale%,LScale%)
700 NEXT LScale%
710 NEXT TScale%
720
730 DIM KeyArray$(12),MinKeyArray$(12)
740 RESTORE 980
750 FOR A=0 TO 12
760 READ K$:IF A>7 K$=K$+CHR$227
770 READ M$:IF A>10 M$=M$+CHR$227
780 KeyArray$(A)=K$
790 MinKeyArray$(A)=M$
800 NEXT A
810
820 ENDPROC
830
840 DATA 0,3,-1,2,-2,1,-3,-3,1,-2,2,-1
,3
850 DATA -3,0,3,-1,2,-2,1,1,-2,2,-1,3,
0
860 DATA 1,-3,0,3,-1,2,-2,-2,2,-1,3,0,
-3
870 DATA -2,1,-3,0,3,-1,2,2,-1,3,0,-3,
1
880 DATA 2,-2,1,-3,0,3,-1,-1,3,0,-3,1,
-2
890 DATA -1,2,-2,1,-3,0,3,3,0,-3,1,-2,
2
900 DATA 3,-1,2,-2,1,-3,0,0,-3,1,-2,2,
-1
910 DATA 3,-1,2,-2,1,-3,0,0,-3,1,-2,2,
-1
920 DATA -1,2,-2,1,-3,0,3,3,0,-3,1,-2,
2
930 DATA 2,-2,1,-3,0,3,-1,-1,3,0,-3,1,
-2
940 DATA -2,1,-3,0,3,-1,2,2,-1,3,0,-3,
1
950 DATA 1,-3,0,3,-1,2,-2,-2,2,-1,3,0,
-3
960 DATA -3,0,3,-1,2,-2,1,1,-2,2,-1,3,
0
970
980 DATA C,A,G,E,D,B,A,F#,E,C#,B,G#,F#
,D#,F,D,B,G,E,C,A,F,D,B,G,E
990
1000 DEF PROCMenu:CLS:PROCdd(TR$,8,0)
1010 PRINTTAB(3,3)CHR$131"Here are your
options:"
1020 PRINT'CHR$129" 1.."CHR$130"Trebl
e Clef."'CHR$129" 2.."CHR$130"Bass Cle
f."'CHR$129" 3.."CHR$130"End Program."
1030 PRINT'CHR$131" Please enter your
choice ("CHR$129"1-3"CHR$131")?"CHR$129
;
1040 PROCInput(48,52)
1050 IF Key%=49 Clf%=1:NOSet=-36
1060 IF Key%=50 Clf%=2:NOSet=-12
1070 IF Key%=51 End=TRUE:ENDPROC
1080
1090 PROCGetSF("original"):OAc%=Key%-48
:Okey$=LEFT$(Ac$,1):IF Okey$="F" OAc%=OA
c%+6
1100 PROCGetSF("new"):NAc%=Key%-48:Nkey
$=LEFT$(Ac$,1):IF Nkey$="F" NAc%=NAc%+6
1110
1120 OffSet%=OffSetArray%(OAc%,NAc%)*12
1130
1140 PRINT'TAB(12)CHR$136CHR$131"THANK
YOU":PROCD(200)
1150 ENDPROC
1160
1170 REM Double Height Letters
1180 DEF PROCdd(P$,a%,b%):FOR L%=0 TO 1
:PRINTTAB(a%,b%+L%)CHR$141;P$:NEXT:ENDPR
OC
1190
1200 DEF PROCInput(Min%,Max%):REPEAT:Ke
y%=GET:UNTIL Key%>Min% AND Key%
1210
1220 DEF PROCGetSF(Key$)
1230 PRINT'CHR$131" Has the "Key$" ke
y any sharps"'CHR$131" or flats ("CHR$
129"S, F or N"CHR$131")?"CHR$129;
1240 REPEAT:Ans=GET:UNTIL (Ans=83 OR An
s=70 OR Ans=78):PRINTCHR$Ans:IF Ans=83 A
c$="Sharps" ELSE IF Ans=70 Ac$="Flats" E
LSEAc$="N"
1250 IF Ans=78 Key%=48:ENDPROC
1260
1270 PRINT'CHR$131"How many ";Ac$;" has
it? ("CHR$129"1-6"CHR$131")?"CHR$129;:P
OCInput(48,55)
1280 ENDPROC
1290
1300 DEF PROCWindows
1310 REM Set Graphics Window
1320 VDU24,0;256;1279;1023;
1330
1340 REM Background Yellow
1350 VDU19,129,131,0,0,0
1360 GCOL0,129:CLG
1370
1380 REM Foreground Black
1390 GCOL0,0
1400
1410 REM Set Text Window
1420 VDU28,030,39,24
1430 ENDPROC
1440
1450 DEF PROCDisplayScales
1460 PROCStave
1470 Hinote%=904:Lonote%=712
1480
1490 Scal=1
1500 PROCScale(Hinote%)
1510 Hinote%=Hinote%-216-OffSet%:Lonote
%=Lonote%-216-OffSet%
1520
1530 Scal=2:NOSet=NOSet+48
1540 PROCScale(Lonote%-64)
1550
1560 *FX15,1
1570 PRINT''"Press ""RETURN"" to return
to Menu. ";:PROCInput(12,14)
1580 ENDPROC
1590
1600 REM Draw Staves
1610 DEF PROCStave
1620 PROCS(TClef):PROCS(LClef)
1630 IF Clf%=1 PROCClef(TC$,TClef+62):P
ROCClef(TC$,LClef+62) ELSE PROCClef(BC$,
TClef):PROCClef(BC$,LClef)
1640
1650 PROCKeySig(Okey$,OAc%,TClef+14)
1660 PROCGetKey(OAc%,TClef+160)
1670 PROCKeySig(Nkey$,NAc%,LClef+16)
1680 PROCGetKey(NAc%,LClef-256)
1690
1700 ENDPROC
1710
1720 REM Draw the Lines
1730 REM Distance between a line and
1740 REM space = 12
1750 DEF PROCS(L%):FOR Line%=L% TO L%-9
6 STEP-24:MOVE0,Line%:DRAW1280,Line%:NEX
T:ENDPROC
1760
1770 REM Print Clef(s)
1780 DEF PROCClef(C$,Pos%):VDU5:MOVE24,
Pos%:PRINTC$:VDU4:ENDPROC
1790
1800 DEF PROCD(Delay%):DL=TIME:REPEATUN
TILTIME>DL+Delay%:ENDPROC
1810
1820 REM Print Notes of Scale
1830 DEF PROCScale(Pos%)
1840 X%=240
1850 Dif%=48
1860
1870 FOR Y%=Lonote% TO Hinote% STEP12:X
%=X%+Dif%:PROCNote("S"):N%=((Y%+NOSet)/1
2)MOD7 +65:VDU5:MOVEX%,Pos%+32:PRINTCHR$
N%:VDU4:NEXT
1880 ENDPROC
1890
1900 DEF PROCNote(n$):VDU5
1910 IF n$="S" n$=CHR$224
1920 IF n$="C" n$=CHR$225
1930 MOVEX%,Y%:PRINTn$
1940
1950 IF Y%>=TClef+36 PROCLeg(TClef+36,2
4)
1960 IF Y%<=LClef-108 PROCLeg(LClef-108
,-24)
1970 IF Scal=1:IF Y%<=TClef-108 PROCLeg
(TClef-108,-24)
1980 IF Scal=2:IF Y%>=LClef-36 PROCLeg(
LClef-36,24)
1990
2000 ENDPROC
2010
2020 DEF PROCLeg(H%,Step%):FOR Le%=H% T
O Y% STEP Step%:MOVEX%,Le%-12:DRAWX%+28,
Le%-12:NEXT:ENDPROC
2030
2040 DEF PROCKeySig(SF$,Sig%,Y%)
2050 IF SF$="S" n$=S$:Y%=Y%-2:RESTORE 2
230 ELSE IF SF$="F" n$=F$:Sig%=Sig%-6:Y%
=Y%-46:RESTORE 2240 ELSE ENDPROC
2060
2070 IF Clf%=2 Y%=Y%-24
2080 X%=96
2090 VDU5
2100 FOR a%=1 TO Sig%
2110 READ y%:MOVEX%,Y%+y%:PRINTn$
2120 X%=X%+24
2130 NEXT a%
2140 VDU4
2150 ENDPROC
2160
2170 DEF PROCGetKey(No,Pos)
2180 MajKey$=KeyArray$(No)
2190 MinKey$=MinKeyArray(No)+" Minor"
2200 VDU5:MOVE32,Pos:PRINT"Key=";MajKey
$;" Relative Minor=";MinKey$:VDU4
2210 ENDPROC
2220
2230 DATA 0,-36,12,-24,-60,-12
2240 DATA 0,36,-12,24,-24,12
2250
2260 REM ERROR Routine
2270 REPORT:PRINTERR;" at line ";ERL
The program will ask if you want to use the treble or bass clef and then will ask for information about the original and new keys. It will print two staves, the clefs, the key signatures, the notes as they appear on the stave, and the note names. The notes are offset so that you can read down from the original key to find the note name and the position on the stave of the note in the new key.
From Program 12.3
The program accepts single-key responses in upper case. Line 100 ensures the CAPS LOCK is on.
The transpositions produced by the program are made in the direction which involves the least movement, eg if you enter F (one flat) as the original key and D (two sharps) as the new key the program will transpose down a third not up a sixth. If you are transposing for a singer or taking a song up a tone or semitone for a melodic keychange, this will be the most useful arrangement.
1120 Offset%= OffSetArray%(OAc%,NAc%)
This reverses the effect of OffSet% so -3 becomes -4, -2 becomes +5, etc. If you try this with a transposition which moves the scale too low, eg from A to Bb, you will overwrite the note names on the screen and will have to make adjustments to PROCNote to avoid it. This will only happen in extreme cases.
If the original key has no accidentals, the program will indicate the new notes exactly. Accidentals sometimes cause concern for the beginner. A set of rules to cover every eventuality would serve only to confuse, but I will see if I can pass on a hint or two to make it easier.
Chord names are easily converted because the chord type stays the same. If you run the program and input the two keys all you need to do is check the note names against each other. For example, in transposing from F# to Db, an chord prefixed with a G# becomes an Eb, C# becomes an Ab, etc. In these cases, you need to look at the key signature to see if the note referred to is a sharp, a natural or a flat. Then look at the lower stave and check the note against the key signature there.
You may prefer to input the keys directly rather than as a number of sharps or flats. The program was designed to require input of a minimum of information. Reference to Figure 2.5 should clear up any confusion about key signatures.
Program notes
PROCSetUp at line 250 sets the relative positions of the top clef and the lower clef in line 270.
The next 350 lines create a set of user-definable characters for the clef signs and the notes. Although the notes are printed as semibreves, fine 510 defines a crotchet should you wish to use it, and line 540 defines a natural sign which you may find useful, although it is not used in the program. Line 610 defines a sharp sign but 620 selects the hash (#) for use as a sharp. Because of the small space between the two horizontal lines of the sharp sign, you will find this gap almost filled when it sits on a line and the hash seems to give better results even though it is heavier
OffsetArray% at line 650 holds the necessary information to offset the notes of the new scale against the old ones. The offset values are read from the DATA statements at line 840. The figures represent how many notes up or down we need to move to get from the old key name to the new key name. For example, cross-indexing D (two sharps) with F (one flat) will result in +2, meaning that we must move up two notes from D. Try this on Figure 2.4.
You will notice a pattern in the data which confirms some sort of mathematical relationship between the keys, although it is not easy to see exactly what the relationship is or to put it into a formula (there's a challenge - but no prizes). Lines 850 to 900 are the same as 960 to 910 (reading backwards).
The array cross-indexes each possible key against every other. The 0 subscripts represent no sharps or flats, ie the key of C. The subscripts l to 6 are the sharps and 7 to 12 are the flats.
The arrays, KeyArray$ and MinKey Array$, store the key names and their relative minor keys respectively.
Line 160 takes us to PROCMenu at line 1000. This prints the instructions then moves to PROCInput at line 1200. This runs through a REPEAT loop until a key is pressed within the range set by the calling parameters, in this case ASCII values greater than 48 and less than 52, which are the keys I, 2 and 3. Once a valid input is received, Clf% is set to indicate which clef is required, and NOSet is used to offset the notes depending upon whether the required clef is treble or bass.
PROCGetSF is then called at line 1220 to find out if the keys have any sharps or flats. It is called twice, once for the original key and once for the new key. If you indicate that there are no sharps or flats by pressing 'N' the procedure will exit at line 1250, otherwise Ac$ will have been filled with 'sharps' or 'flats' and will go on to ask how many there are.
Back at lines 1090 and 1100, OAc% and NAc% are set to register the number of sharps or flats in the key and, if flats are involved, 6 is added.
This enables the correct offset to be found in OffsetArray% at line 1130. Remember, fiats are accessed in OffsetArray% with subscript values of 7 to 12. The offset figure is multiplied by 12 so that it can be used directly when printing the new scale. See the REMs at lines 1730 and 1740.
From there, it's back to line 190, mode 4 and PROCWindows at line 1300. This is self-explanatory and you can refer to the User Guide for further information if necessary.
The last part of the main program is line 210 which calls PROCDisplaySca1es at line 1450. Its first job is to call PROCStave at line 1610. This prints the staves, the clefs and the key signatures.
PROCS at line 1750 is called twice with the top and lower stave positions which were allocated in line 260. This draws the five line staves.
PROCClef at fine 1780 draws the required clefs in their relevant positions.
PROCKeySig at line 2040 is called by lines 1650 and 1670 to print the key signatures. It uses information gained from Ac$ and passed to Okey$ and Nkey$ during PROCMenu to determine if the key contains sharps or flats. If so, positional adjustments are made to Y%, the vertical axis, to ensure that they are positioned correctly. The procedure is called with the number of sharps or flats in OAc'% or NAc% and a loop with this value is used to print the correct number. As sharps and flats are not placed on the stave in the same positions, the necessary offsets are held in DATA statements in lines 2230 and 2240 and RESTOREd according to the key being printed.
As we have not yet told the computer what keys are involved, other than by the number of sharps or flats in the key signature, this information is obtained from PROCGetKey at line 2170, which prints it on the screen beside the relevant scale.
Having drawn the staves, it's back to PROCDisplayScales to draw the notes. PROCSca1e does this at fine 1830. It is called with a value which tells it where to print the note names. Hinote% and Lonote% are set at line 1470 and these values are used as top and bottom limits on the notes being printed.
X% at line 1840 is the initial print position measured across the horizontal axis and Dif% is the difference between the notes.
PROCNote at fine 1900 is called with an 'S' for semibreve or a 'C' for crotchet, to determine which note to print. It is set to print semibreves but you can alter it. Having printed the note, fines 1950 to 1980 check to see if leger fines are required, and call PROCLeg at line 2020 if they are. There are four areas where leger lines will occur: above the top stave, below the top stave, above the lower stave and below the lower stave. Each is checked individually. The variable, Seal, is set at lines 1490 and 1530 and used in lines 1970 and 1980 to indicate if it is the top or lower scale being drawn.
PROCLeg is called with a position across the horizontal axis and a step value. This will be negative if the notes are below the stave. The lines are drawn and control passes back to PROCNote and back to PROCScale - the middle of fine 1870 to be exact - where N% is calculated.
N% is the ASCII code of the note name just printed and is calculated from the note offset variable, NOSet, given in line 1050 or 1060, and Y%, which is its vertical position on the stave.
Back to PROCDisplayScales and line 1510. Having printed the original scale, Offset% is used to adjust the values of Hinote% and Lonote%. NOSet is adjusted for the lower stave and the scale drawing procedure is repeated.
Line 1560 flushes the buffer so we don't accidentally fly back to the menu until we want to.
Using the program
If you want or need to transpose in the opposite direction to the program, the variables held in OffSetArray% will have to be altered. This is easily done by removing '*12' from the end of line 1120 and adding another line:
1125 OffSet%=(OffSet%-7*SGN(OffSet%))*12
Because the offset is calculated from key names (ie letters), keys with the same letter in their name will not move, eg F and F# ,B and Bb, etc Effectively, in such instances all we need do is to replace the key signature (and alter accidentals) as the notes remain where they are on the stave. A transposition from A to Bb, however, although a similar transposition (ie up a semitone), will move because the note names do change.
If, for some reason, you wish to transpose between these non-moving keys in the opposite direction, eg from F downwards to F# or B upwards to Bb etc, you are really only moving the notes up or down an octave. This can be done by setting Offset% to plus or minus 7. If you seriously require such an exotic transposition, you are probably capable of doing it without the aid of a computer but, in any case, I will leave you to add the necessary modifications.
It would be easy to add another menu option to give you the choice of transposing up or down.
Accidentals
Normal sharps and flats are accounted for by the key signature, eg in the key of A with three sharps, a C note would be written just as it would in the key of C (or any other key): the fact that we play a C announced by the sharp sign in the key signature.
Sometimes you may see a note which has been sharpened or flattened by the key signature, with a sharp or flat in front of it for no apparent reason. This is sometimes done if the previous bar altered the note, or if a note of the same name but in a different octave in that bar has an accidental before it. Theoretically, such a sharp or flat is not necessary because, from our discussions in Chapter 2, we know that an accidental only applies to the bar in which it occurs and to the note on the line or space on which it occurs. Such sharps or flats are meant simply as reminders and are usually (but not always) enclosed in brackets to show this.
The best advice anyone can give to a relative newcomer to transposition is this - if in doubt, count as described earlier, using Figure 2.4 to pick out the notes.
Problems can arise because, if we sharpen or flatten some notes, we may get results like E# or Fb. For example, in transposing from C to A a G# would appear as an E#. While not technically wrong, it would generally be written as an F natural.
If the note in question was Ab (enharmonically equivalent to G#) it would transpose as F# flat, which is a bit of a contradiction to say the least. You may be able to work out, however, that if we flatten a sharpened note it becomes a natural.
I find that the easiest way to approach accidentals is to see what the accidental is doing to the note. We already know what sharps and flats do. A natural will raise a note if the key contains flats or if the note has previously been flattened, and lower it if the key contains sharps or the note has previously been sharpened. Once we know if the accidental is raising or lowering the note we can do the same thing to our new note. In the last example we know the flat was lowering the note so lowering F $ will result in F natural. Keep in mind the key signature and apply the accidental operation to the true note rather than just the note name.
Like everything else, a little practice helps a lot.
Transposing chords
As with accidentals, sometimes a little musical commonsense needs to be applied but in the case of chords we can lay down some rules. You will never see an E#, a B# , an F$ or an A$ chord. (A# is a legitimate note name and we use A# purely for the convenience of the programs. Any chord with this note as its root would be called Bb. You might see a Cb chord, which is the same as a B chord, but this only usually occurs if the key signature contains a lot of flats. Generally, if you have a choice between two chord names, one a sharp and one a flat, use whichever appears in the key signature.
The chord examples listed in Figure 2.11 are all in the key of C. If you are not too familiar with chord construction, you can use the program to help convert them to other keys.
Modifying the program
Continually referring to the screen during a transposition can be a little inconvenient and, until you gain some experience, you will find that you have to check the display constantly. You may find it more useful to have a hard copy of the display and, if you have a dot matrix printer, you could add a screen dump routine.
You could add an option to change the display from treble to bass clef and vice versa, without having to go back through the menu to repeat the same input information.
If you are doing transpositions for a singer, it will do no harm to remind them that musicians have to play the arrangements: avoid awkward keys if possible. That means keys with a lot of sharps or flats.
As a general rule, most keyboard players prefer flats and most guitarists prefer sharps - but that should not be your overriding concern. Although good musicians should be able to play in any key, good musicians may not always be available so it is often in the singer's best interests to keep it simple.