summaryrefslogtreecommitdiff
path: root/macros/musixtex/tex/musixmtab.tex
blob: 087395a2a9243bfdbbc564091e31c14b0aee5930 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
% musixmtab.tex : modern tablature definitions for MusiXTeX
%
% usage: 
%
%    \input musixtex
%    \input musixmtab
%    ...
%
%   musixmtab.tex is free software; you can redistribute it and/or modify
%   it under the terms of the GNU General Public License as published by
%   the Free Software Foundation; either version 2, or (at your option)
%   any later version.
%
%   musixmtab.tex is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%   GNU General Public License for more details.
%
%   You should have received a copy of the GNU General Public License
%   along with MusiXTeX; see the file COPYING.  If not, write to
%   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
%   Boston, MA 02111-1307, USA.
%
%   Copyright 2023  Bob Tennent rdtennent@gmail.com
%

\immediate\write16{musixmtab\space<2023/07/21>}
\ifx\undefined\startpiece\errmessage{Input musixtex.tex before musixmtab.tex}\fi

\makeatletter


% Assumption:  there is at most one beam and it is a lower beam

% like \downst@m but with quarter skip; used in \uq
\def\midst@m{\stem@skip\qd@skip
  \divide\stem@skip by 4
  \advance\st@bot-\stemfactor\interbeam
  \advance\st@bot-\altportee
  \ifx\st@mcut\empty
    \ifdim\st@bot<-\thr@@\internote
      \cutst@l\thr@@\cutst@l\f@ur\cutst@l\fiv@
      \cutst@l\si@\cutst@l\s@v@n\cutst@l\@ight \fi \fi
  \minst@bot\advance\st@bot\altportee
  \C@stem}


% a half note (boxed)
% argument 1 is the string number
% argument 2 is the note number
\def\uh#1#2{%
  \boxitsep=1pt%
  \setbox0=\hbox{\raise-0.25\internote\hbox{\boxit{\tabsmallfnt #2}}}%
  \stringraise\nblines%
  \advance\stringraise by -#1%
  \multiply\stringraise by 2%
  \advance\stringraise-1%
  \advancefalse\def\q@u{}\loffset{0.2}{\@nq{\the\stringraise}}%
  \special{ps: 1 setgray}%
  \zchar{\the\stringraise}{\vrule height \ht0 width \wd0 depth \dp0}%
  \special{ps: 0 setgray}%
  \zchar{\the\stringraise}{\box0}%
  \n@i\stringraise%
  \def\q@u{}\let\st@m\downst@m\let\n@sym\q@u%
  \y@v\qn@width\writ@note%
}

% a non-spacing stemless half note
% argument 1 is the string number
% argument 2 is the note number
\def\zuh#1#2{%
  \boxitsep=1pt%
  \setbox0=\hbox{\raise-0.25\internote\hbox{\boxit{\tabsmallfnt #2}}}%
  \stringraise\nblines%
  \advance\stringraise by -#1%
  \multiply\stringraise by 2%
  \advance\stringraise-1%
  \advancefalse\def\q@u{}\loffset{0.2}{\@nq{\the\stringraise}}%
  \special{ps: 1 setgray}%
  \zchar{\the\stringraise}{\vrule height \ht0 width \wd0 depth \dp0}%
  \special{ps: 0 setgray}%
  \zchar{\the\stringraise}{\box0}%
}

% a quarter note (with a centered stem)
% argument 1 is the string number
% argument 2 is the note number
\def\uq#1#2{%
  \zltab{#1}{#2}%
  \stringraise\nblines%
  \advance\stringraise by -#1%
  \multiply\stringraise by 2%
  \advance\stringraise-1%
  \n@i\stringraise%
  \def\q@u{}\let\st@m\midst@m\let\n@sym\q@u%
  \y@v\qn@width\writ@note%
}

% an eighth note (with a flag)
% argument 1 is the string number
% argument 2 is the note number
\def\uc#1#2{%
  \zltab{#1}{#2}%
  \stringraise\nblines%
  \advance\stringraise by -#1%
  \multiply\stringraise by 2%
  \n@i\stringraise%
  \def\q@u{}\n@vii\@xlv\let\st@m\down@flag%
  \let\n@sym\q@u\y@v\qn@width\writ@note%
}

% a non-spacing stemless quarter or eighth note 
% argument 1 is the string number
% argument 2 is the note number
\def\zu#1#2{\zltab{#1}{#2}}%

% initiate a beam 
% argument 1 is a string number
% argument 2 is the slope
\def\uib#1#2{%
  \stringraise\nblines%
  \advance\stringraise by -#1%
  \multiply\stringraise by 2%
  \ibl0{\the\stringraise}{#2}%
}
  
% initiate a double beam
% argument 1 is a string number
% argument 2 is the slope
\def\uibb#1#2{%
  \stringraise\nblines%
  \advance\stringraise by -#1%
  \multiply\stringraise by 2%
  \ibbl0{\the\stringraise}{#2}%
}

% a beam note 
% argument 1 is the string number
% argument 2 is the note number
\def\ub#1#2{%
  \zltab{#1}{#2}%
  \s@l@ctbeam{0}\relax%
  \stringraise\nblines%
  \advance\stringraise by -#1%
  \multiply\stringraise by 2%
  \n@i\stringraise%
  \def\q@u{}\let\st@m\beamst@m%
  \let\n@fon\g@q\let\n@sym\q@u\y@v\qn@width\writ@note%
}

% increase the beam multiplicity to 2
\def\unbb{\nbbl0}

% decrease the beam multiplicity to one after the following note
\def\utbb{\tbbl0}

% terminate the beam after the following note
\def\utb{\tbl0}

% terminate the beam at this note
% argument 1 is the string number
% argument 2 is the note number
\def\utq#1#2{\utb\ub{#1}{#2}}

\makeatother
\endinput