| 1 |
% Extension for MusiXTeX - Guitar Tablatures |
| 2 |
% |
| 3 |
% This file contains some macros which extend MusiXTeX with some |
| 4 |
% common notations for guitar tablatures. It is recommended that |
| 5 |
% you use a 6-line system (assuming a 6-string guitar) and increase |
| 6 |
% the space between its staves, e.g.: |
| 7 |
% |
| 8 |
% \setlines16 |
| 9 |
% \setsize1\largevalue |
| 10 |
\makeatletter |
| 11 |
|
| 12 |
% Clef symbol that displays "TAB" vertically (looks best with |
| 13 |
% \smallmusicsize) |
| 14 |
\def\tabclefsymbolsmall{\vtop to .75\Interligne{% |
| 15 |
\vss% |
| 16 |
\hbox to 2.5\Interligne{\hss\tinytype\bf T}% |
| 17 |
\vskip -1\Interligne |
| 18 |
\hbox to 2.5\Interligne{\hss\tinytype\bf A}% |
| 19 |
\vskip -1\Interligne |
| 20 |
\hbox to 2.5\Interligne{\hss\tinytype\bf B}}} |
| 21 |
|
| 22 |
% Display guitar string numbers on staves |
| 23 |
% |
| 24 |
% Usage: \str{<string>}{<number>} |
| 25 |
% <string>: string number between 1 and 6 |
| 26 |
% <number>: any number (or other text) to put onto the string |
| 27 |
% (usually a fret number between 0 and 24) |
| 28 |
% |
| 29 |
% \str inserts horizontal space after the number (like other |
| 30 |
% MusiXTeX notes). To insert a non-spacing string note, use |
| 31 |
% \zstr. |
| 32 |
\def\strerr{\errmessage{str macro requires a string number from 1--6}} |
| 33 |
\def\zstr#1#2{% |
| 34 |
\ifcase#1\relax\strerr |
| 35 |
\or\def\@strnr{-1}% |
| 36 |
\or\def\@strnr{1}% |
| 37 |
\or\def\@strnr{3}% |
| 38 |
\or\def\@strnr{5}% |
| 39 |
\or\def\@strnr{7}% |
| 40 |
\or\def\@strnr{9}% |
| 41 |
\else\strerr |
| 42 |
\fi |
| 43 |
\cchar\@strnr{\tinytype\bf\roffset{.35}{#2}}} |
| 44 |
\def\str#1#2{\zstr{#1}{#2}\sk} |
| 45 |
|
| 46 |
% Insert a Palm Mute indicator (P.M.) starting at the current position. |
| 47 |
% |
| 48 |
% Usage: \palmmute{<pitch>}{<length>} |
| 49 |
% <pitch>: vertical level at which the palm mute is placed |
| 50 |
% <length>: length of the line in multiples of \noteskip |
| 51 |
% |
| 52 |
% This will insert a palm mute indicator looking similar to this: |
| 53 |
% P.M.-----------| |
| 54 |
% If <length> is sufficiently small, no line will be inserted, just |
| 55 |
% P.M. |
| 56 |
\newtoks\@pmstring |
| 57 |
\chardef\@pmlinechar=45 |
| 58 |
\chardef\@pmendchar=21 |
| 59 |
\newdimen\@pmboxminwd |
| 60 |
\@pmboxminwd=2.3em |
| 61 |
\def\palmmute{\check@staff |
| 62 |
\n@v\@pmlinechar \n@ii\@pmendchar\global\@pmstring={P.M.}\fi |
| 63 |
\@drawpm} |
| 64 |
\def\@drawpm#1#2{\check@staff |
| 65 |
\y@v#2\noteskip% |
| 66 |
\ifnum #2<2 |
| 67 |
\zcharnote{#1}{\loff{\hbox\@to\@pmboxminwd{% |
| 68 |
\@pminit}}}% |
| 69 |
\else |
| 70 |
\zcharnote{#1}{\loff{\hbox\@to\y@v{% |
| 71 |
\@pminit\xleaders\hbox{\char\n@v}\hfill\mxsps\char\n@ii}}}% |
| 72 |
\fi\fi} |
| 73 |
\def\@pminit{% |
| 74 |
\setbox\w@rkbox\hbox{\tinytype\the\@pmstring}% |
| 75 |
\box\w@rkbox} |
| 76 |
|
| 77 |
% Insert a Hammer On or Pull Off symbol. |
| 78 |
% |
| 79 |
% Usage: \hammeron{<pitch>}{<offset>} |
| 80 |
% \pulloff{<pitch>}{<offset>} |
| 81 |
% <pitch>: vertical level at which the symbol is placed |
| 82 |
% <offset>: horizontal offset from the current position |
| 83 |
% in note head widths |
| 84 |
% |
| 85 |
% \hammeron will insert an "H", while \pulloff will insert |
| 86 |
% a "P". |
| 87 |
\def\hammeron#1#2{% |
| 88 |
\ccharnote{#1}{\tinytype\roffset{#2}{H}}} |
| 89 |
\def\pulloff#1#2{% |
| 90 |
\ccharnote{#1}{\tinytype\roffset{#2}{P}}} |
| 91 |
|
| 92 |
% Insert a Natural Harmonics or Artifical Harmonics |
| 93 |
% indicator. |
| 94 |
% |
| 95 |
% Usage: \harmonics{<pitch>}{<offset>} |
| 96 |
% \aharmonics{<pitch>}{<offset>} |
| 97 |
% <pitch>: vertical level at which the symbol is placed |
| 98 |
% <offset>: horizontal offset from the current position |
| 99 |
% in note head widths |
| 100 |
% |
| 101 |
% \harmonics will insert "Harm.", while \aharmonics will |
| 102 |
% insert "A.H.". |
| 103 |
\def\harmonics#1#2{% |
| 104 |
\ccharnote{#1}{\tinytype\roffset{#2}{Harm.}}} |
| 105 |
\def\aharmonics#1#2{% |
| 106 |
\ccharnote{#1}{\tinytype\roffset{#2}{A.H.}}} |
| 107 |
|
| 108 |
% Insert a bend indicator at the current position. |
| 109 |
% |
| 110 |
% Usage: \bendhalf{<pitch>}{<textpitch>}{<offset>} |
| 111 |
% \bendfull{<pitch>}{<textpitch>}{<offset>} |
| 112 |
% <pitch>: vertical level at which the lower end of the |
| 113 |
% bend curve is placed |
| 114 |
% <textpitch>: vertical level at which the text is placed |
| 115 |
% <offset>: horizontal offset from the current position |
| 116 |
% in note head widths |
| 117 |
% |
| 118 |
% \bendhalf uses the text "1/2", while \bendfull uses the |
| 119 |
% text "Full". |
| 120 |
% |
| 121 |
% There are more commands like \Bendhalf, \Bendfull, and |
| 122 |
% \Bend, which allow full control over the curve parameters, |
| 123 |
% text etc. However, they should rarely be necessary. |
| 124 |
\newtoks\@bendslurid |
| 125 |
\newtoks\@bendstring |
| 126 |
\newtoks\@bendho |
| 127 |
\newtoks\@bendvo |
| 128 |
\newtoks\@bendht |
| 129 |
\newtoks\@bendvt |
| 130 |
\newtoks\@bendcur |
| 131 |
\newtoks\@bendang |
| 132 |
\@bendslurid={14} |
| 133 |
|
| 134 |
\def\@rstbendho{\global\@bendho={2}} |
| 135 |
\def\@rstbendvo{\global\@bendvo={2}} |
| 136 |
\def\@rstbendht{\global\@bendht={4}} |
| 137 |
\def\@rstbendvt{\global\@bendvt={6}} |
| 138 |
\def\@rstbendcur{\global\@bendcur={-.4}} |
| 139 |
\def\@rstbendang{\global\@bendang={.2}} |
| 140 |
\def\@rstbend{\@rstbendho\@rstbendvo\@rstbendht\@rstbendvt\@rstbendcur\@rstbendang} |
| 141 |
|
| 142 |
\def\@setbendstring#1{\global\@bendstring={#1}} |
| 143 |
\def\@setbendho#1{\global\@bendho={#1}} |
| 144 |
\def\@setbendvo#1{\global\@bendvo={#1}} |
| 145 |
\def\@setbendht#1{\global\@bendht={#1}} |
| 146 |
\def\@setbendvt#1{\global\@bendvt={#1}} |
| 147 |
\def\@setbendcur#1{\global\@bendcur={#1}} |
| 148 |
\def\@setbendang#1{\global\@bendang={#1}} |
| 149 |
|
| 150 |
\def\bendhalf{\check@staff |
| 151 |
\@rstbend\@setbendstring{1/2}\fi |
| 152 |
\@drawbend} |
| 153 |
\def\Bendhalf#1#2{\check@staff |
| 154 |
\@rstbend\@setbendstring{1/2}% |
| 155 |
\@setbendht{#1}\@setbendvt{#2}\fi |
| 156 |
\@drawbend} |
| 157 |
\def\bendfull{\check@staff |
| 158 |
\@rstbend\@setbendstring{Full}\fi |
| 159 |
\@drawbend} |
| 160 |
\def\Bendfull#1#2{\check@staff |
| 161 |
\@rstbend\@setbendstring{Full}% |
| 162 |
\@setbendht{#1}\@setbendvt{#2}\fi |
| 163 |
\@drawbend} |
| 164 |
\def\Bend#1#2#3#4#5#6#7{\check@staff |
| 165 |
\@rstbend\@setbendstring{#1}% |
| 166 |
\@setbendho{#2}\@setbendvo{#3}\@setbendht{#4}% |
| 167 |
\@setbendvt{#5}\@setbendcur{#6}\@setbendang{#7}\fi |
| 168 |
\@drawbend} |
| 169 |
\def\@drawbend#1#2#3{\check@staff |
| 170 |
\roffset{#3}{\iSlur{\the\@bendslurid}{#1}{\the\@bendvo}{\the\@bendho}% |
| 171 |
\tSlur{\the\@bendslurid}{#1}{\the\@bendvt}{\the\@bendht}{\the\@bendcur}{\the\@bendang}% |
| 172 |
\ccharnote{#2}{\tinytype\roffset{\the\@bendho}{\the\@bendstring}}}% |
| 173 |
\fi} |
| 174 |
|
| 175 |
% Insert a slide indicator at the current position. |
| 176 |
% |
| 177 |
% Usage: \gslide{<pitch>}{<length>}{<slope>} |
| 178 |
% \gslidet{<pitch>}{<length>}{<slope>}{<textpitch>}{<textoffset>} |
| 179 |
% \gSlide{<pitch>}{<voffset>}{<length>}{<slope>} |
| 180 |
% \gSlidet{<pitch>}{<voffset>}{<length>}{<slope>}{<textpitch>}{<textoffset>} |
| 181 |
% <pitch>: vertical level at which the beginning of the |
| 182 |
% line is placed |
| 183 |
% <voffset>: additional vertical offset (for fine-tuning |
| 184 |
% the line position) |
| 185 |
% <length>: length of the line (values smaller than 2 |
| 186 |
% may cause weird behavior) |
| 187 |
% <slope>: slope of the line (should be in [-20,20] range) |
| 188 |
% <textpitch>: vertical level at which the text is placed |
| 189 |
% <textoffset>: horizontal offset from the current position |
| 190 |
% in note head widths for the text |
| 191 |
% |
| 192 |
% These commands insert a straight line. The text versions |
| 193 |
% additionally insert the text "sl." in italics. |
| 194 |
\newtoks\@gslidestring |
| 195 |
\newtoks\@gslideho |
| 196 |
\newtoks\@gslidevp |
| 197 |
\newtoks\@gslidevo |
| 198 |
\newtoks\@gslidelen |
| 199 |
\newtoks\@gslideslp |
| 200 |
\newtoks\@gslidestrho |
| 201 |
\newtoks\@gslidestrvp |
| 202 |
|
| 203 |
\def\@rstgslideho{\global\@gslideho={1.5}} |
| 204 |
\def\@rstgslidevp{\global\@gslidevp={m}} |
| 205 |
\def\@rstgslidevo{\global\@gslidevo={0}} |
| 206 |
\def\@rstgslidelen{\global\@gslidelen={3}} |
| 207 |
\def\@rstgslideslp{\global\@gslideslp={-10}} |
| 208 |
\def\@rstgslidestrho{\global\@gslidestrho={1.8}} |
| 209 |
\def\@rstgslidestrvp{\global\@gslidestrvp={p}} |
| 210 |
\def\@rstgslide{\@rstgslideho\@rstgslidevp\@rstgslidevo\@rstgslidelen\@rstgslideslp\@rstgslidestrho\@rstgslidestrvp} |
| 211 |
|
| 212 |
\def\@setgslidestring#1{\global\@gslidestring={#1}} |
| 213 |
\def\@setgslideho#1{\global\@gslideho={#1}} |
| 214 |
\def\@setgslidevp#1{\global\@gslidevp={#1}} |
| 215 |
\def\@setgslidevo#1{\global\@gslidevo={#1}} |
| 216 |
\def\@setgslidelen#1{\global\@gslidelen={#1}} |
| 217 |
\def\@setgslideslp#1{\global\@gslideslp={#1}} |
| 218 |
\def\@setgslidestrho#1{\global\@gslidestrho={#1}} |
| 219 |
\def\@setgslidestrvp#1{\global\@gslidestrvp={#1}} |
| 220 |
|
| 221 |
\def\gslide#1#2#3{\check@staff |
| 222 |
\@rstgslide\@setgslidevp{#1}% |
| 223 |
\@setgslidelen{#2}\@setgslideslp{#3}\fi |
| 224 |
\@drawgslide} |
| 225 |
\def\gslidet#1#2#3#4#5{\check@staff |
| 226 |
\@rstgslide\@setgslidevp{#1}% |
| 227 |
\@setgslidelen{#2}\@setgslideslp{#3}% |
| 228 |
\@setgslidestrvp{#4}\@setgslidestrho{#5}\@setgslidestring{sl.}\fi |
| 229 |
\@drawgslide\@drawgslidestr} |
| 230 |
\def\gslideT#1#2#3#4#5#6{\check@staff |
| 231 |
\@rstgslide\@setgslidevp{#1}% |
| 232 |
\@setgslidelen{#2}\@setgslideslp{#3}% |
| 233 |
\@setgslidestrvp{#4}\@setgslidestrho{#5}\@setgslidestring{#6}\fi |
| 234 |
\@drawgslide\@drawgslidestr} |
| 235 |
\def\gSlide#1#2#3#4{\check@staff |
| 236 |
\@rstgslide\@setgslidevp{#1}\@setgslidevo{#2}% |
| 237 |
\@setgslidelen{#3}\@setgslideslp{#4}\fi |
| 238 |
\@drawgslide} |
| 239 |
\def\gSlidet#1#2#3#4#5#6{\check@staff |
| 240 |
\@rstgslide\@setgslidevp{#1}\@setgslidevo{#2}% |
| 241 |
\@setgslidelen{#3}\@setgslideslp{#4}% |
| 242 |
\@setgslidestrvp{#5}\@setgslidestrho{#6}\@setgslidestring{sl.}\fi |
| 243 |
\@drawgslide\@drawgslidestr} |
| 244 |
\def\gSlideT#1#2#3#4#5#6#7{\check@staff |
| 245 |
\@rstgslide\@setgslidevp{#1}\@setgslidevo{#2}% |
| 246 |
\@setgslidelen{#3}\@setgslideslp{#4}% |
| 247 |
\@setgslidestrvp{#5}\@setgslidestrho{#6}\@setgslidestring{#7}\fi |
| 248 |
\@drawgslide\@drawgslidestr} |
| 249 |
\def\@drawgslide{\check@staff |
| 250 |
\zcharnote{\the\@gslidevp}{\roffset{\the\@gslideho}{\varline{\the\@gslidevo}{\the\@gslidelen\qn@width}{\the\@gslideslp}}}% |
| 251 |
\fi} |
| 252 |
\def\@drawgslidestr{\check@staff |
| 253 |
\zcharnote{\the\@gslidestrvp}{\tinytype\it\roffset{\the\@gslidestrho}{\the\@gslidestring}}% |
| 254 |
\fi} |
| 255 |
|
| 256 |
\makeatother |