&dA &dA &d@ 9. Object type = grace note &dA &dA &d@ jcode = note type &dA &dA &d@ Note type code &dA &d@ ÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄ &dA &d@ breve 10 &dA &d@ whole 9 &dA &d@ half 8 &dA &d@ quarter 7 &dA &d@ eighth 6 &dA &d@ sixteenth 5 &dA &d@ thirty-second 4 &dA &d@ sixty-fourth 3 &dA &d@ 128th 2 &dA &d@ 256th 1 &dA &dA &d@ jvert = vertical position of note on staff line &dA &dA &d@ For objects which are groups of notes (chords), the &dA &d@ y co-ordinate is the position of the note which is &dA &d@ farthest from the note-end of the stem (and hence &dA &d@ closest to a beam, if there be one). This is impor &dA &d@ tant for the proper setting of beams at print time. &dA &d@ But in SCORE, the "controlling" note head is the &dA &d@ one &dAat&d@ the note-end of the stem! &dA &d@ &dA &d@ &dA &d@ P1 = 1.0 &dA &d@ P2 = staff number &dA &d@ P3 = horizontal position &dA &d@ P4 = vertical position middle C (treble) = 1; higher notes increase number &dA &d@ +100 for grace notes &dA &d@ P5 = stem direction, accidentals, accidental displacement &dA &d@ 10 = stem up &dA &d@ 20 = stem down accidental displacement &dA &d@ 0 = no ax .25 = one place &dA &d@ 1 = flat .50 = two places &dA &d@ 2 = sharp .75 = three places &dA &d@ 3 = natural &dA &d@ 4 = flat-flat &dA &d@ 5 = double sharp &dA &d@ P6 = type of note head &dA &d@ 0 = solid &dA &d@ 1 = half &dA &d@ 2 = whole &dA &d@ 3 = breve &dA &d@ P7 = rhythmic duration 65.0000 for lowest note of chord &dA &d@ 64.0000 for other notes in chord &dA &d@ P8 = stem length &dA &d@ 1.0 = 5 scale steps &dA &d@ +5.0 = makes stem 3 scale steps longer &dA &d@ +1.67= makes stem 1 scale step longer &dA &d@ add 100 to parameter to put a slash on a flag for grace notes &dA &d@ P9 = number of augmentation dots and flags connected to note &dA &d@ 10 = single dot &dA &d@ 20 = double dot +100 lowers a dot &dA &d@ 30 = triple dot +.1,.2 moves dot to the right &dA &d@ +1000 moves dot a full notehead width to the right &dA &d@ &dA &d@ If a dot must appear two spaces below the line, it must &dA &d@ be created as a Code 9 item and positioned separately &dA &d@ &dA &d@ 1 = one flag &dA &d@ 2 = two flags &dA &d@ 3 = three flags &dA &d@ 4 = four flags &dA &d@ &dA &d@ P10 = placement of note heads &dA &d@ 0 = normal position &dA &d@ 10 = place one note head to the right &dA &d@ 20 = place one note head to the left &dA &d@ 3 = place three "units" to the right &dA &d@ -4 = place four "units" to the left &dA &d@ &dA &d@ P11 = articulations or marks attached to note head &dA &d@ 4 = wedge ^ &dA &d@ 5 = accent > &dA &d@ 6 = tenuto - &dA &d@ 7 = staccato . . &dA &d@ 10 = tenuto-staccato - &dA &d@ 11 = down bow &dA &d@ 12 = up bow &dA &d@ 13 = harmonic &dA &d@ 14 = fermata &dA &d@ 17 = mordant &dA &d@ 18 = shake w &dA &d@ 19 = heavy wedge &dA &d@ 20 = trill tr &dA &d@ 30 = fingering 0 &dA &d@ 31 = fingering 1 &dA &d@ 32 = fingering 2 &dA &d@ 33 = fingering 3 &dA &d@ 34 = fingering 4 &dA &d@ 35 = fingering 5 &dA &d@ use negative value to force mark to stem &dA &d@ &dA &d@ P12 = place note on neighboring staff &dA &d@ 1 = place note on staff above &dA &d@ 0 = place note on current staff &dA &d@ 2 = place note on staff below &dA &d@ &dA &d@ P13 = displace marks horizontally &dA &d@ 1 = one "unit" to the right &dA &d@ 2 = two "units" to the right &dA &d@ -2 = tow "units" to the left &dA &d@ &dA &d@ P14 = displace marks vertically &dA &d@ 2 = raise mark two "units" &dA &d@ -2 = lower mark two "units" &dA &d@ &dA &d@ P15 = size of notes (don't use) &dA &d@ &dA &d@ P16 = thickness of ledger lines (don't use) &dA &d@ &dA &d@ JTYPE(9): dotcnt = 0 &dA &dA &d@ I. Determine staff number and adjust vertical position &dA p2 = actloc(lcnt) e = rnlines - p2 + 1 /* invert staff number p22 = flt(e) /* P2 if jvert > 800 ++p2 /* used only as a flag here! jvert -= 1000 /* for notes, staff is shifted using P12 end y = flt(node_horz + sysx - 200) if y < 0.0 y = 0.0 end p23 = y / 2050.0 * 200.0 /* P3 &dA &dA &d@ II. Determine note duration &dA p27 = 65.0000 &dA &dA &d@ IV. Get all of the sub-objects (if any) &dA if jpcode > 32 &dA &dA &d@ No sub-objects: P1 = 1 &dA &d@ P2 = staff num &dA &d@ P3 = node_horz &dA &d@ P4 = vert pos &dA &d@ P5 = 0 (no stem, no ax) &dA &d@ P6 = based on jcode &dA &d@ P7 = " " " (and tuple super-object) &dA &d@ P8 = 0 &dA &d@ P9 = 0 &dA &d@ P10 = jhorz - node_horz &dA &d@ P11 etc. = 0 &dA p4 = 77 - jvert p4 += 100 /* grace notes p24 = flt(p4) / 7.0 p25 = 0.0 if jcode < 8 p6 = 0 else p6 = jcode - 7 end p26 = flt(p6) p28 = 0.0 p29 = 0.0 p10 = jhorz - node_horz if abs(p10) = note_width if p10 < 0 p30 = 20.0 else p30 = 10.0 end else p30 = flt(p10) / 7.0 end putf [2] .f1w6 1. ~p22 .f2 ~p23 ~p24 ~p25 ~p26 ~p27 ~p28 ~p29 ~p30 putc .f1w6 1. ~p22 .f2 ~p23 ~p24 ~p25 ~p26 ~p27 ~p28 ~p29 ~p30 ++tpnt goto EL1 else loop for subjcnt = 1 to 200 ++tpnt tget [X,tpnt] rec if rec{1} = "K" subjx(subjcnt) = int(rec{2..}) subjy(subjcnt) = int(rec{sub+1..}) subjc(subjcnt) = int(rec{sub+1..}) end repeat while rec{1} = "K" --subjcnt end &dA &dA &d@ Determine the number of note heads on this stem and their y position &dA &dA &d@ Structure of array &dAheaddata&d@ &dA &dA &d@ * headdata(., 1) = y position &dA &d@ * headdata(., 2) = new y position (relative to staff) &dA &d@ * headdata(., 3) = x offset from Leland's P3 (times 10) &dA &d@ * headdata(., 4) = stem direction (0 = up, 1 = down, 100 = no stem) &dA &d@ * headdata(., 5) = accidental attached to head (0 to 5) &dA &d@ * headdata(., 6) = left shift of accidental from note head (0 to 3) &dA &d@ * headdata(., 7) = type of note head (0 to 3) &dA &d@ * headdata(., 8) = length of stem (for note end of chord; including beams) (times 10) &dA &d@ * headdata(., 9) = number of dots &dA &d@ * headdata(.,10) = vertical shift of dots &dA &d@ * headdata(.,11) = horizontal shift of dots &dA &d@ * headdata(.,12) = Leland's P9 times 10 (for dots and stems) &dA &d@ * headdata(.,13) = Leland's P11 &dA &d@ * headdata(.,14) = Leland's P12 &dA &dA headcnt = 0 loop for i = 1 to subjcnt if chr(subjc(i)) in [169..171] ++headcnt headdata(headcnt,1) = subjy(i) /* staff position (relative to jvert) loop for j = 2 to 15 headdata(headcnt,j) = 0 repeat headdata(headcnt,3) = subjx(i) headdata(headcnt,4) = 100 /* no stem (for a start) end repeat &dA &dA &d@ Determine position on staff (headdata(.,2) and set Leland's P12 &dA loop for i = 1 to headcnt p4 = 77 - jvert - headdata(i,1) / 7 headdata(i,2) = p4 repeat if p2 = actloc(lcnt) headdata(i,14) = 0 else headdata(i,14) = 2 end &dA &dA &d@ Determine stem direction and number of flags &dA stem = 100 nflags = 0 gslash = 0 loop for i = 1 to subjcnt if chr(subjc(i)) in [179..186] if stem = 100 stem = subjc(i) / 2 stem = 1 - rem end if subjc(i) < 187 if subjc(i) < 181 gslash = 100 else if subjc(i) < 183 nflags = 1 else if subjc(i) < 185 nflags = 2 else ++nflags end end end end end repeat &dA &dA &d@ Determine Leland's values for stem direction &dA &dA &d@ Also get index for reference note &dA if stem <> 100 if stem = UP p5 = 10000 j = 0 loop for i = 1 to headcnt if headdata(i,2) < p5 p5 = headdata(i,2) j = i end repeat headdata(j,4) = UP refnote = j else p5 = -10000 j = 0 loop for i = 1 to headcnt if headdata(i,2) > p5 p5 = headdata(i,2) j = i end repeat headdata(j,4) = DOWN refnote = j end else p5 = -10000 j = 0 loop for i = 1 to headcnt if headdata(i,2) > p5 p5 = headdata(i,2) j = i end repeat refnote = j end &dA &dA &d@ Determine type of note &dA if jcode < 8 p6 = 0 else p6 = jcode - 7 end loop for i = 1 to headcnt headdata(i,7) = p6 repeat &dA &dA &d@ Determine number of dots per note head &dA &dA &d@ dotarray(.,1) = vert pos &dA &d@ dotarray(.,2) = horz pos (first one) &dA &d@ dotarray(.,3) = horz pos (second one) &dA &d@ dotarray(.,4) = count (single, double, triple) &dA &d@ dotarray(.,5) = flag &dA &dA &dA loop for i = 1 to subjcnt if subjc(i) = 172 /* dot if dotcnt > 0 loop for j = 1 to dotcnt if dotarray(j,1) = subjy(i) if dotarray(j,2) <> subjx(i) and dotarray(j,3) <> subjx(i) ++dotarray(j,4) /* double or triple dots if dotarray(j,3) = 0 /* double dot if subjx(i) > dotarray(j,2) dotarray(j,3) = subjx(i) else dotarray(j,3) = dotarray(j,2) dotarray(j,2) = subjx(i) end else if subjx(i) < dotarray(j,2) dotarray(j,3) = dotarray(j,2) dotarray(j,2) = subjx(i) else if subjx(i) < dotarray(j,3) dotarray(j,3) = subjx(i) end end end end j = 1000 end repeat else j = 0 end if j <> 1000 ++dotcnt dotarray(dotcnt,1) = subjy(i) dotarray(dotcnt,2) = subjx(i) dotarray(dotcnt,3) = 0 dotarray(dotcnt,4) = 1 dotarray(dotcnt,5) = 0 end end repeat maxdots = 0 loop for i = 1 to dotcnt if maxdots < dotarray(i,4) maxdots = dotarray(i,4) end repeat if maxdots > 0 if dotcnt > headcnt putc Problem. The program has found more sets of dots than there putc are note heads. Please check the i-file carefully. The putc character for dot is 44. stop end if dotcnt = headcnt /* (normal situation) loop for j = 1 to headcnt a = -10000 b = 0 loop for i = 1 to headcnt if headdata(i,2) > a and headdata(i,9) = 0 a = headdata(i,2) b = i end repeat c = -10000 d = 0 loop for i = 1 to dotcnt if dotarray(i,1) > c and dotarray(i,5) = 0 c = dotarray(i,1) d = i end repeat headdata(b,9) = dotarray(d,4) /* number of dots dotarray(d,5) = 1 headdata(b,10) = headdata(b,1) - dotarray(d,1) headdata(b,11) = dotarray(d,2) - headdata(b,3) repeat else loop for i = 1 to dotcnt a = 10000 c = 0 loop for j = 1 to headcnt b = abs(headdata(j,1) - dotarray(i,1)) if b < a and headdata(j,9) = 0 a = b c = j end repeat headdata(c,9) = dotarray(i,4) /* number of dots dotarray(i,5) = 1 headdata(c,10) = headdata(c,1) - dotarray(i,1) headdata(c,11) = dotarray(i,2) - headdata(c,3) repeat end loop for i = 1 to headcnt if headdata(i,9) > 0 if headdata(i,11) <= dot_shift2 headdata(i,11) = 0 else a = dot_shift + note_width - 2 b = dot_shift2 + note_width + 1 if headdata(i,11) >= a and headdata(i,11) <= b headdata(i,11) = 1000 else a = headdata(i,11) - dot_shift - 1 / 7 headdata(i,11) = a * 10000 end end a = abs(headdata(i,10)) if a < 2 headdata(i,10) = 0 else if a > 9 /* don't do this dot headdata(i,9) = 0 headdata(i,10) = 0 else if headdata(i,10) < 0 headdata(i,10) = 100 else headdata(i,10) = 0 end end end end repeat end &dA &dA &d@ Construct Leland's P9 &dA loop for i = 1 to headcnt a = 0 if headdata(i,9) > 0 if headdata(i,11) = 1000 a += 10000 else b = headdata(i,11) / 10000 a += b end a += headdata(i,10) * 10 a += headdata(i,9) * 100 end headdata(i,12) = a repeat if nflags > 0 headdata(refnote,12) += nflags * 10 end &dA &dA &d@ Check each note head for an accidental. Determine it's position &dA &d@ relative to the head. Set elements 5 and 6 of the headdata array. &dA loop for i = 1 to headcnt a = 0 /* number b = 0 /* type 1 = sharp 2 = natural 3 = flat e = -10000 loop for j = 1 to subjcnt if subjy(j) = headdata(i,1) and subjc(j) >= 191 and subjc(j) <= 194 if subjc(j) = 194 a = 2 b = 1 j = subjcnt end c = subjc(j) - 190 /* 1, 2 or 3 if a = 0 or b = 2 or c <> b a = 1 b = c else a = 2 j = subjcnt end if e < subjx(j) e = subjx(j) end end repeat /* tricky code hee hee hee! c = a * 3 + b + 1 d = int("0000231534"{c}) headdata(i,5) = d if d > 0 if e > -21 headdata(i,6) = 0 else if e > -37 headdata(i,6) = 1 else if e > -53 headdata(i,6) = 2 else headdata(i,6) = 3 end end end end repeat &dA &dA &d@ Construct Leland's P11 &dA &dA &d@ P11 = articulations or marks attached to note head &dA &d@ &dA &d@ Leland's number My number's &dA &d@ --------------- --------------- &dA &d@ 4 = wedge ^ 94 &dA &d@ 5 = accent > 93 &dA &d@ 6 = tenuto - 99 &dA &d@ 7 = staccato . . 96 &dA &d@ 10 = tenuto-staccato - 96-99 &dA &d@ 11 = down bow 117 &dA &d@ 12 = up bow 116 &dA &d@ 13 = harmonic 122 &dA &d@ 14 = fermata 101 &dA &d@ 17 = mordant 238 &dA &d@ 18 = shake w 239 &dA &d@ 19 = heavy wedge 97 &dA &d@ 20 = trill tr 236 &dA &d@ 30 = fingering 0 199 &dA &d@ 31 = fingering 1 200 &dA &d@ 32 = fingering 2 201 &dA &d@ 33 = fingering 3 202 &dA &d@ 34 = fingering 4 203 &dA &d@ 35 = fingering 5 204 &dA &dA &d@ use negative value to force mark to stem &dA a = 0 loop for i = 1 to subjcnt byte = chr(subjc(i)) if articulations con byte a = mpt if a = 6 or a = 7 loop for j = i + 1 to subjcnt if subjc(j) = 6 or subjc(j) = 7 j = subjcnt a = 10 end repeat end if chr(a) in [4,5,6,7,10,17,18,19] if stem = DOWN if subjy(i) > headdata(refnote,1) a = 0 - a end end if stem = UP if subjy(i) < headdata(refnote,1) a = 0 - a end end end i = subjcnt end repeat headdata(refnote,13) = a &dA &dA &d@ Compute horizontal offset &dA a = jhorz - node_horz loop for i = 1 to headcnt headdata(i,3) += a b = abs(headdata(i,3)) if b >= note_width - 2 and b <= note_width if headdata(i,3) > 0 headdata(i,3) = 100 else headdata(i,3) = 200 end else b = headdata(i,3) * 10 / 7 headdata(i,3) = b end repeat &dA &dA &d@ See if beam connects to this note &dA a = 0 b = 0 c = 0 if jscnt > 0 loop for k = 1 to jscnt h = s(k) /* super object number loop for i = 1 to supercnt if superdata(i,1) = h /* this super object references this object if superdata(i,3) = 1 /* Beam d = superdata(i,2) tget [X,d] rec if rec con "B" a = int(rec{sub+1..}) /* first stem b = int(rec{sub+1..}) /* slope end d = superdata(i,5) /* index of first member of beam group tget [X,d] rec c = int(rec{4..}) /* dummy c = int(rec{sub+1..}) q = int(rec{sub+1..}) /* y position if q > 800 q -= 1000 end e = int(rec{sub+1..}) /* number of sub-objects if a < 0 j = -10000 else j = 10000 end &dA &dA &d@ Look for the head nearest the beam &dA loop for i = 1 to e ++d tget [X,d] ktype f g h if h = 43 if a < 0 if j < f j = f end else if j > f j = f end end end repeat d = q + j /* y position of note head nearest beam i = supercnt k = jscnt end end repeat repeat end &dA &dA &d@ Length of stem: Case I: note connected to beam &dA if c <> 0 /* there is a beam if a < 0 headdata(refnote,4) = DOWN else headdata(refnote,4) = UP end e = d - a /* start of beam f = jhorz - c /* "travel" along beam f *= b f /= 30 /* rise or drop of beam along this "travel" e += f /* height of beam at target note f = headdata(refnote,1) + jvert /* height of reference note head a = abs(f - e) /* length of stem headdata(refnote,8) = a else &dA &dA &d@ Length of stem: Case II: note not connected to beam &dA a = 0 if stem = DOWN j = -10000 else j = 10000 end loop for i = 1 to subjcnt if subjc(i) >= 51 and subjc(i) <= 62 if stem = DOWN if j < subjy(i) j = subjy(i) b = subjc(i) end else if j > subjy(i) j = subjy(i) b = subjc(i) end end end repeat e = abs(j - headdata(refnote,1)) if b < 53 e += 42 else if b < 55 e += 49 else if b < 57 e += 42 else if b < 59 e += 14 else if b < 61 e += 28 else e += 14 end end end end end if headdata(refnote,4) <> 100 headdata(refnote,8) = e end end &dA &dA &d@ Convert stem length to Leland's formula for grace notes (times 10) &dA if headdata(refnote,8) <> 0 headdata(refnote,8) -= 35 /* if zero, this will be 1.0 headdata(refnote,8) *= 50 headdata(refnote,8) /= 21 headdata(refnote,8) += gslash headdata(refnote,8) += 10 end &dA &dA &d@ Now compile parameters and put out note heads! &dA &dA &d@ P1 = 1.0 (set already) &dA &d@ P2 = staff (set already) &dA &d@ P3 = node_horz (set already) &dA &d@ P4 = headdata(., 2) = new y position (relative to staff) &dA &d@ P5 = stem dir + accidental + shift &dA &d@ P6 = headdata(.,7) &dA &d@ P7 = 65.0000 for noteref; 64.0000 for all others &dA &d@ P8 = headdata(.,8) / 10.0 &dA &d@ P9 = headdata(.,12) / 10.0 &dA &d@ P10 = headdata(.,3) / 10.0 &dA &d@ P11 = headdata(.,13) &dA &d@ P12 = headdata(.,14) &dA &dA loop for i = 1 to headcnt &dA &dA &d@ P4 &dA p24 = flt(headdata(i,2)) &dA &dA &d@ P5 &dA p25 = 0.0 if i = refnote if headdata(i,4) = UP p25 += 10.0 end if headdata(i,4) = DOWN p25 += 20.0 end end p25 += flt(headdata(i,5)) p25 += flt(headdata(i,6)) * .25 &dA &dA &d@ P6 &dA p26 = flt(headdata(i,7)) &dA &dA &d@ P7 &dA if i = refnote p27 = 65.0000 else p27 = 64.0000 end &dA &dA &d@ P8 &dA if i = refnote p28 = flt(headdata(i,8)) / 10.0 else p28 = 0.0 end &dA &dA &d@ P9 &dA p29 = flt(headdata(i,12)) / 10.0 &dA &dA &d@ P10 &dA p30 = flt(headdata(i,3)) / 10.0 &dA &dA &d@ P11 &dA p31 = flt(headdata(i,13)) &dA &dA &d@ P12 (there may be some problems with this) &dA p32 = flt(headdata(i,14)) putf [2] .f1w6 1. ~p22 .f2 ~p23 ~p24 ~p25 ~p26 .f4 ~p27 .f2 ~p28 ~p29 ~p30 ~p31 ~p32 putc .f1w6 1. ~p22 .f2 ~p23 ~p24 ~p25 ~p26 .f4 ~p27 .f2 ~p28 ~p29 ~p30 ~p31 ~p32 repeat &dA &dA &d@ Typeset any dynamics which might be attached to this chord &dA &dA &d@ dynamics characters &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &d@ 108 p &dA &d@ 109 m &dA &d@ 110 f &dA &d@ 111 s &dA &d@ 112 z &dA &d@ 113 r &dA &dA &d@ In score, these classes of objects are handled as "code 9" symbols &dA &d@ &dA &d@ code symbol code symbol &dA &d@ ÄÄÄÄÄ ÄÄÄÄÄÄ ÄÄÄÄÄ ÄÄÄÄÄÄ &dA &d@ 50 pppp 58 fff &dA &d@ 51 ppp 59 ffff &dA &d@ 52 pp 60 fp &dA &d@ 53 p 61 sf &dA &d@ 54 mp 62 sfz &dA &d@ 55 mf 127 rf &dA &d@ 56 f 128 rfz &dA &d@ 57 ff &dA a = 0 b = -1000 c = 0 loop for i = 1 to subjcnt d = subjc(i) if d >= 108 and d <= 113 if a = 0 a = subjy(i) else if a <> subjy(i) putc Unexpected situation with dynamics attached to note end end if b = -1000 b = subjx(i) else if subjx(i) < b putc Unexpected situation with dynamics attached to note b = subjx(i) end end if c = 0 if d = 108 c = 53 end if d = 109 c = 1002 end if d = 110 c = 56 end if d = 111 c = 1003 end if d = 112 c = 0 end if d = 113 c = 1004 end else if c >= 51 and c <= 53 if d = 108 --c else c = 0 end end if c = 1002 if d = 108 c = 54 else if d = 110 c = 55 else c = 0 end end end if c >= 56 and c <= 58 if c = 56 and d = 108 c = 60 else if d = 110 ++c else c = 0 end end end if c = 61 if d = 112 c = 62 else c = 0 end end if c = 127 if d = 112 c = 127 else c = 0 end end if c = 1003 if d = 110 c = 61 else c = 0 end end if c = 1004 if d = 110 c = 127 else c = 0 end end end end repeat &dA &dA &d@ a = y offset from jvert &dA &d@ c = score code for dynamic &dA if c > 0 y = flt(jhorz + sysx - 200) if y < 0.0 y = 0.0 end p23 = y / 2050.0 * 200.0 /* P3 p4 = jvert + a p4 = 77 - p4 p24 = flt(p4) / 7.0 p25 = flt(c) p26 = 1.0 putf [2] .f1w6 9. ~p22 .f2 ~p23 ~p24 ~p25 ~p26 putc .f1w6 9. ~p22 .f2 ~p23 ~p24 ~p25 ~p26 end goto EL1