]> git.donarmstrong.com Git - lilypond.git/blob - scm/accreg.scm
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scm / accreg.scm
1 ;; Accordion registration is tricky, partly because no two instruments
2 ;; offer the same registers.  In particular bass registers are not
3 ;; standardized at all and often left unspecified (orchestra scores
4 ;; don't use bass notes anyway).
5 ;;
6 ;; registration is indicated by using a control sequence name
7 ;; indicating the register set as either a markup function or a music
8 ;; function, taking a string as argument.  The music function is a
9 ;; standalone music event since register changes usually occur before
10 ;; note onset.  It is currently implemented as a text superscript on
11 ;; an empty chord but could conceivably become some kind of per-staff
12 ;; rehearsal mark at one point of time.
13
14 (define-module (scm accreg))
15
16 (use-modules (lily) (srfi srfi-1) (ice-9 optargs))
17
18 (defmacro* define-register-set (set-symbol doc #:optional definition)
19   "Defines markup command named with @var{set-symbol} for creating
20 accordion register markups as well as a music function of the same
21 name.
22
23 @var{doc} is the optional documentation string followed by the actual
24 @var{definition}.  See existing definitions in @file{scm/accreg.scm}
25 for examples."
26   `(begin
27      (define-markup-command (,set-symbol layout props name) (string?)
28        #:properties (translate-scaled-markup)
29        #:category accordion-registers
30        ;; It would be nice to generate the documentation string
31        ;; automatically containing all possible registrations but this
32        ;; is a hen-and-egg problem.  When the macro is being executed,
33        ;; the register definition has not yet been evaluated.  It
34        ;; would be feasible to not ever evaluate it and consider it
35        ;; final.  But that seems like a somewhat unfriendly interface.
36        ,(if definition doc "Undocumented.")
37        (let* ((instrument ,(or definition doc))
38               (register
39                (ly:assoc-get name (ly:assoc-get 'register instrument)))
40               (reedbanks (ly:assoc-get 'reedbank instrument)))
41          (interpret-markup
42           layout props
43           (make-general-align-markup
44            Y DOWN
45            (fold (lambda (d m)
46                    (markup #:combine m
47                            #:translate-scaled d
48                            #:musicglyph "accordion.dot"))
49                  (markup #:musicglyph
50                          (ly:assoc-get 'glyph instrument))
51                  (or (ly:assoc-get 'dots register)
52                      (append-map (lambda (x)
53                                    (ly:assoc-get 'dots
54                                                  (ly:assoc-get x reedbanks)))
55                                  (ly:assoc-get 'reedbanks register))))))))
56
57      (define-public ,set-symbol
58        (define-music-function (register)
59          (string?)
60          ,(format #f "Equivalent to @code{<>^\\markup \\~a@var{REGISTER}}."
61                   set-symbol)
62          (make-event-chord
63           (list
64            (make-music
65             'TextScriptEvent
66             'direction
67             1
68             'text
69             (,(string->symbol (format #f "make-~a-markup" set-symbol)) register))))))))
70
71
72 (define-register-set discant
73   "@code{\\discant @var{name}} generates a discant accordion register
74 symbol.
75
76 To make it available,
77 @example
78 #(use-modules (scm accreg))
79 @end example
80 is required near the top of your input file.
81
82 The register names in the default @code{\\discant} register set have
83 modeled after numeric Swiss notation like depicted in
84 @uref{http://de.wikipedia.org/wiki/Register_%28Akkordeon%29}, omitting
85 the slashes and dropping leading zeros.
86
87 The string @var{name} is basically a three-digit number with the
88 lowest digit specifying the number of 16' reeds, the tens the number
89 of 8' reeds, and the hundreds specifying the number of 4' reeds.
90 Without modification, the specified number of reeds in 8' is centered
91 in the symbol.  Newer instruments may have registrations where 8' can
92 be used either within or without a tone chamber, @q{cassotto}.
93 Notationally, the central dot then indicates use of cassotto.  One can
94 suffix the tens' digits @samp{1} and @samp{2} with @samp{+} or
95 @samp{-} to indicate clustering the dots at the right or left
96 respectively rather than centered.
97
98 Some examples are
99
100 @lilypond[quote]
101 #(use-modules (scm accreg))
102 \\markup {
103   \\center-column {
104      \\discant #\"1\"
105      \"\\\\discant #\\\"1\\\"\"
106      \\vspace #1
107      \\discant #\"120\"
108      \"\\\\discant #\\\"120\\\"\"
109   } \\hspace #3
110   \\center-column {
111      \\discant #\"1+0\"
112      \"\\\\discant #\\\"1+0\\\"\"
113      \\vspace #1
114      \\discant #\"131\"
115      \"\\\\discant #\\\"131\\\"\"
116   }
117 }
118 @end lilypond
119 "
120   '((glyph . "accordion.discant")
121     (reedbank
122      (L (dots (0 . 0.5)))
123      (M (dots (0 . 1.5)))
124      (MM (dots (1 . 1.5)))
125      (MMM (dots (-1 . 1.5)))
126      (H (dots (0 . 2.5))))
127     (register
128      ("1" (reedbanks L))
129      ("10" (reedbanks M))
130      ("11" (reedbanks L M))
131      ("1+0" (reedbanks MM))
132      ("1+1" (reedbanks MM L))
133      ("1-0" (reedbanks MMM))
134      ("1-1" (reedbanks MMM L))
135      ("20" (reedbanks MMM MM))
136      ("21" (reedbanks MMM MM L))
137      ("2+0" (reedbanks MM M))
138      ("2+1" (reedbanks MM M L))
139      ("2-0" (reedbanks MMM M))
140      ("2-1" (reedbanks MMM M L))
141      ("30" (reedbanks MMM MM M))
142      ("31" (reedbanks MMM MM M L))
143      ("100" (reedbanks H))
144      ("101" (reedbanks H L))
145      ("110" (reedbanks H M))
146      ("111" (reedbanks H L M))
147      ("11+0" (reedbanks H MM))
148      ("11+1" (reedbanks H MM L))
149      ("11-0" (reedbanks H MMM))
150      ("11-1" (reedbanks H MMM L))
151      ("120" (reedbanks H MMM MM))
152      ("121" (reedbanks H MMM MM L))
153      ("12+0" (reedbanks H MM M))
154      ("12+1" (reedbanks H MM M L))
155      ("12-0" (reedbanks H MMM M))
156      ("12-1" (reedbanks H MMM M L))
157      ("130" (reedbanks H MMM MM M))
158      ("131" (reedbanks H MMM MM M L)))))
159
160 (define-register-set stdBass
161   "@code{\\stdBass @var{name}} generates a standard bass accordion
162 register symbol.
163
164 To make it available,
165 @example
166 #(use-modules (scm accreg))
167 @end example
168 is required near the top of your input file.
169
170 The default bass register definitions have been modeled after the
171 article @uref{http://www.accordions.com/index/art/stradella.shtml}
172 originally appearing in Accord Magazine.
173
174 The underlying register model is
175
176 @lilypond[quote]
177 \\new PianoStaff
178 <<
179   \\new Staff \\with { \\omit TimeSignature }
180   { <c' c' c''>\\glissando <f' f' f''>
181     <fis fis' fis''>\\glissando <b b'b''> }
182   \\new Staff \\with { \\omit TimeSignature }
183   { \\clef bass
184     <c, c>\\glissando <f, f>
185     <fis, fis>\\glissando <b, b>
186   }
187 >>
188 @end lilypond
189
190 This kind of overlapping arrangement is common for Italian instruments
191 though the exact location of the octave breaks differ.
192
193 When not composing for a particular target instrument, using the five
194 reed definitions makes more sense than using a four reed layout: in
195 that manner, the @samp{Master} register is unambiguous.  This is
196 rather the rule in literature bothering about bass registrations at
197 all.
198
199 Available registrations are
200
201 @lilypond[quote]
202 #(use-modules (scm accreg))
203 \\markup {
204   \\center-column {
205      \\stdBass #\"Soprano\"
206      \"\\\\stdBass #\\\"Soprano\\\"\"
207      \\vspace #1
208      \\stdBass #\"Alto\"
209      \"\\\\stdBass #\\\"Alto\\\"\"
210      \\vspace #1
211      \\stdBass #\"Tenor\"
212      \"\\\\stdBass #\\\"Tenor\\\"\"
213      \\vspace #1
214      \\stdBass #\"Master\"
215      \"\\\\stdBass #\\\"Master\\\"\"
216   } \\hspace #3
217   \\center-column {
218      \\stdBass #\"Soft Bass\"
219      \"\\\\stdBass #\\\"Soft Bass\\\"\"
220      \\vspace #1
221      \\stdBass #\"Soft Tenor\"
222      \"\\\\stdBass #\\\"Soft Tenor\\\"\"
223      \\vspace #1
224      \\stdBass #\"Bass/Alto\"
225      \"\\\\stdBass #\\\"Bass/Alto\\\"\"
226   }
227 }
228 @end lilypond
229 "
230   '((glyph . "accordion.stdbass")
231     (register
232      ("Soprano" (reedbanks Soprano))
233      ("Alto" (reedbanks Alto Soprano))
234      ("Tenor" (reedbanks Tenor Alto Soprano))
235      ("Master" (reedbanks Bass Tenor Contralto Alto Soprano))
236      ("Soft Bass" (reedbanks Bass Tenor Contralto))
237      ("Soft Tenor" (reedbanks Tenor Alto))
238      ("Bass/Alto" (reedbanks Bass Alto Soprano)))
239     (reedbank
240      (Soprano (dots (0 . 3.5)))
241      (Alto (dots (0 . 2.5)))
242      (Contralto (dots (1 . 2)))
243      (Tenor (dots (0 . 1.5)))
244      (Bass (dots (0 . 0.5))))))
245
246
247 (define-register-set stdBassIV
248 "@code{\\stdBassIV @var{name}} generates a standard bass accordion
249 register symbol.
250
251 To make it available,
252 @example
253 #(use-modules (scm accreg))
254 @end example
255 is required near the top of your input file.
256
257 The main use is for four-reed standard bass instruments with reedbank
258 layout
259
260 @lilypond[quote]
261 \\new PianoStaff
262 <<
263   \\new Staff \\with { \\omit TimeSignature }
264   { <e e'>2\\glissando <dis' dis''> }
265   \\new Staff \\with { \\omit TimeSignature }
266   { \\clef bass
267     <e,, e,>\\glissando <dis, dis>
268   }
269 >>
270 @end lilypond
271
272 Notable instruments are Morino models with MIII (the others are
273 five-reed instead) and the Atlantic@tie{}IV.  Most of those models
274 have three register switches.  Some newer Morinos with MIII might have
275 five or even seven.
276
277 The prevalent three-register layout uses the middle three switches
278 @samp{Tenor}, @samp{Master}, @samp{Soft Bass}.  Note that the sound is
279 quite darker than the same registrations of @samp{c,}-based
280 instruments.
281
282 Available registrations are
283
284 @lilypond[quote]
285 #(use-modules (scm accreg))
286 \\markup {
287   \\center-column {
288      \\stdBassIV #\"Soprano\"
289      \"\\\\stdBassIV #\\\"Soprano\\\"\"
290      \\vspace #1
291      \\stdBassIV #\"Alto\"
292      \"\\\\stdBassIV #\\\"Alto\\\"\"
293      \\vspace #1
294      \\stdBassIV #\"Tenor\"
295      \"\\\\stdBassIV #\\\"Tenor\\\"\"
296      \\vspace #1
297      \\stdBassIV #\"Master\"
298      \"\\\\stdBassIV #\\\"Master\\\"\"
299   } \\hspace #3
300   \\center-column {
301      \\stdBassIV #\"Soft Bass\"
302      \"\\\\stdBassIV #\\\"Soft Bass\\\"\"
303      \\vspace #1
304      \\stdBassIV #\"Bass/Alto\"
305      \"\\\\stdBassIV #\\\"Bass/Alto\\\"\"
306      \\vspace #1
307      \\stdBassIV #\"Soft Bass/Alto\"
308      \"\\\\stdBassIV #\\\"Soft Bass/Alto\\\"\"
309      \\vspace #1
310      \\stdBassIV #\"Soft Tenor\"
311      \"\\\\stdBassIV #\\\"Soft Tenor\\\"\"
312   }
313 }
314 @end lilypond
315 "
316   '((glyph . "accordion.stdbass")
317     (reedbank
318      (Soprano (dots (0 . 3.5)))
319      (Alto (dots (0 . 2.5)))
320      (Tenor (dots (0 . 1.5)))
321      (Bass (dots (0 . 0.5))))
322     (register
323      ("Soprano" (reedbanks Soprano))
324      ("Alto" (reedbanks Alto Soprano))
325      ("Tenor" (reedbanks Tenor Soprano))
326      ("Master" (reedbanks Bass Tenor Alto Soprano))
327      ("Soft Bass" (reedbanks Bass Tenor Alto))
328      ("Bass/Alto" (reedbanks Bass Alto Soprano))
329      ("Soft Bass/Alto" (reedbanks Bass Alto))
330      ("Soft Tenor" (reedbanks Tenor Alto)))))
331
332 (define-register-set stdBassV
333   "@code{\\stdBassV @var{name}} generates a standard bass accordion
334 register symbol.
335
336 To make it available,
337 @example
338 #(use-modules (scm accreg))
339 @end example
340 is required near the top of your input file.
341
342 The main use is for five-reed standard bass instruments with reedbank
343 layout
344
345 @lilypond[quote]
346 \\new PianoStaff
347 <<
348   \\new Staff \\with { \\omit TimeSignature }
349   { <e e' e''>2\\glissando <dis' dis'' dis'''> }
350   \\new Staff \\with { \\omit TimeSignature }
351   { \\clef bass
352     <e,, e,>\\glissando <dis, dis>
353   }
354 >>
355 @end lilypond
356
357 This tends to be the bass layout for Hohner's Morino series without
358 convertor or MIII manual.
359
360 With the exception of the rather new 7-register layout, the highest
361 two chord reeds are usually sounded together.  The  Older instruments offer
362 5 or 3 bass registers.  The Tango@tie{}VM offers an additional
363 @samp{Solo Bass} setting that mutes the chord reeds.  The symbol on
364 the register buttons of the Tango@tie{}VM would actually match the
365 physical five-octave layout reflected here, but it is not used in
366 literature.
367
368 Composers should likely prefer the five-reed versions of these
369 symbols.  The mismatch of a four-reed instrument with five-reed
370 symbols is easier to resolve for the player than the other way round.
371
372 Available registrations are
373
374 @lilypond[quote]
375 #(use-modules (scm accreg))
376 \\markuplist \\justified-lines {
377   \\center-column {
378      \\stdBassV #\"Bass/Alto\"
379      \"\\\\stdBassV #\\\"Bass/Alto\\\"\"
380      \\vspace #1
381      \\stdBassV #\"Soft Bass/Alto\"
382      \"\\\\stdBassV #\\\"Soft Bass/Alto\\\"\"
383      \\vspace #1
384      \\stdBassV #\"Alto\"
385      \"\\\\stdBassV #\\\"Alto\\\"\"
386      \\vspace #1
387      \\stdBassV #\"Tenor\"
388      \"\\\\stdBassV #\\\"Tenor\\\"\"
389      \\vspace #1
390      \\stdBassV #\"Master\"
391      \"\\\\stdBassV #\\\"Master\\\"\"
392  } \\hspace #3
393   \\center-column {
394      \\stdBassV #\"Soft Bass\"
395      \"\\\\stdBassV #\\\"Soft Bass\\\"\"
396      \\vspace #1
397      \\stdBassV #\"Soft Tenor\"
398      \"\\\\stdBassV #\\\"Soft Tenor\\\"\"
399      \\vspace #1
400      \\stdBassV #\"Soprano\"
401      \"\\\\stdBassV #\\\"Soprano\\\"\"
402      \\vspace #1
403      \\stdBassV #\"Sopranos\"
404      \"\\\\stdBassV #\\\"Sopranos\\\"\"
405      \\vspace #1
406      \\stdBassV #\"Solo Bass\"
407      \"\\\\stdBassV #\\\"Solo Bass\\\"\"
408   }
409 }
410 @end lilypond
411 "
412 '((glyph . "accordion.stdbass")
413     (reedbank
414      (Sopranos (dots (-0.5 . 3.5) (0.5 . 3.5)))
415      (Soprano (dots (0 . 3.5)))
416      (Alto (dots (0 . 2.5)))
417      (Tenor (dots (0 . 1.5)))
418      (Bass (dots (0 . 0.5))))
419     (register
420      ("Bass/Alto" (reedbanks Bass Alto Soprano))
421      ("Soft Bass/Alto" (reedbanks Bass Alto))
422      ("Alto" (reedbanks Alto Sopranos))
423      ("Tenor" (reedbanks Tenor Sopranos))
424      ("Master" (reedbanks Bass Tenor Alto Sopranos))
425      ("Soft Bass" (reedbanks Bass Tenor Alto))
426      ("Soft Tenor" (reedbanks Tenor Alto))
427      ("Soprano" (reedbanks Soprano))
428      ("Sopranos" (reedbanks Sopranos))
429      ("Solo Bass" (reedbanks Bass)))))
430
431 (define-register-set stdBassVI
432   "@code{\\stdBassVI @var{name}} generates a standard bass accordion
433 register symbol for six reed basses.
434
435 To make it available,
436 @example
437 #(use-modules (scm accreg))
438 @end example
439 is required near the top of your input file.
440
441 This is primarily the register layout for the Hohner @qq{Gola} model.
442 The layout is
443
444 @lilypond[quote]
445 \\new PianoStaff
446 <<
447   \\new Staff \\with { \\omit TimeSignature }
448   { <c' c' c''>\\glissando <f' f' f''>
449     <fis fis' fis''>\\glissando <b b'b''> }
450   \\new Staff \\with { \\omit TimeSignature }
451   { \\clef bass
452     <c, c c'>\\glissando <f, f f'>
453     <fis, fis fis>\\glissando <b, b b>
454   }
455 >>
456 @end lilypond
457
458 The registers are effectively quite similar to that of
459 @code{\\stdBass}.  An additional bass reed at alto pitch is omitted
460 for esthetical reasons from the @samp{Master} setting, so the symbols
461 are almost the same except for the @samp{Alto/Soprano} register with
462 bass notes at Alto pitch and chords at Soprano pitch.
463
464 Available registrations are
465
466 @lilypond[quote]
467 #(use-modules (scm accreg))
468 \\markup {
469   \\center-column {
470      \\stdBassVI #\"Soprano\"
471      \"\\\\stdBassVI #\\\"Soprano\\\"\"
472      \\vspace #1
473      \\stdBassVI #\"Alto\"
474      \"\\\\stdBassVI #\\\"Alto\\\"\"
475      \\vspace #1
476      \\stdBassVI #\"Soft Tenor\"
477      \"\\\\stdBassVI #\\\"Soft Tenor\\\"\"
478      \\vspace #1
479      \\stdBassVI #\"Master\"
480      \"\\\\stdBassVI #\\\"Master\\\"\"
481   } \\hspace #3
482   \\center-column {
483      \\stdBassVI #\"Alto/Soprano\"
484      \"\\\\stdBassVI #\\\"Alto/Soprano\\\"\"
485      \\vspace #1
486      \\stdBassVI #\"Bass/Alto\"
487      \"\\\\stdBassVI #\\\"Bass/Alto\\\"\"
488      \\vspace #1
489      \\stdBassVI #\"Soft Bass\"
490      \"\\\\stdBassVI #\\\"Soft Bass\\\"\"
491   }
492 }
493 @end lilypond
494 "
495   '((glyph . "accordion.stdbass")
496     (register
497      ("Soprano" (reedbanks Soprano))
498      ("Alto" (reedbanks Alto))
499      ("Soft Tenor" (reedbanks Tenor Alto))
500      ("Master" (reedbanks Bass Tenor Contralto Alto Soprano))
501      ("Alto/Soprano" (reedbanks Contratenor Soprano))
502      ("Bass/Alto" (reedbanks Bass Alto Soprano))
503      ("Soft Bass" (reedbanks Bass Tenor Contralto)))
504     (reedbank
505      (Soprano (dots (0 . 3.5)))
506      (Alto (dots (0 . 2.5)))
507      (Contralto (dots (1 . 2)))
508      (Contratenor (dots (-1 . 2.5)))
509      (Tenor (dots (0 . 1.5)))
510      (Bass (dots (0 . 0.5))))))
511
512 ;; The default FreeBass is modeled after the default Discant register
513 ;; description.  Being a default, we just provide the normal 2 reed
514 ;; registrations.
515 (define-register-set freeBass
516   "@code{\\freeBass @var{name}} generates a free bass/@/converter
517 accordion register symbol for the usual two-reed layout.
518
519 To make it available,
520 @example
521 #(use-modules (scm accreg))
522 @end example
523 is required near the top of your input file.
524
525 Available registrations are
526
527 @lilypond[quote]
528 #(use-modules (scm accreg))
529 \\markup {
530   \\center-column {
531      \\freeBass #\"1\"
532      \"\\\\freeBass #\\\"1\\\"\"
533      \\vspace #1
534      \\freeBass #\"10\"
535      \"\\\\freeBass #\\\"10\\\"\"
536   } \\hspace #3
537   \\center-column {
538      \\freeBass #\"11\"
539      \"\\\\freeBass #\\\"11\\\"\"
540   }
541 }
542 @end lilypond
543 "
544   '((glyph . "accordion.freebass")
545     (reedbank
546      (L (dots (0 . 0.5)))
547      (M (dots (0 . 1.5))))
548     (register
549      ("1" (reedbanks L))
550      ("10" (reedbanks M))
551      ("11" (reedbanks L M)))))