[Top][All Lists]

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

Re: Special Accidental Macro needed.

From: Rune Zedeler
Subject: Re: Special Accidental Macro needed.
Date: Sat, 07 Dec 2002 04:40:58 +0100

After a small bugfix in the accidental engraver (1.7 cvs), this hack
does more or less what you request.
The last measure shows an example where it goes wrong. Problem is that
the music is parsed "in input order" - so the 2nd e gets an accidental
because the 1st was not entered yet, whereas the first does not get an
accidental because it is defined right after the 2nd. But if you use
simple constructs then it should work... Hmmm... Otherwise then speak

\version "1.7.6"

#(define usep '())
#(define buildp '()) 
#(define ((schoenberg-accidentals clear) music)
  (let* ((es (ly:get-mus-property music 'elements))
         (e (ly:get-mus-property music 'element))
         (p  (ly:get-mus-property music 'pitch))
         (ts  (ly:get-mus-property music 'types)))

    (if (memq 'note-event ts) 
          (set! buildp (cons p buildp))
          (if (not (member p usep))
              (ly:set-mus-property! music 'force-accidental #t))))

    (if (ly:music? e)
         music 'element
         ((schoenberg-accidentals clear) e)))

    (if (pair? es)
         music 'elements
         (map (schoenberg-accidentals (memq 'sequential-music ts)) es)))

    (if clear (begin (set! usep buildp) (set! buildp '())))


music = \notes \transpose c c' { c d d e <a c' e'> <a c' e'> <a c' d' f'> <a c' 
e'> < { c c d d } { a a b a } > | < { c'2 e' } { e' g'} > }

\score {
  \apply #(schoenberg-accidentals #t)
      \property Score.autoAccidentals = \turnOff
  \paper { linewidth = -1. }

reply via email to

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