%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % PACKAGE : piano % DESCRIPTION: Draws basic 2 octaves keyboard diagrams with up to % 7 highlighted keys. % % SYNTAX : \keyboard[highligh 1][highlight 2]..[highlight 7] % First octave keys : % Co, Cso, Do, Dso, Eo, Fo, Fso, Go, Gso, Ao, Aso and Bo % Second octave keys : % Ct, Cst, Dt, Dst, Et, Ft, Fst, Gt, Gst, At, Ast and Bt % % CREATED BY : Émile Daneault % VERSION : 1.0 % COMMENT : This package is very limited. You have no control over the size % or the color of the keyboard/highlighting. I'm uploading this to % CTAN because I though someone might need a basic tool like this % someday. Feel free to modify, but beware of the monstruous % \ifthenelse trees(its function is to "overload" the command with % anywhere between 0 and 7 inputs.) % % EXAMPLE : % \begin{figure}[thpb]\ % \centering % \keyboard[Co][Eo][Gso][Ct][Et] % \caption{C aug chord} % \label{Chord1} % \end{figure} % % LISCENCE : This material is subject to the LaTeX Project Public Licence. % See % http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html % for the details of that licence. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ProvidesPackage{piano} \usepackage{color} \usepackage{ifthen} \usepackage{xargs} \definecolor{orange}{RGB}{255,127,0} \newcommandx*{\keyboard}[7][1=0, 2=0, 3=0, 4=0, 5=0, 6=0, 7=0]{ %% Clavier 2 octaves \setlength{\unitlength}{0.5cm} \begin{picture}(15,4.5) %Touches blanches \multiput(0,0)(1,0){14}% {\line(0,1){4}} %Contour \put(0,0){\line(0,1){4}} \put(0,0){\line(1,0){14}} \put(14,0){\line(0,1){4}} \put(0,4){\line(1,0){14}} %Touches noires \linethickness{3mm} \multiput(1,4)(1,0){2}% {\line(0,-1){3}} \multiput(4,4)(1,0){3}% {\line(0,-1){3}} \linethickness{3mm} \multiput(8,4)(1,0){2}% {\line(0,-1){3}} \multiput(11,4)(1,0){3}% {\line(0,-1){3}} %Rond de note {\color{orange} \ifthenelse{\equal{#1}{Co}}{\put(0.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Do}}{\put(1.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Eo}}{\put(2.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Fo}}{\put(3.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Go}}{\put(4.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Ao}}{\put(5.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Bo}}{\put(6.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Ct}}{\put(7.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Dt}}{\put(8.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Et}}{\put(9.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Ft}}{\put(10.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Gt}}{\put(11.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{At}}{\put(12.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Bt}}{\put(13.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Cso}}{\put(1,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Dso}}{\put(2,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Fso}}{\put(4,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Gso}}{\put(5,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Aso}}{\put(6,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Cst}}{\put(8,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Dst}}{\put(9,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Fst}}{\put(11,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Gst}}{\put(12,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#1}{Ast}}{\put(13,1.5){\circle*{0.5}}}}{}}}}}}}}}}}}}}}}}}}}}}} \ifthenelse{\equal{#2}{Co}}{\put(0.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Do}}{\put(1.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Eo}}{\put(2.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Fo}}{\put(3.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Go}}{\put(4.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Ao}}{\put(5.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Bo}}{\put(6.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Ct}}{\put(7.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Dt}}{\put(8.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Et}}{\put(9.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Ft}}{\put(10.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Gt}}{\put(11.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{At}}{\put(12.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Bt}}{\put(13.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Cso}}{\put(1,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Dso}}{\put(2,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Fso}}{\put(4,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Gso}}{\put(5,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Aso}}{\put(6,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Cst}}{\put(8,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Dst}}{\put(9,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Fst}}{\put(11,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Gst}}{\put(12,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#2}{Ast}}{\put(13,1.5){\circle*{0.5}}}}{}}}}}}}}}}}}}}}}}}}}}}} \ifthenelse{\equal{#3}{Co}}{\put(0.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Do}}{\put(1.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Eo}}{\put(2.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Fo}}{\put(3.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Go}}{\put(4.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Ao}}{\put(5.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Bo}}{\put(6.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Ct}}{\put(7.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Dt}}{\put(8.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Et}}{\put(9.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Ft}}{\put(10.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Gt}}{\put(11.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{At}}{\put(12.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Bt}}{\put(13.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Cso}}{\put(1,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Dso}}{\put(2,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Fso}}{\put(4,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Gso}}{\put(5,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Aso}}{\put(6,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Cst}}{\put(8,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Dst}}{\put(9,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Fst}}{\put(11,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Gst}}{\put(12,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#3}{Ast}}{\put(13,1.5){\circle*{0.5}}}}{}}}}}}}}}}}}}}}}}}}}}}} \ifthenelse{\equal{#4}{Co}}{\put(0.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Do}}{\put(1.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Eo}}{\put(2.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Fo}}{\put(3.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Go}}{\put(4.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Ao}}{\put(5.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Bo}}{\put(6.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Ct}}{\put(7.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Dt}}{\put(8.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Et}}{\put(9.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Ft}}{\put(10.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Gt}}{\put(11.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{At}}{\put(12.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Bt}}{\put(13.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Cso}}{\put(1,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Dso}}{\put(2,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Fso}}{\put(4,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Gso}}{\put(5,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Aso}}{\put(6,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Cst}}{\put(8,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Dst}}{\put(9,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Fst}}{\put(11,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Gst}}{\put(12,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#4}{Ast}}{\put(13,1.5){\circle*{0.5}}}}{}}}}}}}}}}}}}}}}}}}}}}} \ifthenelse{\equal{#5}{Co}}{\put(0.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Do}}{\put(1.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Eo}}{\put(2.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Fo}}{\put(3.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Go}}{\put(4.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Ao}}{\put(5.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Bo}}{\put(6.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Ct}}{\put(7.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Dt}}{\put(8.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Et}}{\put(9.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Ft}}{\put(10.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Gt}}{\put(11.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{At}}{\put(12.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Bt}}{\put(13.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Cso}}{\put(1,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Dso}}{\put(2,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Fso}}{\put(4,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Gso}}{\put(5,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Aso}}{\put(6,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Cst}}{\put(8,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Dst}}{\put(9,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Fst}}{\put(11,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Gst}}{\put(12,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#5}{Ast}}{\put(13,1.5){\circle*{0.5}}}}{}}}}}}}}}}}}}}}}}}}}}}} \ifthenelse{\equal{#6}{Co}}{\put(0.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Do}}{\put(1.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Eo}}{\put(2.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Fo}}{\put(3.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Go}}{\put(4.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Ao}}{\put(5.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Bo}}{\put(6.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Ct}}{\put(7.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Dt}}{\put(8.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Et}}{\put(9.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Ft}}{\put(10.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Gt}}{\put(11.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{At}}{\put(12.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Bt}}{\put(13.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Cso}}{\put(1,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Dso}}{\put(2,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Fso}}{\put(4,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Gso}}{\put(5,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Aso}}{\put(6,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Cst}}{\put(8,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Dst}}{\put(9,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Fst}}{\put(11,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Gst}}{\put(12,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#6}{Ast}}{\put(13,1.5){\circle*{0.5}}}}{}}}}}}}}}}}}}}}}}}}}}}} \ifthenelse{\equal{#7}{Co}}{\put(0.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Do}}{\put(1.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Eo}}{\put(2.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Fo}}{\put(3.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Go}}{\put(4.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Ao}}{\put(5.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Bo}}{\put(6.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Ct}}{\put(7.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Dt}}{\put(8.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Et}}{\put(9.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Ft}}{\put(10.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Gt}}{\put(11.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{At}}{\put(12.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Bt}}{\put(13.5,0.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Cso}}{\put(1,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Dso}}{\put(2,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Fso}}{\put(4,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Gso}}{\put(5,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Aso}}{\put(6,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Cst}}{\put(8,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Dst}}{\put(9,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Fst}}{\put(11,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Gst}}{\put(12,1.5){\circle*{0.5}}}{ \ifthenelse{\equal{#7}{Ast}}{\put(13,1.5){\circle*{0.5}}}}{}}}}}}}}}}}}}}}}}}}}}}} } \end{picture} }