lilypond-user
[Top][All Lists]
Advanced

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

Re: Please help


From: magohq
Subject: Re: Please help
Date: Mon, 9 Mar 2015 02:31:25 -0700 (MST)

*code does not work in the bass clef for example: *

*Key signature are not these lines*

\version "2.17.95"

alternativeKey =
#(define-music-function (parser location p-1 p-2 scale-def)
     (ly:pitch? ly:pitch? list?)
#{
  \override Staff.KeySignature #'stencil =
   #(lambda (grob)
      (let* ((staff-space (ly:staff-symbol-staff-space grob))
             (line-thickness (ly:staff-symbol-line-thickness grob))
             (th line-thickness)
             (default-stil (ly:key-signature-interface::print grob))
             ;; To avoid programming error @code{(markup #:null)} is
returned if
             ;; the scale would not result in printed KeySignature.
             ;; TODO: add the other scales: ionian, locrian etc
             (stil-to-add
               (grob-interpret-markup grob
                 (if (or (and (= (ly:pitch-notename p-2) 5)
                              (eq? scale-def minor))
                         (and (= (ly:pitch-notename p-2) 0)
                              (eq? scale-def major)))
                 (markup #:null)
                 #{
                   \markup
                     \score {
                       { \key $p-2 $scale-def }
                       \layout {
                         \override Staff.TimeSignature #'stencil = ##f
                         \override Staff.Clef #'stencil = ##f
                         \override Staff.StaffSymbol #'line-count = #0
                         indent = 0
                       }
                   }
                 #})
                 ))
             (stil-to-add-x-ext (ly:stencil-extent stil-to-add X))
             (stil-to-add-y-ext (ly:stencil-extent stil-to-add Y))
             )
    (if (< 0 (interval-length stil-to-add-x-ext))
        (if (or (and (= (ly:pitch-notename p-1) 5)
                     (eq? scale-def minor))
                (and (= (ly:pitch-notename p-1) 0)
                     (eq? scale-def major)))
            (bracketify-stencil
                      (ly:make-stencil
                        (ly:stencil-expr stil-to-add)
                        ;; left bracket is to far away
                        ;; trimmed a little
                        (cons
                           (+ (car stil-to-add-x-ext) (* 0.7 staff-space) )
                           (cdr stil-to-add-x-ext))
                        ;; adjusting the top and bottom ending of the
bracket
                        (cons
                           (+ (car stil-to-add-y-ext) (* 0.2 staff-space))
                           (- (cdr stil-to-add-y-ext) (* 0.5 staff-space))))
                      Y th (* 2.5 th) th)
            (ly:stencil-combine-at-edge
              default-stil
              X
              RIGHT
              (bracketify-stencil
                (ly:make-stencil
                  (ly:stencil-expr stil-to-add)
                  ;; left bracket is to far away
                  ;; trimmed a little
                  (cons
                     (+ (car stil-to-add-x-ext) (* 0.7 staff-space) )
                     (cdr stil-to-add-x-ext))
                  ;; adjusting the top and bottom ending of the bracket
                  (cons
                     (+ (car stil-to-add-y-ext) (* 0.2 staff-space))
                     (- (cdr stil-to-add-y-ext) (* 0.5 staff-space))))
                Y th (* 2.5 th) th)
                1))
      default-stil)))

  \key $p-1 $scale-def
#})

%%%%%%%%%%%%%%
% EXAMPLES
%%%%%%%%%%%%%%

\relative c {
  
  \clef bass 
    \alternativeKey d dis \minor
    c d e
} 

\relative c {
  
  \clef bass 
    \alternativeKey g ges \major
    c d e
} 

*Key signature are not these lines*




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/double-key-signature-tp154623p172854.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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