lilypond-user
[Top][All Lists]
Advanced

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

Re: Please help


From: Simon Albrecht
Subject: Re: Please help
Date: Mon, 09 Mar 2015 11:52:21 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

Hello anonymus,

everything is alright with your code, except for one thing: the lines beginning with (at least one) ";" must not be broken, since they are comments; they serve as explanations to any human reading the code, but the program ignores them. However, commenting out with ";" only works till the end of the line; if a line break is inserted, Lily will try to interpret the part after the break, which to her doesn’t make any sense.
I attached a corrected version.

Happy coding,
Simon

Am 09.03.2015 um 10:31 schrieb magohq:
*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.

_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user

Attachment: careful-with-scm-comments.ly
Description: Text Data


reply via email to

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