Given several ground melodies, and several other melodies (fillers), the program adds the fillers, suitably transposed, to the ground. The ground may consist of independent musical lines, each containing chords, e.g. :
One musical line, which must be present, is defined as ground; the others, if any, as underground.
- Ground, undergrounds and fillers may contain chords.
- The resulting counterpoint is optimized for harmony – in the usual sense, thirds consonant, sevenths dissonant, etc.
- It is possible to have as ground just a long rest ; then the fillers are contrapunctally combined with each other.
The instruction:
will produce a score named scorename and the corresponding midi file scorename.mid. The score name is generated from filein , which is an input file containing the ground and the fillers.perl drug.pl file_filein rand_345 five_7 pass_1/8 fixAll the parameters except the first are optional. Their interpretation is as follows:
- file_filein
- Must appear; filein is the name of the file to be processed by tondur.
- rand_seed
- The number seed is used to initialize the random numbers generator.
- five_manynotes
- manynotes is too many notes for one chord. manynotes is between 5 and 8, inclussive; 5 is reasonable, as the standard harmony is in four voices. However, specifying higher values 6,7 or 8, makes the program add more fillers, resulting in richer counterpoint.
- fix
- fix dissonances, if possible, using trills.
- pass_fraction
- If the duration of the dissonant chord is less than fraction, it will be considered as consisting of passing notes, and will not change, even if fix dissonances is required.
The driver executes, via
systemfromperl:The identifierperl chordug.pl @ARGV > a$ID
perl shazar.pl @ARGV > b$ID
midi $ID$IDis based on filein and the random seed . The outputs name scorename is$ID.
Programs
chordug
Reads chords, and writes several output files. These files contain notes (as midi numbers) and durations as fractions, plus comments in braces.The input contains a score in my notation, somewhat simplified. Besides chords, tones and durations it may have key instructions, tra instructions, and names instructions . There are also comments in braces, but the comments must fit on one line and the braces don't nest. Some comments are meaningful, e.g. the first one shows that the music following is the ground.
names drm means I use the DO-RE-MI notation for pitches: do,re,mi,fa,so,la,ti = D,R,M,F,S,L,T stand for C,D,E,F,G,A,B.
key 1# means exactly what it says, the scale of G major or E minor.The output files are gr-identifier, ug-identifier or fil-identifier, one ground and several undergrounds and fillers.{ground} key 1# names drm {meas 3/4 3x4} d6 /4 i L s f s . .
filein ug-waltz gr1 fil2 fil3 {ground} key 1# names drm {meas 3/4 3x4} d6 /4 i L s f s L/2 L/4 s f s L/2 L/4 s f s L/2 L/4 s f s {filer} {on 1/4} s/4 s s ib 3/16 L/16 L 3/16 s/16 {underground waltz} d4 /4 s4,i s4,i d4 s4,i s,i d4 m m d4,s 3/4 {filer} key 3b {on 1/4} p/8 s s s m/2{ground} {meas 3/4 3x4} 72 1/4 71 1/4 69 1/4 67 1/4 66 1/4 67 1/4 69 1/2 69 1/4 67 1/4 66 1/4 67 1/4 69 1/2 69 1/4 67 1/4 66 1/4 67 1/4 69 1/2 69 1/4 67 1/4 66 1/4 67 1/4{underground waltz} 48 1/4 55 59 1/4 55 59 1/4 48 1/4 55 59 1/4 55 59 1/4 48 1/4 52 1/4 52 1/4 48 43 3/4{filer} {on 1/4} 67 1/4 67 1/4 67 1/4 70 3/16 69 1/16 69 3/16 67 1/16{filer} {on 1/4} -1 1/8 43 1/8 43 1/8 43 1/8 39 1/2
shazar.pl
- Reads the gr... , ug... and fil... files prepared by chordug, and adds fillers over the ground, transposed for optimized harmony.
- The harmony is standard, as specified in the file
hardefaul.txt- makes a table, with 9 voices; each column is a shortie, e.g.
A shortie is a small duration which fits evenly in all the notes durations in the piece; in this example, a measure is 3/4 and the shortie is 1/16. The numbers are midi representations of pitches, e.g. 69 is A above middle C. The z marks continuation notes — see the first line of measure 2.![]()
- If required ( fix specified among the parameters), replaces harsh dissonances by trills.
- Prepares a piano score from the table.