--- /dev/null
+// mensural.mup
+
+// ----------------------------------------------------------------------------
+
+// Overall stem length
+
+define STMLEN 6 @
+
+// Notehead used for longa and breve
+
+define QUDRTOFFS +1.75 @
+//define LO +2 @
+define LO -0 @
+define LNADD -.2 @
+define LNADD2 LNADD LNADD @
+define LNGVERT .7 @
+define LNGVERTU .7 @
+define LNGVERTD 1 @
+//define LNGHOR 2.5 @
+define LNGHOR 3 @
+define HOR2DIST -1.5 @
+define LNGUSTEM STMLEN -LNGVERTU QUDRTOFFS -2 @
+define LNGDSTEM STMLEN +LNGVERT QUDRTOFFS -2 @
+
+define UPPERHORLINE
+ medium line (P1.x LO,P1.y OFFS1 QUDRTOFFS) to (P1.x LO +LNGHOR,P1.y OFFS1 QUDRTOFFS) @
+
+define LOWERHORLINE
+ medium line (P1.x LO,P1.y OFFS1 HOR2DIST QUDRTOFFS) to (P1.x LO +LNGHOR,P1.y OFFS1 HOR2DIST QUDRTOFFS) @
+
+define LEFTVERLINE
+ line (P1.x LO,P1.y OFFS1 +LNGVERTU QUDRTOFFS) to (P1.x LO,P1.y OFFS1 HOR2DIST -LNGVERTD QUDRTOFFS) @
+
+define RIGHTVERLINE
+ line (P1.x LO +LNGHOR,P1.y OFFS1 +LNGVERTU +USTEM QUDRTOFFS) to (P1.x LO +LNGHOR,P1.y OFFS1 HOR2DIST -LNGVERTD -DSTEM QUDRTOFFS) @
+
+define QUADRHD(P1,OFFS1,USTEM,DSTEM)
+ UPPERHORLINE
+ LOWERHORLINE
+ LEFTVERLINE
+ RIGHTVERLINE @
+
+define LONGAU(P2,OFFS2) QUADRHD(P2,OFFS2,LNGUSTEM,0) @
+define LONGAD(P2,OFFS2) QUADRHD(P2,OFFS2,0,LNGDSTEM) @
+define BREVE(P2,OFFS2) QUADRHD(P2,OFFS2,0,0) @
+
+// ----------------------------------------------------------------------------
+
+// noteheads used for semibreve, minima, semiminima, fusa & semifusa
+
+define DMNDHD "\s(12) \(diamond)" @
+define FILLHD "\s(12) \(filldiamond)" @
+define STMXOFFS +2.4 @
+define STMYUOFFS +2 @
+define STMYDOFFS -0 @
+define FLAGXOFFS1 +2 @
+define FLAGYOFFS1 .2 @
+define FLAGYOFFS2 2 @
+define FLAGYOFFS3 1.4 @
+define FLAGYOFFS4 3.2 @
+
+define STEMU line (P1.x STMXOFFS,P1.y OFFS1 STMYUOFFS) to (P1.x STMXOFFS,P1.y OFFS1 STMYUOFFS +STMLEN) @
+
+define STEMD line (P1.x STMXOFFS,P1.y OFFS1 STMYDOFFS) to (P1.x STMXOFFS,P1.y OFFS1 STMYDOFFS -STMLEN) @
+
+define FLAGU1 line (P1.x STMXOFFS,P1.y OFFS1 STMYUOFFS +STMLEN -FLAGYOFFS1) to (P1.x STMXOFFS FLAGXOFFS1,P1.y OFFS1 STMYUOFFS +STMLEN -FLAGYOFFS2) @
+
+define FLAGU2 line (P1.x STMXOFFS,P1.y OFFS1 STMYUOFFS +STMLEN -FLAGYOFFS3) to (P1.x STMXOFFS FLAGXOFFS1,P1.y OFFS1 STMYUOFFS +STMLEN -FLAGYOFFS4) @
+
+define FLAGD1 line (P1.x STMXOFFS,P1.y OFFS1 STMYDOFFS -STMLEN +FLAGYOFFS1) to (P1.x STMXOFFS FLAGXOFFS1,P1.y OFFS1 STMYDOFFS -STMLEN +FLAGYOFFS2) @
+
+define FLAGD2 line (P1.x STMXOFFS,P1.y OFFS1 STMYDOFFS -STMLEN +FLAGYOFFS3) to (P1.x STMXOFFS FLAGXOFFS1,P1.y OFFS1 STMYDOFFS -STMLEN +FLAGYOFFS4) @
+
+define SEMIBREVE(P1,OFFS1)
+ print (P1.x,P1.y OFFS1) DMNDHD @
+
+define CLRDSEMIBREVE(P1,OFFS1)
+ print (P1.x,P1.y OFFS1) FILLHD @
+
+define MINIMU(P1,OFFS1)
+ print (P1.x,P1.y OFFS1) DMNDHD
+ STEMU @
+
+define MINIMD(P1,OFFS1)
+ print (P1.x,P1.y OFFS1) DMNDHD
+ STEMD @
+
+define SEMIMINU(P1,OFFS1)
+ print (P1.x,P1.y OFFS1) FILLHD
+ STEMU @
+
+define SEMIMIND(P1,OFFS1)
+ print (P1.x,P1.y OFFS1) FILLHD
+ STEMD @
+
+define FUSAU(P1,OFFS1)
+ print (P1.x,P1.y OFFS1) FILLHD
+ STEMU
+ FLAGU1 @
+
+define SEMIFUSAU(P1,OFFS1)
+ print (P1.x,P1.y OFFS1) FILLHD
+ STEMU
+ FLAGU1
+ FLAGU2 @
+
+define FUSAD(P1,OFFS1)
+ print (P1.x,P1.y OFFS1) FILLHD
+ STEMD
+ FLAGD1 @
+
+define SEMIFUSAD(P1,OFFS1)
+ print (P1.x,P1.y OFFS1) FILLHD
+ STEMD
+ FLAGD1
+ FLAGD2 @
+
+// ----------------------------------------------------------------------------
+
+// prolongation dots
+
+define DOT "\s(12) \(dot)" @
+define UDOTYOFFS +1.5 @
+define LDOTYOFFS -.5 @
+define CDOTYOFFS +.5 @
+define DOTXOFFS +3.2 @
+
+define UDOT(P1,OFFS1)
+ print (P1.x DOTXOFFS,P1.y OFFS1 UDOTYOFFS) DOT @
+
+define LDOT(P1,OFFS1)
+ print (P1.x DOTXOFFS,P1.y OFFS1 LDOTYOFFS) DOT @
+
+define CDOT(P1,OFFS1)
+ print (P1.x DOTXOFFS,P1.y OFFS1 CDOTYOFFS) DOT @
+
+// ----------------------------------------------------------------------------
+
+// Acidentals
+
+define SHARPXOFFS -2.5 @
+define SHDST .75 @
+
+define SHARP(P1,OFFS1)
+ line (P1.x SHARPXOFFS,P1.y OFFS1+2) to (P1.x SHARPXOFFS+2,P1.y OFFS1);
+ line (P1.x SHARPXOFFS+SHDST,P1.y OFFS1+2) to (P1.x SHARPXOFFS+SHDST+2,P1.y OFFS1);
+ line (P1.x SHARPXOFFS,P1.y OFFS1) to (P1.x SHARPXOFFS+2,P1.y OFFS1+2);
+ line (P1.x SHARPXOFFS+SHDST,P1.y OFFS1) to (P1.x SHARPXOFFS+SHDST+2,P1.y OFFS1+2); @
+
+// ----------------------------------------------------------------------------
+
+// ledger line
+
+define LEDGERLEN +4.75 @
+
+define LEDGER(P1,OFFS1)
+ line (P1.x,P1.y OFFS1) to (P1.x LEDGERLEN,P1.y OFFS1) @
+
+define PLEDGER(P1,XOFFS,YOFFS)
+ line (P1.x XOFFS,P1.y YOFFS) to (P1.x XOFFS LEDGERLEN,P1.y YOFFS) @
+
+// ----------------------------------------------------------------------------
+
+// Rests
+
+define RXOFFS +2 @
+define RLINEADD +.2 @
+define RLINEADD2 RLINEADD RLINEADD @
+
+define RLONGALINELEN 4 @
+
+define RLONGA(P1,OFFS1)
+ medium line (P1.x RXOFFS,P1.y OFFS1) to (P1.x RXOFFS,P1.y OFFS1 -RLONGALINELEN) @
+
+define RBREVELINELEN 2 @
+
+define RBREVE(P1,OFFS1)
+ medium line (P1.x RXOFFS,P1.y OFFS1) to (P1.x RXOFFS,P1.y OFFS1 -RBREVELINELEN) @
+
+define RLINELEN 1.2 @
+
+define RSEMIBREVE(P1,OFFS1)
+ medium line (P1.x RXOFFS,P1.y OFFS1) to (P1.x RXOFFS,P1.y OFFS1 -RLINELEN) @
+
+define RMINIM(P1,OFFS1)
+ medium line (P1.x RXOFFS,P1.y OFFS1) to (P1.x RXOFFS,P1.y OFFS1 +RLINELEN) @
+
+define RFLAGYOFFS1 .1 @
+
+define RFLAG1 line (P1.x RLINEADD RXOFFS,P1.y OFFS1 +RLINELEN -RFLAGYOFFS1) to (P1.x RLINEADD +1 RXOFFS,P1.y OFFS1 +RLINELEN -.5) @
+
+define RSEMIMINIM(P1,OFFS1)
+ medium line (P1.x RXOFFS,P1.y OFFS1) to (P1.x RXOFFS,P1.y OFFS1 +RLINELEN)
+ RFLAG1 @
+
+// ----------------------------------------------------------------------------
+
+// Clefs
+
+define GCLF "\s(12) \(gclef)" @
+define CCLF "\s(12) \(cclef)" @
+define FCLF "\s(12) \(fclef)" @
+
+define TREBLEOFFS -7 @
+
+define TREBLECLF(P1)
+ print (P1.x, P1.y TREBLEOFFS) GCLF @
+
+define PTREBLECLF(P1, TROFFS)
+ print (P1.x TROFFS, P1.y TREBLEOFFS) GCLF @
+
+define TREBLECLF8(P1)
+ print (P1.x, P1.y TREBLEOFFS) GCLF
+ print (P1.x +2, P1.y TREBLEOFFS -2.2) "\f(TI) \s(10) 8"
+@
+
+define PTREBLECLF8(P1, TROFFS)
+ print (P1.x TROFFS, P1.y TREBLEOFFS) GCLF
+ print (P1.x +2 TROFFS, P1.y TREBLEOFFS -2.2) "\f(TI) \s(10) 8"
+@
+
+define BARITONOFFS -0 @
+define TENOROFFS -2 @
+define ALTOOFFS -4 @
+define DESCOFFS -6 @
+define BASSOFFS -4 @
+
+define BARITONCLF(P1)
+ print (P1.x, P1.y BARITONOFFS) CCLF @
+
+define TENORCLF(P1)
+ print (P1.x, P1.y TENOROFFS) CCLF @
+
+define ALTOCLF(P1)
+ print (P1.x, P1.y ALTOOFFS) CCLF @
+
+define DESCCLF(P1)
+ print (P1.x, P1.y DESCOFFS) CCLF @
+
+define BASSCLF(P1)
+ print (P1.x, P1.y BASSOFFS) FCLF @
+
+define PBASSCLF(P1,CLOFFS)
+ print (P1.x CLOFFS, P1.y BASSOFFS) FCLF @
+
+// ----------------------------------------------------------------------------
+
+// Tempus signatures
+
+define PRFXOFFS -6 @
+define PRFXOFFS2 -1.125 @
+define PRFYOFFS -1.75 @
+define DUPYOFFS +2.6 @
+define DUPXOFFS -1.05 @
+define DUPLEN -2.7 @
+
+define DUP(P1)
+ line(P1.x DUPXOFFS,P1.y DUPYOFFS) to (P1.x DUPXOFFS,P1.y DUPLEN) @
+
+// The "Q" parameter must be the "R" parameter divided by the square root
+// of 2. Unfortunately, Mup doesn't support multiplication and division.
+
+define CIRC(X, Y, R, Q)
+ curve (X+R,Y) to (X+Q,Y+Q) to (X,Y+R) to (X-Q,Y+Q) to (X-R,Y) \
+ to (X-Q,Y-Q) to (X,Y-R) to (X+Q,Y-Q) to (X+R,Y) @
+
+define LARC(X, Y, R, Q)
+ curve (X+Q,Y+Q) to (X,Y+R) to (X-Q,Y+Q) to (X-R,Y) \
+ to (X-Q,Y-Q) to (X,Y-R) to (X+Q,Y-Q) @
+
+define RARC(X, Y, R, Q)
+ curve (X-Q,Y+Q) to (X,Y+R) to (X+Q,Y+Q) to (X+R,Y) \
+ to (X+Q,Y-Q) to (X,Y-R) to (X-Q,Y-Q) @
+
+define CIRCL "\f(AR) \s(14) O" @
+define CIRCR 1.75 @
+define CIRCQ 1.237 @
+define CIRCL2(PS) CIRC(PS.x PRFXOFFS2,PS.y,CIRCR,CIRCQ) @
+define HLFCIRCL "\f(AR) \s(14) C" @
+define HLFCIRCL2(PS) LARC(PS.x PRFXOFFS2,PS.y,CIRCR,CIRCQ) @
+define BULLET "\f(AR) \s(8) \(bullet)" @
+
+//define PERF(P1) print(P1.x PRFXOFFS,P1.y PRFYOFFS) CIRCL @
+define PERF(P1) CIRCL2(P1) @
+//define IMPERF(P1) print(P1.x PRFXOFFS,P1.y PRFYOFFS) HLFCIRCL @
+define IMPERF(P1) HLFCIRCL2(P1) @
+
+//define PRLXOFFS -4.25 @
+define PRLXOFFS -3.65 @
+define PRLXOFFS2 -4.2 @
+define PRLYOFFS -.85 @
+
+define IMPERFDUP(P2)
+ IMPERF(P2)
+ DUP(P2) @
+
+define PERFDUP(P2)
+ PERF(P2)
+ DUP(P2) @
+
+define PERFPROL(P2)
+ PERF(P2)
+ print(P2.x PRLXOFFS,P2.y PRLYOFFS) BULLET @
+
+define PERFDUPPROL(P3)
+ PERFDUP(P3)
+ print(P3.x PRLXOFFS,P3.y PRLYOFFS) BULLET @
+
+define IMPERFDUPPROL(P3)
+ IMPERFDUP(P3)
+ print(P3.x PRLXOFFS,P3.y PRLYOFFS) BULLET @
+
+define IMPERFPROL(P3)
+ IMPERF(P3)
+ print(P3.x PRLXOFFS2,P3.y PRLYOFFS) BULLET @
+
+// ----------------------------------------------------------------------------
+
+// Modern time signatures
+
+define CMMN "\s(12) \(com)" @
+define CT "\s(12) \(cut)" @
+
+define MTRFONT "\f(NB)\s(16)" @
+define TRPL MTRFONT+"3" @
+
+define TRIPLEOFFS -2 @
+define PTRIPLE(P1,TROFFS) print(P1.x TROFFS,P1.y TRIPLEOFFS) TRPL @
+
+define COMMONOFFS -2 @
+define CUTOFFS -3 @
+
+define COMMON(P1) print(P1.x,P1.y COMMONOFFS) CMMN @
+define PCOMMON(P1,COFFS) print(P1.x COFFS,P1.y COMMONOFFS) CMMN @
+
+define CUT(P1) print(P1.x,P1.y CUTOFFS) CT @
+
+define METERFRAC(P1,MOFFS,M1,M2)
+ print(P1.x MOFFS,P1.y MOFFS) MTRFONT+M1;
+ print(P1.x MOFFS,P1.y-4) MTRFONT+M2; @