summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/piano/piano.sty
blob: 5d1bfe31a2622f15f57364498f16ee0d605dffc0 (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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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}
}