÷ƒ’À;è TeX output 2005.08.31:1056‹ÿÿÿÿ x€ ý¤€ =€ þÿ𒌴ïsrc:18mainloop.texóDÓít½qG®cmr17ºT‘üÔ)ŸÉEŽ‘zÚX‘ýí󛻈@½q cmti12»m‘þöƒuseº's–BÚMain“Lo‘Š±opŽŸ#Ÿô’¹®<óX«Q ff cmr12¼F‘þÓ4ederico‘³/GarciaŽŽŽŽŽŸýl’¸ÆAugust–³/31,“2005ŽŸ%íº’êïsrc:30mainloop.texŽŸ™š‘TÌ»ïsrc:31mainloop.texóKñ`y ó3 cmr10¿This–/6doMÞcumen²!t“accompanies“the“program“T‘þ,³Ÿÿ»EŽ‘B X‘þápóý': ó3 cmti10Ám‘ÿp¸use“¿in“its“ rst“sub-Ž¤ ™š‘D_ìmission–T‡to“óŒ-ø ó3 cmcsc10ÂCT‘ÿ ¸AN¿.“The“program“is“incomplete,‘dçbut“as“it“stands“it“canŽ¡‘D_ìbMÞe–Oøcalled“a“` rst“stage'.‘Ú’But“there“is“no“óßê ó3 logo10ÄMETÁ´AFƒjONT‘ ¿part),‘/Wthat“mak˜esŽ¡‘D_ìclear–¦fat“least“the“cen²!tral“ideas“of“a“somewhat“unfriendly“coMÞde.Ž¡‘TÌ»ïsrc:35mainloop.texIf–Öÿy²!ou“are“lošMÞoking“for“a“guide“to“the“user,‘ã&the“b˜est“is“to“go“to“theŽ¡‘D_ìend,›=·where–tthere“is“a“sample“with“the“user's“input,˜as“w²!ell“as“to“theŽ¡‘D_ìother–â„samples“(Bacš²!h's“ÁInventions‘æ¿)“that“are“on-line“with“the“pac˜k‘ÿdDage.Ž¡‘D_ìThere–½are“also“other“doMÞcumen²!ts“(a“guide“to“installation“and“runningŽ¡‘D_ìand–¦fa“list“of“shortcomings“and“w•²!an“ts).Ž¡‘TÌ»ïsrc:37mainloop.texT‘þ,³Ÿÿ»EŽ‘B X‘þápÁm‘ÿp¸use–è-¿has“bšMÞeen“describ˜ed“in“óp®0J ó3 cmsl10ÅTUGb˜oat‘%-óò"V ó3 cmbx10À24¿/2.‘£1A‘èsecond“articleŽ¡‘D_ìwill–BØappšMÞear“in“the“next“issue“of“ÅTUGb˜oat¿,‘VÁconš²!taining“prett˜y“m˜uc˜h“theŽ¡‘D_ìpresen•²!t› ×doMÞcumen“t.‘ /T‘þ,³Ÿÿ»EŽ‘B X‘þápÁm‘ÿp¸use¿'s˜w“ebpage˜is˜Ãhttp://www.fedegarcia.Ž¡‘D_ìnet/TeX/TeXmuse.html¿.‘tuThis–Ø™ rst“stage“w²!as“in“part“pMÞossible“thanksŽ¡‘D_ìto–¦fa“granš²!t“from“the“T‘þ,³Ÿÿ»EŽ‘B X“Dev˜elopmen˜t“F‘ÿeund.‘ÝÝThanks!ŽŸ"’ב'ïsrc:42mainloop.texóX«Q cmr12¹Let's–å-bSŽegin“with“a“simple“case:‘6#ó#³—¥¢ mainloop1ÎŽ‘*Æ玑7ØRŽ‘D齎‘U®^Ž‘frÿŽ‘frÿ¹.‘7 This“is“the“result“of“theŽŸP‘'input–Jqstring“ó$߆µT cmtt12Ï5C4[EC]5GG¹.“The“n•¬rum“bSŽers–Jqtell“the“rh¬rythmic“v‘ÿXäalue“(5“for“theŽ¤€‘'quarter-,›\^4–mfor“the“eigh¬rth-note),˜and“the“letters“tell“the“pitc¬rh.‘°/`Ï[¹'“and“`Ï]¹'Ž¡‘'create–ê¨the“bSŽeam“of“the“second“and“third“notes.Ž¡‘;ïsrc:44mainloop.texOf–žcourse,‘à9there“are“sevš¬reral“ó%Œ-ø cmcsc10Ðc¹'s|the“reference“to“`ÏC¹'‘Ias“the“ rst“note“w˜ouldŽ¡‘'not–rÍbšSŽe“sucien¬rt“to“ x“it“where“it“app˜ears“in“the“example.‘ìT‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈó&›»ˆ@ cmti12Ñm‘ÿfduse“¹w¬ras“ableŽ¡‘'to–G x“it“as“Ðc5“¹(Ðc4“¹is“the“so-called“`middle-Ðc¹',‘gÃand“this“one“is“an“oSŽcta•¬rv“e‘G higherŽŽŸ’ç1ŽŽŒ‹* x€ ý¤€ =€ ý瀑'¹than–¬that)“bSŽecause,› min“truth,˜the“input“started“with“Ï\rangefrom{G4}¹.‘¹ëThisŽ¤€‘'set›ÎgÐg4,–pHa4,“b4,“c5,“d5,“e5,“¹and˜Ðf5˜¹as˜the˜default˜for˜eac•¬rh˜pitc“h.‘/uThe˜coSŽdeŽ¡‘'for–rthis,‘Š2not“devš¬roid“of“in˜terest,›Š2is“in“lines“165{185,˜with“an“auxiliary“functionŽ¡‘'de ned–ê¨at“290.Ž¡‘;ïsrc:46mainloop.texBut–×that“is“not“part“of“T‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse¹'s“main“lošSŽop.‘2UThe“latter“is“rather“ab˜outŽ¡‘'what–ê¨happSŽens“to“the“input“at“the“di eren¬rt“stages.ŽŸ"·‘'ó'ÂÖN ff cmbx12ÒQuanŒÌtization–ffand“the“`matrix'ŽŸ@‘'ïsrc:49mainloop.tex¹The–ƒ# rst“time“T‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse“¹collects“rhš¬rythmic“information:‘iÖho˜w“long“eac˜h“noteŽ¡‘'is.‘8àIn–ê¨our“ rst“example,“the“result“is“the“follo¬rwing“`matrix':ŽŸ”’ÅÝqïsrc:52mainloop.tex„ffHEŽŽŸ>&f’Õá-ïsrc:53mainloop.texŸÏŠ«‘>þÃ0:1.ŽŽ¤ ±‘ T64:1.ŽŽ¡‘ T96:1.ŽŽ¡‘¿ª128:1.ŽŽ¡‘¿ª192:1.ŽŽ¡9999:0.ŽŽŽŽŸ™š’ÅÝqïsrc:59mainloop.tex„ffHEŽŽŸçú‘'ïsrc:62mainloop.tex¹This–tsimple“list“registers“the“follo¬rwing“facts:‘L­the“ rst“note“is“at“pSŽosition“0;Ž¡‘'since–æuit“is“a“quarter-note,‘it“has“a“`quanš¬rtum“v‘ÿXäalue'“of“64ó(·ág£ cmmi12Óq‘T®¹(the“`rh˜ythmic“quan-Ž¡‘'tum'–mëis“de ned“as“the“256Ÿû¥2ó|{Ycmr8ÆthŽ‘‡$¹-note,›†Þa“note“with“6“ ags,˜that“naturally“gets“1Óqn9¹).Ž¡‘'Consequen¬rtly‘ÿV,›e¿the–M!next“note,˜whatev¬rer“it“is,˜will“bSŽe“at“64.‘`JIn“this“case“it“isŽ¡‘'an–òWeigh¬rth-note,›ôBwith“a“v‘ÿXäalue“of“32Óqn9¹.‘OìTherefore,˜the“next“note“appSŽears“at“96.Ž¡‘'And–ê¨so“on.Ž¡‘;ïsrc:64mainloop.texAll–plines,›‘õin“addition“to“the“quan¬rtum“pSŽosition,˜ha•¬rv“e–pa“Ï1¹.‘ÊfEac¬rh“of“themŽ¡‘'means–that“there“is“a“note“at“the“indicated“pSŽosition.‘ÑÀThe“exception“is“ofŽ¡‘'course–ê¨the“ nal“Ï9999¹,“that“has“bSŽeen“added“as“a“mark¬rer“of“the“end.Ž¡‘;ïsrc:66mainloop.texThe–í›translation“of“the“input“inš¬rto“suc˜h“a“quan˜tized“matrix“is“the“ rst“stageŽ¡‘'of–"}T‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse¹'s“main“loSŽop:‘¨Šthe“`quan¬rtization'.‘à`Its“true“signi cance“is“actuallyŽ¡‘'seen–Š:only“when“there“is“more“than“one“sta .‘»LoSŽok“at“this“other“example“andŽ¡‘'its‘ê¨matrix:ŽŸSßi‘'ïsrc:69mainloop.tex‘M Dó*(œ` mainloop2ÕŽ‘r›Ž‘¬sŽ’Œ½ÞŽ’‚Ž’®G Ž’´CÕŽŸÎ¹¢’Ã0:1,1.ŽŽ¤ 6e’ Ím64:1,1.ŽŽ¡’ Ím96:0,1.ŽŽ¡’ Ã128:1,1.ŽŽ¡’ Ã192:1,1.ŽŽ¡’ Ã256:0,0.ŽŽ¡’N9999:‘ T0.ŽŽŽŽŽŽŽŸ’ç¹2ŽŽŒ‹  x€ ý¤€ =€ ý瀑;ïsrc:74mainloop.tex¹Here–êthere“is“an“instances“of“a“pSŽositions“with“`Ï0¹'“instead“of“`Ï1¹'.‘§The“leftŽ¤€‘'hand–2Ÿ(bšSŽottom“sta ,‘D rst“item“after“`Ï:¹'‘ÈÎin“the“matrix“lines)“do˜es“Ñnot‘Vã¹ha•¬rv“e‘2ŸaŽ¡‘'note–ºSat“pSŽosition“96.‘(ÄAnd,›Ãþon“the“other“hand,˜evš¬ren“though˜t“the“left“hand“hasŽ¡‘'a–¡1quarter-note“(actually“a“quarter-Ñr‘ÿffest¹,‘ÎÔbut“for“the“purpSŽoses“it's“the“same)Ž¡‘'at–é€pSŽosition“64,›)6the“c¬rharacter“is“not“one“of“a“quarter-note“(64Óqn9¹),˜but“of“anŽ¡‘'eigh¬rth-note‘ê¨(32Óqn9¹).Ž¡‘;ïsrc:76mainloop.texThe–g½presence“of‘=õÏ256“¹in“this“matrix,‘‡if“yš¬rou“are“w˜ondering,‘‡is“due“to“theŽ¡‘'inclusion–ê¨of“the“barline“(as“a“result“of“`Ï|¹'“in“the“input).Ž¡‘;ïsrc:78mainloop.texNote–÷ôthat“Ï\rangefrom“¹has“no“meaning“for“the“construction“of“the“matrix.Ž¡‘'As–1’far“as“the“matrix“is“concerned,›CMall“notes,˜and“ev¬ren“rests,˜are“the“same|Ž¡‘'there–tis“no“di erence“bSŽet•¬rw“een–tÐc“¹and“Ðd¹.‘ÔùMost“other“things,‘–]likš¬re“acciden˜talsŽ¡‘'( ats,–œ}sharps,“naturals),“ties,“or–ˆóanš¬ry“other“suc˜h“additions,‘œ}also“mean“nothingŽ¡‘'for–ê¨the“matrix.Ž¤ ™š‘;ïsrc:80mainloop.texIn–?fact,›Tin“lines“280{7,˜where“T‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse“¹is“preparing“things“to“`quan¬rtize'Ž¡‘'the–ê¨input,“it“declaresŽŸ™š‘'ïsrc:89mainloop.texÃ\let[\relax\let]\relaxŽ¡‘'\let|\quant@barlineŽ¡‘'\letA\quant@note\letB\quant@note\letC\quant@note\letD\quant@noteŽ¡‘'\letE\quant@note\letF\quant@note\letG\quant@note\letR\quant@noteŽ¡‘'\let\rangefrom\@gobbleŽ¡‘'\let\#\relax\let\n\relax\let\b\relaxŽŸ$€‘'ïsrc:93mainloop.tex¹Quanš¬rtization–ç}is“one“of“the“things“that“happSŽen“Ñalways¹.‘â|T‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse“¹has“a“n˜um˜bSŽerŽ¤€‘'(and–èüwill“ha•¬rv“e–èümore)“w•¬ra“ys–èüof“actually“tš¬rypSŽesetting“the“m˜usical“text:‘8 Ï\music¹,Ž¡‘'for–zçexample,‘ž÷makš¬res“long“m˜usical“text“bSŽe“break‘ÿXäable“at“the“end“of“lines,‘ž÷andŽ¡‘'appSŽends–õ¶a“ nal,›øydouble“bar“at“the“end.‘Z Ï\excerpt¹,˜on“the“con•¬rtrary‘ÿV,˜t“ypSŽesetsŽ¡‘'the–EÎmš¬rusic“in“a“single“line.‘í(This“latter“is“what“I‘E¤ha˜v˜e“bSŽeen“using“for“examplesŽ¡‘'so›±Ãfar).‘%éEv•¬ren“tually‘ÿV,‘½$a˜Ï\musicbox˜¹will˜allo“w˜setting˜the˜exact˜width˜of˜a˜bSŽo“x,Ž¡‘'and–ê¨Ï\musicparbox“¹will“bSŽe“a“com¬rbination“of“Ï\music“¹and“Ï\musicbox¹.Ž¡‘;ïsrc:95mainloop.texBut,›t£in–W!an¬ry“case,˜Ñal‘™™l‘•´¹of“these“functions“carry“out“the“`quan¬rtization'.‘³It“is,Ž¡‘'in–ûfact,›the“ rst“part“of“T‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse¹'s“main“loSŽop,˜and“is“done“b¬ry“the“commandŽ¡‘'Ï\@quantization–꨹(de ned“b¬ry“lines“411-36).ŽŸ"Ê«‘'ÒThe–ffauxiliary“ lesŽŸ@‘'ïsrc:98mainloop.tex¹The–éasecond“stage“is“actually“also“carried“out“b¬ry“Ï\@quantization¹,‘é£since“thisŽ¡‘'allo¬rws–c’pšSŽerforming“only“one“lo˜op“through“the“di erenš¬rt“sta˜v˜es'“input.‘£But“itŽŽŸ’ç3ŽŽŒ‹9 x€ ý¤€ =€ ý瀑'¹m¬rust–ÿ¨bSŽe“considered“a“separate“stage.‘wáIt“consists“in“the“writing“of“`auxiliary'Ž¤€‘' les.Ž¡‘;ïsrc:100mainloop.texOne–³auxiliary“ le“is“created“for“eacš¬rh“instrumen˜t“(i.e.,‘¾;eac˜h“sta ‘Ö8).‘&]These,Ž¡‘'for–X§example,›uÚare“the“ les“for“Ï\shortl“¹and“Ï\shortr¹,˜the“t•¬rw“o›X§sta“v“es˜of˜the˜lastŽ¡‘'example:Ž‘'Ÿ»º‰ff†’Ãïsrc:104mainloop.texŽŸ(âè‘(Ìïsrc:105mainloop.texó+ßê logo10ÚMET»»AF‘ÿwwONTŽ¡‘'¹as–½epart“of“the“automatic“bSŽeginning“of“the“line.‘)ÊNeither“is“represenš¬rted“b˜y“theŽ¡‘'auxiliary‘ê¨ les.)ŽŽŸ’ç5ŽŽŒ‹-H x€ ý¤€ =€ ý瀑;ïsrc:190mainloop.tex¹All–B?the“commands“in“the“auxiliary“ les“are“priv‘ÿXäate,‘X%and“the“user“kno¬rwsŽ¤€‘'nothing–  abSŽout“them“(although,›Íbof“course,˜the“list“can“bSŽe“seen“and“read“b¬ryŽ¡‘'him,‘†Ñma¬rybšSŽe–g•a“go˜o˜d“thing“for“debugging“his“ les).‘¯¨They“are“the“commandsŽ¡‘'that–ê¨the“third“stage“understands.ŽŸ"Ê«‘'ÒThe‘ffó0{#ºõff logod10ÛMET©ûAF‘ÿSøONT‘¼jÒ lesŽŸ@‘'ïsrc:194mainloop.tex¹Evš¬rerything–Qis“ready“no˜w“to“write“the“ÚMET»»AF‘ÿwwONT‘V•¹ le“that“will“dra˜ws“theŽ¡‘'cš¬rharacters.‘8à(This–ê¨is“done“b˜y“command“Ï\mf@files¹,“de ned“in“lines“437{5.)Ž¡‘;ïsrc:196mainloop.texThe–mi rst“line“in“the“matrix,›†uthat“correspSŽonds“to“the“ rst“note,˜is“Ï0:‘,Í1,1¹.Ž¡‘'The–ZŒnote“is“at“pSŽosition“0.›×No•¬rw,‘w_ho“w–ZŒlong“is“it?˜(The“answš¬rer“will“mean,‘w_t˜ypSŽo-Ž¡‘'graphically‘ÿV,‘{ho•¬rw›_5m“uc“h˜space˜the˜note˜will˜receiv“e˜when˜the˜line˜is˜stretc“hed.)Ž¡‘'Since–¼ìthe“next“line“in“the“matrix“is“at“64,‘Æthe“ rst“note“is“64–M>ó)!",š cmsy10Ô“¹0–UR=“64Óq‘+%¹long.Ž¡‘'So,‘þçthe–úÚc¬rharacter“for“the“ rst“note“can“bšSŽe“op˜ened:‘YDto“the“ÚMET»»AF‘ÿwwONT‘?¹ le“isŽ¡‘'added–ê¨the“lineŽ¡‘;ïsrc:198mainloop.texÏnew_char(64);Ž¡‘'ïsrc:200mainloop.tex¹Noš¬rw,‘Nwhat–:"doSŽes“this“note“con˜tain?‘'NBecause“of“the“ rst“Ï1“¹in“the“c˜haracter'sŽ¡‘'matrix–`¬line,›¾,it“is“kno¬rwn“that“the“ rst“sta “(the“bSŽottom“one,˜in“this“caseŽ¡‘'Ïshortlii¹)–Vßhas“a“note“in“this“c¬rharacter.‘}†So,‘qía“line“is“added“that“announcesŽ¡‘'it:Ž¡‘;ïsrc:202mainloop.texÏshortlii;Ž¡‘'ïsrc:204mainloop.tex¹Next,‘¡œthe–Ÿdra¬rwing“of“the“Ïshortlii¹'s“note“itself.‘ ¼ÄThe“auxiliary“ le“(re-Ž¡‘'memš¬rbSŽer––Xthere“is“one“for“eac˜h“sta ‘Ö8)“tells“the“program“that“the“ rst“noteŽ¡‘'is–ËÏ\q@n\add@note{c3}\@stem¹.‘HThis“string“of“commands,‘Ôwhen“executed“b¬ryŽ¡‘'T‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse¹,–ê¨result“in“the“follo¬rwing“lines“in“the“ÚMET»»AF‘ÿwwONT‘.ì¹ le:Ž©€‘'ïsrc:208mainloop.texÏadd_noteheads(c3);Ž¡‘'regular_stem;Ž¦‘'ïsrc:210mainloop.tex¹The–¥ rst“sta “is“ready‘ÿV.‘̃Since“there“is“also“a“`Ï1¹'“for“the“second“sta “(Ïshortrii¹),Ž¡‘'it–œpwill“bSŽe“announced“and“its“note,›ßHnamely“Ï\q@n\add@note{c4}\@stem¹,˜dra¬rwn:Ž¦‘'ïsrc:215mainloop.texÏshortrii;Ž¡‘?³4add_noteheads(c5);Ž¡‘?³4regular_stem;Ž¦‘'ïsrc:217mainloop.tex¹With–ê¨that“the“ rst“c¬rharacter“is“ nished.‘8àA“ nal“Ïend_of_char“¹closes“it.Ž¡‘;ïsrc:219mainloop.texOne–Pnote“from“eac¬rh“auxiliary“ le“has“bSŽeen“`consumed'.‘¸ÙIt“has“in“factŽ¡‘'Ñdisapp–ÿffe“ar“e“d‘§^¹from–hËthe“list:‘5%T‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse“¹deleted“it.‘³HNo¬rw“the“register“that“holdsŽŽŸ’ç6ŽŽŒ‹8F x€ ý¤€ =€ ý瀑'¹the–¥çlist“of“notes“(i.e,‘æÚthe“one“con¬rtaining“`Ï\next@note\q@n\add@note{c3}¹.–õT.“.“')Ž¤€‘'starts–ôßfrom“(what“w¬ras)“the“Ñse–ÿffc“ond‘3r¹item.‘W„The–ôßnext“time“T‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse“¹ nds“a“`Ï1¹'Ž¡‘'in–ìthe“matrix“that“correspšSŽonds“to“that“sta ,‘2Þbut“not“b˜efore,›2Þthis“(second,˜no¬rwŽ¡‘' rst)–½note“will“bšSŽe“executed,–Eìand,“it‘½to˜o|w¬rell,“`executed'.‘ô<(By–½this“pro˜cedure,Ž¡‘'T‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse–꨹doSŽes“not“ha•¬rv“e–ê¨to“`coun¬rt'“the“items“in“the“list“or“in“the“matrix.)ŽŸ*«‘'ïsrc:221mainloop.texThe–q*second“c¬rharacter,›ÒËwith“a“matrix“line“of“Ï64:‘,Í1,1¹,˜lasts“only“32Óqn9¹,˜bSŽe-Ž¡‘'cause–#the“next“matrix“line“bšSŽegins“with“Ï96¹.‘²RBut“it“to˜o“has“notes“for“b˜othŽ¡‘'sta•¬rv“es›ÿÒ(`Ï1,1¹'),‘whic“h˜are˜the˜simpler˜Ï\q@n\@rest{0}˜¹and˜the˜more˜complexŽ¡‘'Ï\e@n\@flag\add@note{e5}\@stem\@flag¹.‘ÖSo–the“second“c¬rharacter“in“theŽ¡‘'ÚMET»»AF‘ÿwwONT‘.ì¹ le–ê¨is“written“as“follo¬rws:ŽŸ€‘'ïsrc:232mainloop.texÏnew_char(32);Ž¡‘'shortlii;Ž¡‘9†gadd_rest(0,0);Ž¡‘'shortrii;Ž¡‘9†gadd_noteheads(e5);Ž¡‘9†gadd_flat(e5);Ž¡‘9†gregular_stem;Ž¡‘9†gadd_flag(1);Ž¡‘'end_of_char;ŽŸ!*«‘'ïsrc:234mainloop.tex¹The–Nêthird“cš¬rharacter“has“a“matrix“line“of“Ï96:‘,Í0,1¹.‘öIt“will“only“ha˜v˜e“a“note“forŽ¡‘'the–Žsecond“instrumenš¬rt.‘#6The“list“of“notes“of“the“Ñ rst‘²^¹instrumen˜t,–¶÷then,“willŽ¡‘'not–LòbšSŽe“read.‘NIts“next“item“will“then“Ñnot‘q6¹b˜e“deleted:‘êwhatev¬rer“it“is,‘l}it“remainsŽ¡‘'there–Âunš¬rtil“another“matrix“line“actually“in˜v˜ok˜es“it.‘¾ïThe“third“c˜haracter“is,Ž¡‘'then:Ž©ÕU‘'ïsrc:243mainloop.texÏnew_char(32);Ž¡‘'shortrii;Ž¡‘9†gadd_noteheads(c5);Ž¡‘9†gregular_stem;Ž¡‘9†gadd_flag(1);Ž¡‘'end_of_char;Ž¦‘'ïsrc:245mainloop.tex¹A‘sœquotation–sÀof“the“whole“ÚMET»»AF‘ÿwwONT‘¸¹ le“for“this“example“is“at“the“end“ofŽ¡‘'this–9ÀdošSŽcumen¬rt.‘&(The“initial“declarations“and“initializations“to“b˜e“found“in“itŽ¡‘'are–™written“b¬ry“Ï\mf@files¹,‘Ķin“a“subroutine“called“Ï\mf@@headers“¹(not“part,Ž¡‘'actually‘ÿV,–ê¨of“`the“main“loSŽop').ŽŽŸ’ç7ŽŽŒ‹CE x€ ý¤€ =€ ý瀑'ÒThe–ffprinšŒÌting“of“the“m˜usicŽŸ@‘'ïsrc:248mainloop.tex¹The–„sloSŽop“is“completed“when“T‘þ ‘Ÿ0ÎEŽ›‘!X“(trusting“the“ÚMET»»AF‘ÿwwONT‘È·¹part“of“T‘þ ‘Ÿ0ÎEŽ˜X‘þÌÈÑm‘ÿfduseŽ¤€‘'¹to›(«ha•¬rv“e˜correctly˜dra“wn˜the˜c“haracters)˜t“ypSŽes˜the˜c“haracters.‘òéThis˜happSŽensŽ¡‘'at–ÎYÏ\@compose“¹(lines“514{31),‘Eand“has“a“v¬rery“simple“form:‘Ait's“a“loSŽop“thatŽ¡‘'selects–“ùthe“new“fonš¬rt“(Ï\@musicfont¹)“and“t˜ypSŽes“the“c˜haracters“one“b˜y“oneŽ¡‘'(Ï\char\the\char@no¹)–ì0up“to“the“last“one.‘ä I‘ëïcan“repSŽeat“that“righ¬rt“here,‘addingŽ¡‘'commas›ê¨bSŽet•¬rw“een˜c“haracters:ŽŸ@Ž6‘iÀ§ïsrc:252mainloop.texÙ– ¿ø¹,“Ù“¹,“Ù“¹,“Ù“¹,“Ù“¹,“Ù“¹.ŽŸ*¿ÿ‘'ó2ÂÖN G® cmbx12ÝDetail:‘£Öthe‘záinputŽŸb#‘'ïsrc:258mainloop.tex¹The–ä=main“lošSŽop“can“b˜e“fairly“easily“explained.‘ágIts“actual“co˜de“in“Ïtexmuse.tex¹,Ž¡‘'ho•¬rw“ev“er,‘òÃis–ñ$far“more“obscure.‘LUThat's“due“to“a“n•¬rum“bSŽer–ñ$of“complications“thatŽ¡‘'oSŽccur–ðœat“evš¬rery“stage.‘å‡One“of“them“is“the“fact“that“the“user's“input“can“con˜tainŽ¡‘'more–ê¨items“than“simply“notes“and“rests.Ž¡‘;ïsrc:260mainloop.texIn–cfact,‘¬×eac¬rh“note“can“bšSŽe“sub‘§ject“to“a“series“of“mo˜di ers.‘I'm“not“talkingŽ¡‘'here–µÏabSŽout“accidenš¬rtals“( ats,–è™sharps,“naturals),“whic˜h–µÏare“another“sub‘§ject.Ž¡‘'Apart–•‡from“those,‘À>notes“can“bšSŽe“mo˜di ed,›À>for“example,˜as“it“comes“to“`reg-Ž¡‘'ister'.‘tAs–‰Ùwš¬re“sa˜w,‘±¦Ï\ragefrom“¹de nes“a“`default'“register“for“all“notes|sa˜y‘ÿV,Ž¡‘'Ï\rangefrom{C4}–µê¹de nes“all“ÏC¹'s“in“the“input“to“refer“to“the“middle“Ðc¹.‘š¥ButŽ¡‘'there–Imighš¬rt“bSŽe“a“need“for“a“note“in“a“Ñdi er‘ÿffent‘¥¹register|sa˜y‘ÿV,‘¦òÐc5“¹instead“ofŽ¡‘'Ðc4¹.‘2ÝThis–Ø can“bSŽe“ac•¬rhiev“ed,›Ü;instead–Ø of“issuing“another“Ï\rangefrom¹,˜bš¬ry“t˜ypingŽ¡‘'a–%Ï+“¹after“the“note,‘3žwhicš¬rh“to“T‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse“¹means“`set“this“note“an“oSŽcta˜v˜e“higherŽ¡‘'than–G6the“currenš¬rt“range'.‘N‹A‘GÏ-“¹means“an“oSŽcta˜v˜e“lo˜w˜er,‘^Zand“it“is“also“pSŽossibleŽ¡‘'to–ê¨apply“Ñmany‘ø*¹of“these“moSŽdi ers“to“a“single“note.Ž¡‘;ïsrc:262mainloop.texWhat–r–happšSŽens“to“th¬rus-mo˜di ed“notes“in“the“ rst“stage|the“`quan¬rtiza-Ž¡‘'ton'‘N8?‘¢F‘ÿVor–c this“stage,‘"all“notes“are“the“same:‘)¤they“simply“proSŽduce“an“en¬rtryŽ¡‘'in–Áuthe“rhš¬rythmic“`matrix'“of“the“piece.‘+$Y‘ÿVou“remem˜bšSŽer“from“ab˜o•¬rv“e–Áuthat“in“theŽ¡‘' rst–º»stage“all“notes“are“inš¬rterpreted“as“Ï\quant@note¹.‘(æBut“in“order“to“pro˜videŽ¡‘'for–cmoSŽdi ers,›ÒÏ\quant@note“¹is“still“not“an“`executiv¬re'“function“(one“that,˜forŽ¡‘'example,›¡Nadds–|Æthe“en¬rtry“to“the“matrix),˜but“merely“a“directiv¬re.‘ï;This“is“itsŽ¡‘'real‘ê¨de nition:Ž¡‘;ïsrc:264mainloop.texÏ\def\quant@note#1{\let\@let@token=#1\@quant@note}ŽŽŸ’ç¹8ŽŽŒ‹ L x€ ý¤€ =€ ý瀑'ïsrc:266mainloop.tex¹This–Äèreads“the“next“tokš¬ren,‘Ìuand“in˜v˜ok˜es“Ï\@quant@note¹.‘,KThis“latter“examinesŽ©€‘'the–ê¨next“tok¬ren:ŽŸ™š‘'ïsrc:277mainloop.texÃ\def\@quant@note{\let\next\@let@tokenŽ¤ ™š‘=þ¨\ifx\@let@token-\let\next\quant@noteŽ¡‘=þ¨\else\ifx\@let@token+\let\next\quant@noteŽ¡‘=þ¨\else\ifx\@let@token.\let\next\quant@dotŽ¡‘=þ¨\else\ifx=\@let@token\let\next\@@quant@noteŽ¡‘=þ¨\else\def\next{\@@quant@note\@let@token}%Ž¡‘=þ¨\fi\fi\fi\fi\next}ŽŸ€‘'ïsrc:280mainloop.tex¹In–cØthe“case“of“a“`bare'“note“(no“moSŽdi ers),‘‚$none“of“the“tests“carried“out“b¬ryŽ¦‘'Ï\@quant@note–‚°¹will“succeed.‘ùThe“tokš¬ren“next“to“the“note“(that“w˜as“read“b˜yŽ¦‘'Ï\quant@note¹)–Úhas“to“bSŽe“returned“to“the“input“string|whicš¬rh“is“done“b˜y“theŽ¦‘'`default'‘ê¨Ï\let\next\@let@token¹.Ž¦‘;ïsrc:282mainloop.texIf–BCthe“next“tokš¬ren“w˜as“actually“one“of“our“moSŽdi ers,›X*Ï-“¹or“Ï+¹,˜they“shouldŽ¦‘'bSŽe–5gobbled“(for,›‡›in“this“stage,˜they“are“ignored).‘ ôNo¬rw,˜since“there“migh¬rtŽ¦‘'bšSŽe–íaÑtwo‘©w¹(or“more)“of“those“mo˜di ers,‘nthe“whole“test“has“to“b˜egin“again:Ž¦‘'Ï\let\next\quant@note¹.‘ØÃThis–ôis“also“the“case“with“another“moSŽdi er“thatŽ¦‘'doSŽesn't–€®a ect“quan¬rtization,‘æ/namely“Ï=“¹(that“puts“a“`tie'“to“the“note“as“inŽŸc‘'ó3Bç– mainloop4ÞŽ‘LÄŽ‘hj^Ž‘hj^¹).ŽŸÇ‘;ïsrc:284mainloop.texTh¬rus–îäthe“note“is“strippšSŽed“of“all“mo˜di ers“(ignore“the“dot“for“the“momen¬rt).Ž¡‘'And–'Ñthen‘ ?¹an“executiv¬re“function|one“that“Ñdo‘ÿffes‘%l¹something|is“called,‘N”namelyŽ¡‘'Ï\@@quant@note¹.‘ü¬(This–+ìhappšSŽens“also“when“the“note“had“no“mo˜di ers“in“theŽ¡‘' rst–TXplace.)‘ uñWhat“this“executiv¬re“function“doSŽes“is“to“add“`Ï\@note¹'“to“theŽ¡‘'tokš¬ren–ê¨register“in“whic˜h“the“quan˜tization“tok˜ens“are“stored:ŽŸ™š‘'ïsrc:288mainloop.texÃ\def\@@quant@note{%Ž¡‘=þ¨\global\quant@toks\expandafter{\the\quant@toks\@note}}ŽŸ€‘'ïsrc:291mainloop.tex¹Later,‘£Hwhen–~[these“quanš¬rtization“tok˜ens“are“read,‘£Hit“is“Ï\@note“¹that“adds“theŽ¦‘'relev‘ÿXäan•¬rt›ê¨en“try˜to˜the˜matrix.Ž¡‘;ïsrc:293mainloop.texA‘É{mošSŽdi er–Ƀthat“do˜es“ha•¬rv“e–Ƀan“impact“on“the“ rst“stage,‘Ð$b˜ecause“unlik¬re“Ï+Ž¡‘'¹and–°¤Ï-“¹it“has“a“rhš¬rythmic“consequence,‘¼>is“the“dot.‘%‰The“dot“mak˜es“a“note“`dot-Ž¡‘'ted':‘[Æa–üquarter-note“that“has“a“dot“after“it“bSŽecomes“a“`dotted-quarter-note'.Ž¡‘'In–`€m¬rusic,‘}öa“dot“means“that“the“note“lasts“half“as“long“again.‘šiThe“ultimateŽ¡‘'expansion–]of“a“dot“at“this“stage“is“`Ï\quant@@dot\@note\quant@@undot¹'.‘ìButŽ¡‘'not–ø(bSŽefore“a“test“to“see“if“the“note“is,›ûˆin“addition,˜tied“(or,˜pSŽossibly“but“stillŽ¡‘'not–ê¨completely“implemen¬rted,“double-dotted):ŽŽŸ’ç9ŽŽŒ‹ W x€ ý¤€ =€ ý瀑'ïsrc:303mainloop.texÃ\def\@quant@dot{\let\next\@let@tokenŽ¤ ™š‘=þ¨\ifx\@let@token.\let\next\@quant@dot‘-ýP%–¿ªNot“sure“it“worksŽ¡‘=þ¨\else\ifx=\@let@token\let\next\@@quant@dotŽ¡‘=þ¨\else\def\next{\@@quant@dot\@let@token}%Ž¡‘=þ¨\fi\fi\next}Ž¡‘'\def\@@quant@dot{\global\quant@toks\expandafter{%Ž¡‘=þ¨\the\quant@toks\quant@@dot\@note\quant@@undot}}ŽŸ$€‘'ïsrc:307mainloop.tex¹Something–‘similar“takš¬res“place“at“the“second“stage:‘…Écon˜v˜ersion“of“the“inputŽ¤€‘'inš¬rto– –commands“for“the“auxiliary“ les.‘Z«The“ultimate“expansion“of“an˜y“noteŽ¡‘'at–Ñthis“stage“is“an“Ï\@add@note“¹command“(whic¬rh“is“the“one“that“adds“a“noteŽ¡‘'to–…the“auxiliary“ les,‘«°as“describšSŽed“ab˜o•¬rv“e).‘%But,–«°again,“this–…do˜esn't“happ˜enŽ¡‘'immediately‘ÿV.Ž¤ ™š‘;ïsrc:309mainloop.texWhat–Éa“note“(letters“ÏA¹,“ÏB¹,“.–õT.“.“,‘ÏÉÏG¹)‘É in–Éthe“input“doSŽes“is“to“set“Ï\@pitch“¹(toŽ¡‘'the–‹ÄcorrespSŽonding“letter,–´ Ïa¹,“Ïb¹,“etc.)‘3and–‹ÄÏ\@octave“¹(according“to“the“rangeŽ¡‘'de ned–a bš¬ry“Ï\rangefrom¹).‘ œ After“that,‘¾¥it“launc˜hes“Ï\@@octave¹.‘ œ This“is“theŽ¡‘'function–ê¨where“tests“for“mošSŽdi ers“happ˜en:ŽŸ™š‘'ïsrc:328mainloop.texÃ\def\@@octave#1{\let\next\@@octaveŽ¡‘=þ¨\ifx#1-\advance\@octave-1\else\ifx#1+\advance\@octave1\relaxŽ¡‘=þ¨\elseŽ¡‘TýP\if@tempswa\elseŽ¡‘kûø\@add@note{\@pitch}{\the\@octave}\@tempswatrue\fiŽ¡‘kûø\ifx=#1Ž¡’‚ú \add@tie{\expandafter\@pitch\the\@octave}%Ž¡’‚ú \let\next\relaxŽ¡‘kûø\elseŽ¡’‚ú \ifx#1.\add@dot{\@pitch}{\the\@octave}%Ž¡’‚ú \else\let\next#1%Ž¡’‚ú \fiŽ¡‘kûø\fiŽ¡‘TýP\fiŽ¡‘=þ¨\fiŽ¡‘=þ¨\next}ŽŸ€‘'ïsrc:331mainloop.tex¹So,›$if–™a“note“is“bare,˜Ï\next“¹will“bSŽe“set“to“whatevš¬rer“the“next“tok˜en“is.‘´If“theŽ¤€‘'note,›Èon–Ýõthe“other“hand,˜has“Ï-“¹or“Ï+¹,˜Ï\@octave“¹is“c¬rhanged“and“Ï\@@octaveŽ¡‘'¹tried–Ïkagain,‘ÔÞto“see“if“there's“more“mošSŽdi ers.‘/Ì(It“is“b˜ecause“of“this“double“tryŽ¡‘'that–>5Ï\@tempswa“¹is“used.)‘3ˆF‘ÿVor“all“other“moSŽdi ers,›S`Ï.¹'“and“`Ï=¹',˜the“note“itselfŽŽŸ’ä 10ŽŽŒ‹ bÁ x€ ý¤€ =€ ý瀑'¹(its–}Dpitcš¬rh“and“its“oSŽcta˜v˜e)“is“set,‘“%and“only“additional“commands“(Ï\add@tie“¹orŽ¤€‘'Ï\add@dot¹)–ê¨are“executed.Ž¡‘;ïsrc:333mainloop.texSo,–ð|ev¬rery›±ònote,“b•SŽe˜it˜simple˜as˜`ÏC¹'‘±¢or˜comp“ound˜as˜`ÏD++.=¹'˜(a˜Ðd˜¹t•¬rw“o˜oSŽcta“v“esŽ¡‘'higher–Ò than“set“b¬ry“Ï\rangefrom¹,– (dotted,“and›Ò tied),“gets˜translated˜in¬rto˜a˜seriesŽ¡‘'of–óºcommands,‘õþthat“alw•¬ra“ys–óºincludes“Ï\@add@note“¹and“can“in“addition“includeŽ¡‘'Ï\add@tie–Dl¹or“Ï\add@dot¹.‘ F+This“commands“are“executiv¬re:‘ìgthey“write“in“theŽ¡‘'auxiliary–ê¨ le“of“an“instrumen¬rt.Ž©×Å‘'ïsrc:335mainloop.texRests,‘WÌinput–Åbš¬ry“`ÏR¹',“are“v˜ery“similar,‘WÌbut“they“cannot“bSŽe“tied“(no“test“forŽ¡‘'`Ï=¹')–0·and“their“mošSŽdi ers“Ï+“¹and“Ï-“¹do“not“mean“c¬rhange“in“o˜cta•¬rv“e,‘B:but‘0·v“erticalŽ¡‘'shifting.‘ òEThey›}Êuse,–â’then,“functions˜Ï\@@rest˜¹and˜Ï\@@@rest¹,“to˜bSŽe˜ nallyŽ¡‘'con•¬rv“erted›ê¨in“to˜Ï\@note˜¹in˜quan“tization˜and˜Ï\@rest˜¹in˜auxiliary˜ les.Ž¡‘;ïsrc:337mainloop.texBut–EBbSŽeaming“acts“di erenš¬rtly‘ÿV.‘H®Ï[“¹and“Ï]“¹ha˜v˜e“no“meaning“in“quan˜tizationŽ¡‘'(and–^ in“the“ rst“stage“they“are“Ï\relax¹),‘z;but“the“auxiliary“ les“ha•¬rv“e–^ to“re ectŽ¡‘'them.‘æïThey‘ÿV,›&ho•¬rw“ev“er,˜cannot›ôÕha“v“e˜moSŽdi ers,‘&so˜their˜function˜is˜immediatelyŽ¡‘'executiv¬re.‘ØÌ`Ï[¹'–ÊkopšSŽens“a“b˜eam“b¬ry“writing“(in“the“auxiliary“ le)“Ï\open@beam¹,‘andŽ¡‘'making–¦´all“folloš¬rwing“notes“part“of“that“bSŽeam|whic˜h“amoun˜ts“to“c˜hangingŽ¡‘'their–€SØrhythmic“notation¹.‘ ùâ`Ï]¹'“closes“the“bSŽeam“b¬ry“adding“Ï\close@beam“¹andŽ¡‘'setting–ê¨the“Ørhythmic“notation“¹bacš¬rk“to“the“note's“natural“w˜a˜y‘ÿV.Ž¡‘;ïsrc:339mainloop.texWhat›ô Ñis¹,–öfthough,“this˜`natural'˜w•¬ra“y?‘UIt˜depSŽends˜on˜the˜(rh“ythmic)˜kindŽ¡‘'of–Ïnote.›æ5It“is“set“b¬ry“the“Ñnumb‘ÿffers‘Ì÷¹in“the“input.˜A‘Îß`Ï4¹',›6for“example,˜meansŽ¡‘'`eighš¬rth-note',‘ and–ÔVwill“set“bSŽoth“duration“(for“quan˜tization“purpšSŽoses)“to“b˜e“32ÓqŽ¡‘'¹and–7&Ørhythmic“notation“¹to“bSŽe“`a“stem,›JEand“a“ ag,˜please'“(Ï\@stem\@flag¹).‘ZAŽ¡‘'`Ï5¹'–ó}means“quarter“note,‘$ìand“mak¬res“the“duration“64Óq‘a¶¹and“the“Ørhythmic“notationŽ¡‘'¹only–(Ÿa“Ï\@flag¹.‘ø2These“are“`global“declarations',‘Oma ecting“an¬rything“that“comesŽ¡‘'after–ê¨them“unš¬rtil“another,“o˜v˜erriding“one“is“encoun˜tered.Ž¡‘;ïsrc:341mainloop.texAnd›ê¨n•¬rum“bSŽers˜set˜also,˜of˜course,˜the˜Øvalue˜¹of˜a˜note.Ž¦‘'ïsrc:344mainloop.texThere–›*is“something“else“abSŽout“the“input.‘JeAn¬ry“Ñsp–ÿffac“es‘™¹in–›*the“input“will“notŽ¡‘'b•SŽe›.At¬ryp“ed˜in•¬rto˜the˜actual˜m“usic:‘Àthe˜m“usic˜is˜t“ypSŽed˜mec“hanically˜b“y˜T‘þ ‘Ÿ0ÎEŽ‘‘!X˜atŽ¡‘'Ï\@compose¹,‘ Ñand–î[it“doSŽes“not“include“spaces.‘äÆBut“the“input|spaces“and“all|ÑisŽ¡‘'¹read,–Y and›Böt¬rwice,“at˜Ï\@quantization˜¹and˜Ï\mf@files¹.‘AËThe˜spaces˜there˜Ñwil‘™™lŽ¡‘'¹create–™spaces“that“disturb“the“ nal“la•¬ry“out–™(unless“the“m¬rusic“is“the“ rst“thingŽ¡‘'that–*¹appšSŽears“in“the“line,‘:½and“then“the“spaces“are“ignored“b˜ecause“T‘þ ‘Ÿ0ÎEŽ‘‘!X“is“inŽ¡‘'v¬rertical‘ê¨moSŽde).Ž¤ ™š‘;ïsrc:346mainloop.texSo,‘¡ƒthe–:spaces“ha•¬rv“e–:to“bšSŽe“stripp˜ed“o “from“the“input.‘fThis“is“carried“outŽ¡‘'just–ê¨bSŽefore“starting“the“Ï\@quantization¹:ŽŸB‘'ïsrc:362mainloop.texÃ\def\strip@spaces#1{%ŽŽŸ’ä ¹11ŽŽŒ‹ k x€ ý¤€ =€ ý瀑=þ¨Ã\@temptoks#1%Ž¤ ™š‘=þ¨\@temptoks\expandafter{\the\@temptoks{\relax}‘¿ª}%Ž¡‘=þ¨\quant@toks{}%Ž¡‘=þ¨\@tempswatrueŽ¡‘=þ¨\loop\if@tempswaŽ¡‘TýP\expandafter\strip@@spaces\the\@temptoks{\relax}‘¿ª\@nilŽ¡‘=þ¨\repeatŽ¡‘=þ¨#1\quant@toks}Ž¡‘'\def\strip@@spaces#1‘¿ª#2#3\@nil{\quant@toks\expandafter{%Ž¡‘TýP\the\quant@toks#1}%Ž¡‘=þ¨\ifx#2\relax\@tempswafalse\fiŽ¡‘=þ¨\@temptoks{#2#3}}ŽŸ€‘'ïsrc:364mainloop.tex¹Command–|%Ï\strip@spaces“¹is“in•¬rv“ok“ed›|%b“y˜Ï\@quantization¹,‘’?and˜its˜argumen“tŽ¤€‘'is–ætthe“tokš¬ren“register“where“the“input“is“stored.‘â$Tw˜o“tempSŽorary“tok˜en“registersŽ¡‘'are–£¶used,›±æÏ\@temptoks“¹and“Ï\quant@toks¹,˜to“get“pSŽortions“of“the“input“streamŽ¡‘'separated–äÍbš¬ry“spaces.‘6ìA˜t“the“end,‘åùbSŽecause“of“the“w˜a˜y“Ï\stripped@@spaces“¹isŽ¡‘'executed,›.Git–ÿ/will“ nd“Ï#2“¹to“bSŽe“Ï\relax¹,˜and“call“the“whole“opSŽeration“o .‘êbThen,Ž¡‘'whatev•¬rer›™×w“as˜left˜in˜Ï\quant@toks˜¹will˜bSŽe˜put˜bac“k˜in“to˜the˜original˜register.Ž¡‘'(Ï\quant@toks¹,›ìon–«the“other“hand,˜is“a“register“de ned“for“other“purpSŽoses|Ž¡‘'quan¬rtization|but–½Ãit“can“bšSŽe“used“here“b˜ecause“what“it“had“b˜efore,‘ùñif“an¬rything,Ž¡‘'is–ê¨of“no“inš¬rterest“an˜ymore.‘8àTh˜us“a“tok˜en“register“is“sa˜v˜ed.)ŽŸ(V‘'ÝMeasures,–záblo‘Š=c‘ÿuÂks,“and“automationŽŸb#‘'ïsrc:367mainloop.tex¹A‘¦¾piece–§0of“mš¬rusic“is“usually“wider“than“a“sheet“of“papSŽer:‘±ñit“will“ha˜v˜e“toŽ¡‘'bSŽe–@íbrokš¬ren“in˜to“lines“(whic˜h,–V~inciden˜tally‘ÿV,“are–@ícalled“`systems').‘;®This“cannotŽ¡‘'happšSŽen–¹Ôan¬rywhere,‘-Ÿbut“at“sp˜ecial“p˜oin¬rts:‘×8usually“at“the“end“of“measuresŽ¡‘'(or‘E<`bars').‘HSometimes,›[áho•¬rw“ev“er,˜for›E\current@quantumŽ¡‘=þ¨\else\current@quantum0\relaxŽ¡‘=þ¨\fiŽ¡‘=þ¨\ifnum\current@quantum=0\relaxŽ¡‘TýP\end@blockŽ¡‘=þ¨\fi}Ž©€‘'ïsrc:430mainloop.tex¹F‘ÿVor–$the“ rst“time,‘XCit“is“Ñnot‘3h¹true“that“Ï\block@period>\current@quantum¹.Ž¤€‘'So,‘m6the–Sactual“con•¬rten“ts–Sof“Ï\open@beam“¹will“bSŽe“executed“(for“the“ rst“time).Ž¡‘'It–¶‡ rst“resets“Ï\current@quantum“¹to“0.‘ œ}And“next,‘)it“will“ nd|curiouslyŽ¡‘'enough|that–NŽÏ\current@quantum=0¹,‘mÆand“therefore“will“execute“Ï\end@block¹.Ž¡‘'(This–•Êis“not“the“same“test“bSŽecause“the“user“can“Ñfor–ÿffc“e‘{z¹the–•Êend“of“a“measure|Ž¡‘'makš¬re– IÏ\current@quantum“¹0|at“an˜y“pSŽoin˜t,‘T±and“this“will“ha˜v˜e“the“e ect“ofŽ¡‘'making–ê¨true“the“second“test“ev¬ren“when“the“ rst“one“is“not.)Ž¤ ™š‘;ïsrc:432mainloop.texSo,‘ê¨Ï\end@block¹:ŽŸ™š‘'ïsrc:445mainloop.texÃ\def\end@block{%Ž¡‘=þ¨\ifblock@done\elseŽ¡‘TýP\immediate\write\instrument@file{%Ž¡‘kûø\current@block\string\end@of@block}%Ž¡‘TýP\immediate\write\instrument@file\expandafter{%Ž¡‘kûø\the\this@note\string\@bar@line{\@barline}}%Ž¡‘TýP\def\current@block{\@gobble}%Ž¡‘TýP\this@note\@plainnoteŽ¡‘TýP\let\@barline\barline@defaultŽ¡‘=þ¨\fiŽ¡‘=þ¨\block@donetrue}Ž¦‘'Ï\block@done–¦Ë¹has“bSŽeen“set“to“Ðf‘þîïalse“¹bš¬ry“the“last“Ï\@add@note¹,‘´^so“the“con˜ten˜tsŽ¤€‘'of–ñpthis“function“is“actually“executed.‘M8It“is“here“that“the“whole“line,‘ó"with“theŽ¡‘'elemenš¬rts–‚of“all“the“notes“in“the“bloSŽc˜k,‘&xis“written“to“the“auxiliary“ le.‘ÈmThen,Ž¡‘'another–§wline“is“written“to“the“same“ le,›Ö«with“a“barline,˜and“an¬ry“additionalŽ¡‘'stu – that“mighš¬rt“apply“to“it:‘£ÄÏ\this@note¹.‘ Y6(Remem˜bSŽer“that“Ï\this@noteŽ¡‘'¹w•¬rould›ö–ha“v“e˜also˜bSŽeen˜added˜to˜a˜note.‘\©This˜is˜ho“w˜a˜clef|but˜not˜otherŽ¡‘'things–«that“cannot“apply“to“barlines,‘ llik¬re“a“tie|is“correctly“added“either“toŽ¡‘'the–ê¨next“note“or“to“the“barline“if“it“comes“ rst.)Ž¤ ™š‘;ïsrc:449mainloop.texSo,‘XÇwhen–the“ rst“note“of“a“new“bloSŽcš¬rk“is“reac˜hed,‘XÇthe“previous“one“isŽ¡‘'closed–Æñb¬ry“Ï\end@block¹.‘ͺBut“not“only“a“note“can“opšSŽen“a“new“blo˜c¬rk:‘ñqa“restŽ¡‘'can›•½toSŽo,–À‚and,“less˜obš¬rviously‘ÿV,“an˜ything–•½that“attac˜hes“to“a“coming“note“(i.e.,ŽŽŸ’ä 15ŽŽŒ‹šï x€ ý¤€ =€ ý瀑'¹that–“Ýimplies“the“existence“of“a“note“coming“soSŽon).‘òA‘“Çclef,›¥9for“example,˜is“ÑnotŽ¤ ™š‘'¹suc¬rh–2ÿa“thing,‘WºbšSŽecause“it“can“b˜e“put“b˜ehind“a“barline,‘Wºnot“necessarily“b˜ehind“aŽ¡‘'note.‘»But–H9an“accidenš¬rtal“m˜ust“necessarily“refer“to“a“note,‘h¶as“m˜ust“the“opSŽeningŽ¡‘'of–Ë"a“bSŽeam.‘.^So,‘ÑpÏ\open@block“¹(that“calls“for“Ï\end@block“¹if“necessary)“is“partŽ¡‘'of–©the“de nition“of“rests,›ªb•SŽeam-op“enings,˜and–©accidenš¬rtals“(as“w˜ell“as“notes).Ž¡‘'Ï\@@@rest¹,–…Òin›fÊfact,“bSŽeha•¬rv“es˜v“ery˜similar˜to˜Ï\@add@note¹.‘­EAs˜for˜acciden“tals,Ž¡‘'all– they“do“is“to“execute“Ï\open@block“¹and“then“add“the“respSŽectiv¬re“items“toŽ¡‘'Øaditional‘ê¨stu ‘Ðã¹:ŽŸ™š‘'ïsrc:458mainloop.texÃ\def\#{\open@blockŽ¡‘=þ¨\this@note\expandafter{\the\this@note\string\@sharp}}%Ž¡‘'\def\b{\open@blockŽ¡‘=þ¨\this@note\expandafter{\the\this@note\string\@flat}}%Ž¡‘'\def\n{\open@blockŽ¡‘=þ¨\this@note\expandafter{\the\this@note\string\@natural}}%ŽŸ€‘'ïsrc:461mainloop.tex¹On–x²the“other“hand,‘Ü5Ï\@open@beam“¹can“actually“bSŽe“the“function“that“addsŽ¤€‘'the–)GÏ\next@note“¹(instead“of“Ï\@add@note¹).Ÿû¥2Æ1ŽŽ‘ ´À¹The“test“Ï\written@false“¹helpsŽ¡‘'a•¬rv“oiding–1ethe“duplication“of“Ï\next@note¹'s“that“w¬rould“bSŽe“implied“in“the“suc-Ž¡‘'cession–yof“Ï\@open@beam“¹and“Ï\@add@note¹.‘¼RApart“from“that,‘!mÏ\@open@beam“¹isŽ¡‘'straigh•¬rtforw“ard:ŽŸ™š‘'ïsrc:471mainloop.texÃ\def\@open@beam{%Ž¤ ™š‘=þ¨\open@blockŽ¡‘=þ¨\edef\current@block{\current@block\spaceŽ¡‘TýP\string\next@note\string\open@beam}%Ž¡‘=þ¨\def\rhythm@not{\string\add@tobeam}%Ž¡‘=þ¨\not@writtenfalse}%ŽŸ'€‘'ïsrc:475mainloop.tex¹Going–4AbloSŽcš¬rk“b˜y“bloSŽc˜k“has“a“consequence“on“the“quan˜tization“toSŽo.‘üThe“matrixŽ¤€‘'needs–/Òto“ha•¬rv“e›/Òen“tries˜for˜the˜ends˜of˜the˜bloSŽc“ks,‘U0so˜that˜the˜program˜later˜canŽ¡‘'kno•¬rw›Љho“w˜long˜the˜last˜note˜of˜the˜bloSŽc“k˜w“as.‘0+If˜the˜matrix˜w“ere˜directly˜toŽ¡‘'0,‘›Ýthe–ˆ*last“note“wš¬rould“ha˜v˜e“a“negativ˜e“quan˜tum“v‘ÿXäalue.‘ (And“it“is“not“enoughŽ¡‘'to–@£assume“Ï\block@period“¹as“the“end“of“the“blo•SŽc¬rk,‘b¤b“ecause–@£the“user“can“forceŽ¡‘'an–)³end-of-bloSŽcš¬rk“at“an˜y“pSŽoin˜t.)‘öSo,‘9uthe“quan˜tization“has“to“bSŽe“able“to“insertŽ¡‘'this–ê¨en¬rtry“automatically‘ÿV.Ž‘'Ÿ ˆ‡‰ff›ÿdŸ ‘ ƒŸü^ÿóÙ“ Rcmr7±1ŽŽŽ‘óKñ`y cmr10²Maš¸ãybGe–h®this“is“a“remnan˜t“from“another“time.‘«ÓI‘h©can't“see“no˜w“wh˜y“this“function“is“notŽ¤ implemenš¸ãted–±£as“the“acciden˜tals,‘ȶb˜y“simply“adding‘Õ0ó7ßê logo10ãMETÇAFŽ9ONT‘y²program“that“willŽ¤ relief–õGthis“problem“considerably‘ÿ*ª.‘QBut“it“is“a“ma‘Ž8jor“cš¸ãhange,‘Cand“will“tak˜e“some“time.‘QInŽ¡part,‘„ëthat–{fis“whš¸ãy“I‘{\am“not“doGcumen˜ting“the“ãMETÇAFŽ9ONT‘´I²program:‘½êit“will“soGon“c˜hange“inŽ¡unpredictable‘UUw•¸ãa“ys.ŽŽŸ’ä ¹17ŽŽŒ‹¯– x€ ý¤€ =€ þ$¾G‘'ä>Ž‘Mè?Ž‘[·¥@Ž‘j\bAŽ‘x¾ŠBŽ’‡¥ÛCŽ’–J˜DŽ’¤ïUEŽ’³”FŽ’»$"GŽ’ÉÈßHŽ’ØmœIŽ’çYJŽ’ñê_KŽ’[ÒLŽ’MŽ’!¥LNŽ’0J OŽ’7ÚPŽ’F~ÖQŽ’U#“RŽ’cÈPSŽ’rm TŽ’ÊUŽ’¶‡VŽ’ž[DWŽ’­XŽŽŸXß6‘'YŽ‘JŠÌZŽ‘YIu[Ž‘h\Ž‘vÆÇ]Ž’……p^Ž’”D_Ž’£Â`Ž’±ÁkaŽ’µž·bŽ’È*cŽ’Öè¿dŽ’å§heŽ’ôffŽ’$ºgŽ’ãchŽ’ ¢ iŽ’/`µjŽ’7 ·kŽ’EÉ`lŽ’Tˆ mŽ’cF²nŽ’r[oŽ’€ÄpŽ’‚­qŽ’žAVrŽ’¬ÿÿsŽŽŸ_ÂU‘'tŽ‘HÝŽuŽ‘UîùvŽ‘ddwŽ‘q)ÏxŽ’ƒpyŽ’‘X·zŽ’—Ul{Ž’£d¿(t•²!ypMÞeset›¦fb“y˜T‘þ,³Ÿÿ»EŽ‘B X‘þápÁm‘ÿp¸use¿)ŽŸq¸‘'ïsrc:536mainloop.texÃ\newinstrument\righthandŽ¤ ™š‘'\newinstrument[\bassclef]\lefthandŽ¡‘'\begin{texmuse}Ž¡‘'\meter44ŽŸuùù‘'ïsrc:537mainloop.texŸš›ºïsrc:555mainloop.tex\righthand{\rangefrom{G4}Ž¡‘þ¨5C–¿ª4[EC]“5“GGŽ¡‘þ¨5C–¿ª4[EC]“5“GG+Ž¡‘þ¨4[FEDC]‘¿ª[BCBC]Ž¡‘þ¨[DCBA]–¿ª5“G“RŽ¡‘þ¨5C–¿ª4[EC]“5“GGŽ¡‘þ¨5E–¿ª4[G+E]“5C“4[EC]Ž¡‘þ¨[DBCA]‘¿ª[BGA\#F-]Ž¡‘þ¨[GABC]‘¿ª[DE\#FG+]Ž¡‘þ¨5AA+A+A+Ž¡‘þ¨4[BCDE]‘¿ª[\#FG+A+B+]Ž¡‘þ¨5CC+C+C+Ž¡‘þ¨4[D\rangefrom{D5}GBD+]‘¿ª[CBAG]Ž¡‘þ¨[\#FEGF]‘¿ª[AGFE]Ž¡‘þ¨[EDC-B-]‘¿ª[DC-B-A-]Ž¡‘þ¨5G-R6R|}ŽŽ’ÖMŸlg®„ØÏ\ffŽŸš›º’êœïsrc:575mainloop.tex\lefthand{\rangefrom{C3}Ž¡’ÿD5CR6RŽ¡’ÿD5CR6RŽ¡’ÿD5CRCRŽ¡’ÿDG-R‘¿ª4[GFED]Ž¡’ÿD5CRRRŽ¡’ÿD5C+RR\#FŽ¡’ÿDGCDD-Ž¡’ÿDG-R6RŽ¡’ÿD4[\#FD+AD+]‘¿ª[\#FD+AD+]Ž¡’ÿD5GRRRŽ¡’ÿD4[AD+C+D+]‘¿ª[AD+C+D+]Ž¡’ÿD5BR6RŽ¡’ÿD5C+RCRŽ¡’ÿDDRD-RŽ¡’ÿD4[G-B-DG]‘¿ª5G-R|}ŽŽŽŽŸ’ä ¹18ŽŽŒ‹ºb x€ ý¤€ =€ ý瀑'ïsrc:580mainloop.texÃ\end{texmuse}ŽŸ ™š‘'\noindent\music{righthand,lefthand}\quad(typeset–¿ªby“\TeXmuse)ŽŸ(V‘'ÝConclusionŽŸb#‘'ïsrc:585mainloop.tex¹This–¶{explains“the“basic“w¬rorking“of“T‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse¹.‘'|There“is“quite“a“bit“more“to“it,Ž¤€‘'but–!¼ev¬rerything“should“bšSŽe“easily“understo˜o˜d,‘Iìb¬ry“just“lo˜oking“at“the“co˜de,‘IìafterŽ¡‘'this–àösummary“explanation.‘ÊI‘à·wš¬rould“lik˜e“to“claim“that“with“this“doSŽcumen˜tŽ¡‘'and–38the“actual“examples“of“the“v‘ÿXäarious“functions“already“coSŽded,‘…\an¬rythingŽ¡‘'could–)bSŽe“implemenš¬rted“b˜y“the“industrious“user.‘‚dThat“is“probably“true“of“theŽ¡‘'T‘þ ‘Ÿ0ÎEŽ›‘!X–¶part“of“T‘þ ‘Ÿ0ÎEŽ˜X‘þÌÈÑm‘ÿfduse¹.‘›+T‘ÿVo“add“another“pSŽossibilitš¬ry“to“the“users'“input,‘èòy˜ouŽ¡‘'ha•¬rv“e–VÅto“think“in“terms“of“the“four“stages:‘îï gure“out“what“the“addition“meansŽ¡‘'separately–9nfor“quan¬rtization,›M auxiliary“ les,˜writing“of‘¦ÚMET»»AF‘ÿwwONT‘}²¹ les,˜andŽ¡‘'compSŽosition–Ldof“the“text.‘^In“the“currenš¬rt“Ïtexmuse.tex“¹there“is“preceden˜ts“ofŽ¡‘'virtually–Ùevš¬rerything:‘Éthings“that“attac˜h“to“notes,‘¹things“that“group“notes,Ž¡‘'things–Ócthat“apply“to“this“note“and“the“next,‘ ’things“that“apply“pSŽossibly“toŽ¡‘'barlines,‘ê¨etc.Ž¡‘;ïsrc:587mainloop.texBut,–-ªof›þjcourse,“an•¬ry˜new˜thing˜will˜ha“v“e˜to˜bSŽe˜implemen“ted˜in˜ÚMET»»AF‘ÿwwONTŽ¡‘'¹toSŽo|and–|for“that“I‘{÷ha•¬rv“e›|pro“vided˜no˜guide.‘í>As˜I‘{÷ha“v“e˜men“tioned,‘ zthere˜isŽ¡‘'a–}¯ma‘§jor“c¬rhange“to“the“ÚMET»»AF‘ÿwwONT‘Áó¹system“coming“soSŽon,‘¢qso“a“thorough“ex-Ž¡‘'planation–{hdid“not“seem“w•¬rorth“while.‘ë!In›{han“y˜case,‘Ÿ˜the˜log˜ les˜of˜T‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse¹'sŽ¡‘'dev•¬relopmen“t,‘Éßif›:an“y“one˜feels˜lik“e˜reading˜suc“h˜disorganized˜streams˜of˜con-Ž¡‘'sciousness,‘è»rev¬real–è@what“goSŽes“on“in“T‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse¹'s“ÚMET»»AF‘ÿwwONT‘,„¹program.‘8In“fact,Ž¡‘'m¬ry–KexpšSŽerience“tells“me,‘ôit“is“more“imp˜ortanš¬rt,‘ôand“c˜hallenging,‘ôto“kno˜w“w˜ellŽ¡‘'enough–LºÚMETš»»AF‘ÿwwONT‘þ¹itself.‘;If“y¬rou“master“that,‘lPT‘þ ‘Ÿ0ÎEŽ‘‘!X‘þÌÈÑm‘ÿfduse¹'s“Ñuse‘2j¹of‘"òÚMET˜AF‘ÿwwONTŽ¡‘'¹should–ê¨bSŽe“a“piece“of“cak¬re.ŽŽŸ’ä 19ŽŽŒøÀ|ƒ’À;èx€­ó9 •£Ï mainloop6ó8ø”o> logo10ó7ßê logo10ó.-€Ýá mainloop3ó-‚ÎR6 cmss12ó,m#½R ó3 cmss10ó+ßê ó3 logo10óßê