&dA &dA &d@ Program to convert Stage2n to Stage2x (needed to update old Stage2) &dA &dA &d@ Written 06/05/93 &dA &dA #define CLAVE 1 #define AX 2 #define DUR 3 #define NTYPE 4 #define DOT 5 #define TRIP 6 #define TIE 7 #define BEAM 8 #define YPOS 9 #define STEM 10 #define BCODE 11 #define AXCODE 12 str inlib.100,ifile.110,outlib.100,ofile.110,rec.100 str temp.100,name.80,date.80,line.120 int a,b,h,i,j,k int fnum label X(30) &dA &dA &d@ Variables added to the 06/04/93 version &dA str claves.7,numbers.10,tempmeas.12(40),text.16(40),num.3 str chord.5(6),tie.1,backtie.1 str note.4,accs.3,axflag.1 int key,newmeasureflag,firstnote int clave,ax int claveax(50),measax(50) claves = "CDEFGAB" numbers = "0123456789" accs = "#f" getdir rec putc Input Library? getc inlib inlib = trm(inlib) inlib = rec // "/" // inlib putc Output Library? getc outlib outlib = trm(outlib) outlib = rec // "/" // outlib putc First and last file numbers getc a b loop for fnum = a to b if fnum < 10 ifile = inlib // "/0" // chs(fnum) ofile = outlib // "/0" // chs(fnum) else ifile = inlib // "/" // chs(fnum) ofile = outlib // "/" // chs(fnum) end putc file = ~ifile open [1,1] ifile open [2,2] ofile loop getf [1] rec putf [2] ~rec rec = rec // pad(1) repeat while rec{1} <> "&" loop getf [1] rec putf [2] ~rec rec = rec // pad(1) repeat while rec{1} <> "&" tie = " " backtie = " " newmeasureflag = 0 firstnote = 0 loop getf [1] line line = line // pad(80) if " $&*ABCDEFG/@abcfgimr" con line{1} goto X(mpt) else putc Unexpected format for line: putc ~line putc Type "y" to continue getk k if k <> 0x01079 stop end goto XL end &dA &dA &d@ Blank = extra chord tone &dA X(1): rec = line &dA &dA &d@ Here we must add code which will put in any actual accidental &dA &d@ that attaches to the note. (New feature of the new format) &dA note = line{2..5} perform decode /* output = clave and ax perform axcode /* output = axflag if rec{19} = " " rec{19} = axflag end &dA &dA &d@ End of addition &dA rec = trm(rec) putf [2] ~rec goto XL &dA &dA &d@ $ = controlling musical attributes &dA X(2): rec = trm(line) putf [2] ~rec /* (3) find out the key and set up global accidentals if line con "K:" key = int(line{mpt+2..}) loop for i = 1 to 50 claveax(i) = 0 repeat h = key if h > 0 k = 4 loop for i = 1 to h loop for a = k to 50 step 7 claveax(a) = 2 repeat k = k + 4 if k > 7 k = k - 7 end repeat end if h < 0 h = 0 - h k = 7 loop for i = 1 to h loop for a = k to 50 step 7 claveax(a) = 3 repeat k = k - 4 if k < 1 k = k + 7 end repeat end loop for i = 1 to 50 measax(i) = claveax(i) repeat end goto XL &dA &dA &d@ & = comment mode toggle switch &dA X(3): line = trm(line) putf [2] ~line loop getf [1] rec putf [2] ~rec repeat while rec{1} <> "&" goto XL &dA &dA &d@ * = musical directions &dA X(4): rec = trm(line) putf [2] ~rec goto XL &dA &dA &d@ A,B,C,D,E,F,G = regular notes (mpt = 5 to 11) &dA X(5): rec = line &dA &dA &d@ Here we must add code which will put in any actual accidental &dA &d@ that attaches to the note. (New feature of the new format) &dA if newmeasureflag = 1 if firstnote = 1 /* i.e. we've see first note already newmeasureflag = 0 end if backtie = " " firstnote = 1 end end note = line{1..4} perform decode /* output = clave and ax perform axcode /* output = axflag if rec{19} = " " rec{19} = axflag end tie = rec{9} if newmeasureflag = 1 if tie = " " firstnote = 1 end end backtie = tie &dA &dA &d@ End of addition &dA rec = trm(rec) putf [2] ~rec goto XL &dA &dA &d@ / = end of music data or end of file &dA X(12): rec = trm(line) putf [2] ~rec goto XL &dA &dA &d@ @ = single line comment &dA X(13): rec = trm(line) putf [2] ~rec goto XL &dA &dA &d@ a = append to previous line &dA X(14): rec = trm(line) putf [2] ~rec goto XL &dA &dA &d@ b = backspace in time &dA X(15): rec = trm(line) putf [2] ~rec goto XL &dA &dA &d@ c = cue-size note &dA X(16): rec = line &dA &dA &d@ Here we must add code which will put in any actual accidental &dA &d@ that attaches to the note. (New feature of the new format) &dA if line{2} <> " " note = line{2..5} else note = line{3..6} end tie = " " /* ignore tie perform decode /* output = clave and ax perform axcode /* output = axflag if rec{19} = " " rec{19} = axflag end tie = backtie &dA &dA &d@ End of addition &dA rec = trm(rec) putf [2] ~rec goto XL &dA &dA &d@ f = figured harmony &dA X(17): rec = trm(line) putf [2] ~rec goto XL &dA &dA &d@ g = grace note &dA X(18): rec = line &dA &dA &d@ Here we must add code which will put in any actual accidental &dA &d@ that attaches to the note. (New feature of the new format) &dA if line{2} <> " " note = line{2..5} else note = line{3..6} end tie = " " /* ignore tie perform decode /* output = clave and ax perform axcode /* output = axflag if rec{19} = " " rec{19} = axflag end tie = backtie &dA &dA &d@ End of addition &dA rec = trm(rec) putf [2] ~rec goto XL &dA &dA &d@ i = invisible rest &dA X(19): rec = trm(line) putf [2] ~rec goto XL &dA &dA &d@ m = bar line &dA X(20): rec = trm(line) putf [2] ~rec loop for i = 1 to 50 measax(i) = claveax(i) repeat newmeasureflag = 1 firstnote = 0 goto XL &dA &dA &d@ r = regular rest &dA X(21): newmeasureflag = 0 rec = trm(line) putf [2] ~rec XL: repeat eof1: close [1] close [2] repeat &dA &d@ &dAÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»&d@ &dA &d@ &dAº P R O C E D U R E S º&d@ &dA &d@ &dAÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ&d@ &dAÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»&d@ &dAº 1. Procedure: decode º&d@ &dAº º&d@ &dAº Input: note (string of length 4) º&d@ &dAº º&d@ &dAº Output: clave (integer between 1 and 60, or 100) º&d@ &dAº ax (integer between 0 and 15) º&d@ &dAÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ&d@ procedure decode int a,b if claves con note{1} a = mpt else putc Decode Error 1 stop end ax = 0 loop for b = 2 to 4 if numbers con note{b} clave = mpt - 2 * 7 + a return end ax = ax << 2 if accs con note{b} ax = ior(ax,mpt+1) else putc Decode Error 3 examine stop end repeat putc Decode Error 2 stop return &dAÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»&d@ &dAº 2. Procedure: axcode º&d@ &dAº º&d@ &dAº Input: clave clave number º&d@ &dAº ax absolute accidental º&d@ &dAº tie "-" = tie from previous note º&d@ &dAº newmeasureflag 1 = first note in measure º&d@ &dAº º&d@ &dAº Output: axflag #,n,f,x,X,S,F,& º&d@ &dAÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ&d@ procedure axcode int j,k if newmeasureflag = 1 and tie = "-" k = 0 else k = ax if ax = measax(clave) k = 0 else if ax = 0 k = 1 else if measax(clave) > 7 and ax < 4 k = k | 4 /* natural-sharp or natural-flat end end measax(clave) = ax end end axflag = " n#f SF x &"{k+1} return run