lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Code review/discussion time again.


From: David Kastrup
Subject: Code review/discussion time again.
Date: Fri, 20 Nov 2009 01:20:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

I have no idea what I am doing here.  In particular not with the
\override, and the set-object-property!.  Can somebody explain to me
just what data structures I happen to manipulate, and how a user is
actually _supposed_ to be mangling them?

% The default discant register set has been more or less modeled after
% numeric Swiss notation like depicted in
% <URL:http://de.wikipedia.org/wiki/Register_%28Akkordeon%29>,
% omitting the slashes and dropping leading zeros.
%
% The names are basically three-digit numbers with the lowest digit
% specifying the number of 16' reeds, the tens the number of 8' reeds,
% and the hundreds specifying the number of 4' reeds.  Without
% modification, the specified number of reeds in 8' is in the symbol.
% Newer instruments may have register choices between 8' with and
% without cassotto.  Notationally, the central dot then indicates use
% of cassotto.  You can suffix the tens' digits "1" and "2" with "+"
% or "-" to indicate clustering the dots at the right or left
% respectively rather than centered.
%
% Composers are advised to pick the registers which they would use for
% a five-reed instrument.

#(define defaultDiscant
  '((glyph . "accordion.accDiscant")
    (reedbank
     (L (dots (0 . 0.5)))
     (M (dots (0 . 1.5)))
     (MM (dots (1 . 1.5)))
     (MMM (dots (-1 . 1.5)))
     (H (dots (0 . 2.5))))
    (register
     ("1" (reedbanks L))
     ("10" (reedbanks M))
     ("11" (reedbanks L M))
     ("1+0" (reedbanks MM))
     ("1+1" (reedbanks MM L))
     ("1-0" (reedbanks MMM))
     ("1-1" (reedbanks MMM L))
     ("20" (reedbanks MMM MM))
     ("21" (reedbanks MMM MM L))
     ("2+0" (reedbanks MM M))
     ("2+1" (reedbanks MM M L))
     ("2-0" (reedbanks MMM M))
     ("2-1" (reedbanks MMM M L))
     ("30" (reedbanks MMM MM M))
     ("31" (reedbanks MMM MM M L))
     ("100" (reedbanks H))
     ("11" (reedbanks H L))
     ("110" (reedbanks H M))
     ("111" (reedbanks H L M))
     ("11+0" (reedbanks H MM))
     ("11+1" (reedbanks H MM L))
     ("11-0" (reedbanks H MMM))
     ("11-1" (reedbanks H MMM L))
     ("120" (reedbanks H MMM MM))
     ("121" (reedbanks H MMM MM L))
     ("12+0" (reedbanks H MM M))
     ("12+1" (reedbanks H MM M L))
     ("12-0" (reedbanks H MMM M))
     ("12-1" (reedbanks H MMM M L))
     ("130" (reedbanks H MMM MM M))
     ("131" (reedbanks H MMM MM M L)))))

% The default bass register definitions have been modeled after the
% article <URL:http://www.accordions.com/index/art/stradella.shtml>
% originally appearing in Accord Magazine.
%
% If you aren't composing for a particular target instrument, using
% the five reed definitions makes more sense than using a four reed
% layout: in that manner, the "Master" register is unambiguous.

#(define defaultStdBassV
  '((glyph . "accordion.accStdbase")
    (register
     ("Soprano" (reedbanks Soprano))
     ("Alto" (reedbanks Alto Soprano))
     ("Tenor" (reedbanks Tenor Alto Soprano))
     ("Master" (reedbanks Bass Tenor Contralto Alto Soprano))
     ("Soft Bass" (reedbanks Bass Tenor Contralto))
     ("Soft Tenor" (reedbanks Tenor Alto))
     ("Bass/Alto" (reedbanks Bass Alto Soprano)))
    (reedbank
     (Soprano (dots (0 . 3.5)))
     (Alto (dots (0 . 2.5)))
     (Contralto (dots (1 . 2)))
     (Tenor (dots (0 . 1.5)))
     (Bass (dots (0 . 0.5))))))

% Older Hohner Morinos apparently come in four-reed (for those with
% separate MIII) and five-reed configurations, all reedbanks spaced
% one octave apart starting with E1.  The five reed variant has the
% same register symbols (and layout) except that there is another
% higher reed usually sounding together with the Alto reed, sharing
% its dot space.  All in all, the dots sound a sixth lower than for
% the standard symbols.  We try using the standard names as much as
% possible anyway for symbols looking comparable.  Both composers and
% players should be aware that the Morino disposition is untypically
% low: use these symbols when you know you are actually addressing
% Morino players.
%
% Older instruments have the middle three register buttons,
% instruments from the 80s have five, the current breed has seven.
% The config of the last (for which there are no register buttons with
% symbols on them) has been taken from
% 
<URL:http://www.musiker-board.de/vb/akkordeon/262828-belegung-bassregister.html>
%
% For seven register instruments, the outermost registers apparently
% don't use the highest reed in the five-reed version (I don't know
% whether there even are MIII-versions of the 7-register variant).
% This complicates the register symbol layout.  For better
% correspondence with four-reed instruments (which may be used to play
% the part after all), we use a symmetrical dot in that case.
%
% If you are not explicitly composing for a Morino with separate MIII,
% use the five reed variant of these glyphs.  This makes the Master
% setting immediately recognizable as Morino-specific.

#(define MorinoStdBassIV
  '((glyph . "accordion.accStdbase")
    (reedbank
     (Soprano (dots (0 . 3.5)))
     (Alto (dots (0 . 2.5)))
     (Tenor (dots (0 . 1.5)))
     (Bass (dots (0 . 0.5))))
    (register
     ("Alto" (reedbanks Alto Soprano))
     ("Tenor" (reedbanks Tenor Soprano))
     ("Master" (reedbanks Bass Tenor Alto Soprano))
     ("Soft Bass" (reedbanks Bass Tenor Alto))
     ("Soft Tenor" (reedbanks Tenor Alto)))))

#(define MorinoStdBassV
  '((glyph . "accordion.accStdbase")
    (reedbank
     (Sopranos (dots (-0.5 . 3.5) (0.5 . 3.5)))
     (Soprano (dots (0 . 3.5)))
     (Alto (dots (0 . 2.5)))
     (Tenor (dots (0 . 1.5)))
     (Bass (dots (0 . 0.5))))
    (register
     ("Bass/Alto" (reedbanks Bass Alto Soprano))
     ("Alto" (reedbanks Alto Sopranos))
     ("Tenor" (reedbanks Tenor Sopranos))
     ("Master" (reedbanks Bass Tenor Alto Sopranos))
     ("Soft Bass" (reedbanks Bass Tenor Alto))
     ("Soft Tenor" (reedbanks Tenor Alto))
     ("Soprano" (reedbanks Soprano)))))

% Golas are quite closer to standard registration, apparently.  We
% call an additional bass reed at Alto pitch "Contratenor".  For
% mostly esthetic reasons, we don't display it in the "Master"
% setting.  As a consequence, the register display is closer to
% standard as long as you don't use the rather special "Alto/Soprano"
% Gola register which has bass notes at Alto pitch and chords at
% Soprano pitch.

#(define GolaStdBassVI
  '((glyph . "accordion.accStdbase")
    (register
     ("Soprano" (reedbanks Soprano))
     ("Alto" (reedbanks Alto))
     ("Soft Tenor" (reedbanks Tenor Alto))
     ("Master" (reedbanks Bass Tenor Contralto Alto Soprano))
     ("Alto/Soprano" (reedbanks Contratenor Soprano))
     ("Bass/Alto" (reedbanks Bass Alto Soprano))
     ("Soft Bass" (reedbanks Bass Tenor Contralto)))
    (reedbank
     (Soprano (dots (0 . 3.5)))
     (Alto (dots (0 . 2.5)))
     (Contralto (dots (1 . 2)))
     (Contratenor (dots (-1 . 2.5)))
     (Tenor (dots (0 . 1.5)))
     (Bass (dots (0 . 0.5))))))

% The default Free Bass is modeled after the default Discant register
% description.
#(define defaultFreeBassII
  '((glyph . "accordion.accFreebase")
    (reedbank
     (L (dots (0 . 0.5)))
     (M (dots (0 . 1.5))))
    (register
     ("1" (reedbanks L))
     ("10" (reedbanks M))
     ("11" (reedbanks L M)))))

#(define-markup-command (register layout props name) (string?)
  (let* ((instrument (ly:assoc-get 'symbol (ly:chain-assoc-get 'accordion 
props)))
         (register (ly:assoc-get name (ly:assoc-get 'register instrument)))
         (reedbanks (ly:assoc-get 'reedbank instrument)))
   (interpret-markup layout props
    (let markup-builder ((dots
                          (or (ly:assoc-get 'dots register)
                           (append-map (lambda (x)
                                        (ly:assoc-get 'dots
                                         (ly:assoc-get x reedbanks)))
                            (ly:assoc-get 'reedbanks register))))
                         (result (markup #:musicglyph
                                  (ly:assoc-get 'glyph instrument))))
     (if (null? dots) result
      (markup-builder (cdr dots)
       (markup #:combine result
        #:translate (car dots) #:musicglyph "accordion.accDot")))))))

register =
#(define-music-function (parser position register) (string?)
  (make-music
   'TextScriptEvent
   'direction
   1
   'text
   (markup #:register register)))

setAccordion =
#(define-music-function (parser position accordion) (list?)
  #{
    \override Staff.TextScript #'accordion #'symbol = #$accordion
  #})

#(set-object-property! 'accordion 'backend-type? list?)

\new PianoStaff <<
  \set PianoStaff.instrumentName = #"Accordion"
  \new Staff { 
    \setAccordion #defaultDiscant
    d'4^\markup { \register #"12+1" }
    e' \register #"131" f'2
  }
  \new Staff {
    \clef bass
    \setAccordion #defaultFreeBassII
    \register #"10" c4
    \setAccordion #GolaStdBassVI
    <c e g>^\markup { \register #"Soft Bass" }
    \register #"Alto/Soprano" c2
    }
>>

-- 
David Kastrup

reply via email to

[Prev in Thread] Current Thread [Next in Thread]