interline#:=staffsize#/(stafflines-1)+stafflinethickness#;
-def ugh_grid =
- makegrid(-5pt,-4pt,-3pt,-2pt,-1pt,0pt,1pt,2pt,3pt,4pt,5pt)
- (-5pt,-4pt,-3pt,-2pt,-1pt,0pt,1pt,2pt,3pt,4pt,5pt);
- makegrid(-4.8pt,-4.6pt,-4.4pt,-4.2pt,-4.0pt,
- -3.8pt,-3.6pt,-3.4pt,-3.2pt,-3.0pt,
- -2.8pt,-2.6pt,-2.4pt,-2.2pt,-2.0pt,
- -1.8pt,-1.6pt,-1.4pt,-1.2pt,-1.0pt,
- -0.8pt,-0.6pt,-0.4pt,-0.2pt,-0.0pt,
- 0.0pt,0.2pt,0.4pt,0.6pt,0.8pt,
- 1.0pt,1.2pt,1.4pt,1.6pt,1.8pt,
- 2.0pt,2.2pt,2.4pt,2.6pt,2.8pt,
- 3.0pt,3.2pt,3.4pt,3.6pt,3.8pt,
- 4.0pt,4.2pt,4.4pt,4.6pt,4.8pt)
- (-4.8pt,-4.6pt,-4.4pt,-4.2pt,-4.0pt,
- -3.8pt,-3.6pt,-3.4pt,-3.2pt,-3.0pt,
- -2.8pt,-2.6pt,-2.4pt,-2.2pt,-2.0pt,
- -1.8pt,-1.6pt,-1.4pt,-1.2pt,-1.0pt,
- -0.8pt,-0.6pt,-0.4pt,-0.2pt,-0.0pt,
- 0.0pt,0.2pt,0.4pt,0.6pt,0.8pt,
- 1.0pt,1.2pt,1.4pt,1.6pt,1.8pt,
- 2.0pt,2.2pt,2.4pt,2.6pt,2.8pt,
- 3.0pt,3.2pt,3.4pt,3.6pt,3.8pt,
- 4.0pt,4.2pt,4.4pt,4.6pt,4.8pt);
+def test_grid =
+if test>1:
+ proofrulethickness 1pt#;
+ makegrid(0pt,0pt for i:=-5pt step 1pt until 5pt: ,i endfor)
+ (0pt,0pt for i:=-5pt step 1pt until 5pt: ,i endfor);
+ proofrulethickness .1pt#;
+ makegrid(0pt,0pt for i:=-4.8pt step .2pt until 4.8pt: ,i endfor)
+ (0pt,0pt for i:=-4.8pt step .2pt until 4.8pt: ,i endfor);
+fi
enddef;
-
% a: x diameter
% b: y diameter
% err_x: drift of y axis at top
superellipse((a,err_x),(-err_y,b),(-a,-err_x),(err_y,-b),super);
enddef;
-% brr.
-% def notehead(expr code,il,hdb,adb,adw,xda,s,alpha,cda,ddb,r) =
-def notehead(expr code,interline,name) =
+def begin_notehead =
+ begingroup;
+ save a_b,err_y_a,alpha,super;
+ save ai_a,ai_bi,err_y_ai,err_x_bi,alphai,superi;
+ save b_h,a_w;
+ enddef;
+
+def end_notehead(expr code,interline,name) =
save a,b,h,w,ai,bi;
h#=interline;
2b#=h#*b_h;
define_pixels(a,b);
define_pixels(w,h);
define_pixels(ai,bi);
-% save x;
-% x1=-x3=a; x2=x4=0; y1=y3=0; y2=-y4=b;
-% penlabels(1,2,3,4);
-if test>0:
- beginchar(code,w#,h#,0); name;
- fill distorted_ellipse(a,b,a*err_y_a,0,super);
- unfill distorted_ellipse(ai,bi,ai*err_y_ai,0,superi);
-if test=1:
- pickup pencircle;
- draw (0,0)--(a,0) rotated alpha;
- draw (0,0)--(-a,0) rotated alphai;
-else:
- ugh_grid;
-fi
-else:
- beginchar(code,w#,h#,0); name;
+ fet_beginchar(code,w#,h#,0,name);
path black,white;
black=distorted_ellipse(a,b,a*err_y_a,0,super);
+ white=distorted_ellipse(ai,bi,ai*err_y_ai,bi*err_x_bi,superi);
+if test>0:
+ save x;
+ x1=-x3=a; x2=x4=0; y1=y3=0; y2=-y4=b;
+ penlabels(1,2,3,4);
+ test_grid;
+else:
black:=black rotated alpha;
% black:=black shifted (w/2,h/2);
black:=black shifted (w/2,0);
- fill black;
- white=distorted_ellipse(ai,bi,ai*err_y_ai,bi*err_x_bi,superi);
white:=white rotated alphai;
% white:=white shifted (w/2,h/2);
white:=white shifted (w/2,0);
- unfill white;
fi
+ fill black;
+ unfill white;
endchar;
+ endgroup;
enddef;
% whole note
-% a/b=1.7
-% h/b=1;
-% a/w=1;
-% x/a=1;
-%notehead(incr code,interline#,1,1.7,1,1/20,0.707,0,1/2.2,1/1.3,0.74);
-%notehead(incr code,interline#,1,1.7,1,1/20,0.707,0,5/11,3/4,0.74);
-
-%def notehead(expr code,il,hdb,adb,adw,xda,s,alpha,cda,ddb,r) =
-
-% whole note
-% wanske, p.38
-save a_b,err_y_a,alpha,super;
-save ai_a,ai_bi,err_y_ai,err_x_bi,alphai,superi;
-save b_h,a_w;
-a_b:=1.80;
-err_y_a:=0; % no slant
-alpha:=0;
-super:=0.707;
-ai_a:=0.508;
-ai_bi:=1.23;
-% err_y_ai:=0.0938;
-% err_x_bi:=0;
-err_y_ai:=0;
-err_x_bi:=0.115;
-alphai:=135;
-superi:=0.68;
-b_h:=1; %no rotate-> no height correction
-a_w:=1; % no rotate-> no width correction
-notehead(incr code,interline#,"Whole notehead");
+% Wanske, p.38
+% begin_notehead(incr code,interline#,"Whole notehead");
+begin_notehead;
+ a_b:=1.80;
+ err_y_a:=0; % no slant
+ alpha:=0;
+ super:=0.707;
+ ai_a:=0.508;
+ ai_bi:=1.23;
+ % err_y_ai:=0.0938;
+ % err_x_bi:=0;
+ err_y_ai:=0;
+ err_x_bi:=0.115;
+ alphai:=135;
+ superi:=0.69;
+ b_h:=1; %no rotate-> no height correction
+ a_w:=1; % no rotate-> no width correction
+ end_notehead(incr code,interline#,"Whole notehead");
% half note
-% wanske, p.39
-a_b:=1.49;
-err_y_a:=0.157;
-alpha:=34;
-super:=0.66;
-ai_a:=0.863;
-ai_bi:=3.41;
-err_y_ai:=0;
-err_x_bi:=-0.12;
-alphai:=alpha;
-superi:=0.80;
-b_h:=0.935;
-a_w:=1.12;
-notehead(incr code,interline#,"Half notehead");
+% Wanske, p.39
+begin_notehead;
+ a_b:=1.49; % after text
+ % a_b:=1.50; % after drawing
+ err_y_a:=0.157;
+ alpha:=34;
+ super:=0.66;
+ ai_a:=0.863;
+ ai_bi:=3.14;
+ err_y_ai:=0;
+ err_x_bi:=-0.12;
+ alphai:=alpha;
+ superi:=0.80;
+ b_h:=0.935;
+ a_w:=1.12;
+ end_notehead(incr code,interline#,"Half notehead");
% quarter note
-% wanske p.38
-a_b:=1.57;
-err_y_a:=0.044;
-alpha:=32;
-super:=0.707;
-ai_a:=0;
-ai_bi:=1;
-err_y_ai:=0;
-err_x_bi:=0;
-alphai:=0;
-superi:=0.707;
-b_h:=0.85;
-a_w:=1.09;
-notehead(incr code,interline#,"Quarter notehead");
+% Wanske p.38
+begin_notehead;
+ a_b:=1.57; % after text
+ % a_b:=1.54; % after drawing
+ err_y_a:=0.044;
+ alpha:=32;
+ super:=0.707;
+ ai_a:=0;
+ ai_bi:=1;
+ err_y_ai:=0;
+ err_x_bi:=0;
+ alphai:=0;
+ superi:=0.707;
+ b_h:=0.85;
+ a_w:=1.09;
+ end_notehead(incr code,interline#,"Quarter notehead");
end.