lilypond-user
[Top][All Lists]
Advanced

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

Re: Please help


From: Thomas Morley
Subject: Re: Please help
Date: Sat, 30 Nov 2013 00:40:47 +0100




2013/11/29 Mateusz Goździewski <address@hidden>
Could you help me with a code in lilypond?

How I need to enter the code to get this effect:
Obraz w treści 1or this
Obraz w treści 2


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

Hi,

how about:

\version "2.17.95"

alternativeKey =
#(define-music-function (parser location p-1 p-2)(ly:pitch? ly:pitch?)
#{
  \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))
             (stil-to-add
               (grob-interpret-markup grob
                 #{
                   \markup
                     \score {
                       { \key $p-2 \major s4 }
                       \layout {
                         \override Staff.TimeSignature #'stencil = ##f
                         \override Staff.Clef #'stencil = ##f
                         \override Staff.StaffSymbol #'line-count = #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)))
      (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)))
         
  \key $p-1 \major
#})

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

\relative c' {
    \alternativeKey fis f
    c1
    \alternativeKey b bes
    c
    \alternativeKey e ees
    c
    \alternativeKey a aes
    c
    \alternativeKey d des
    c
    \alternativeKey g ges
    c
    \alternativeKey c ces
    c
    \alternativeKey ges g
    c1
    \alternativeKey des d
    c
    \alternativeKey aes a
    c
    \alternativeKey ees e
    c
    \alternativeKey bes b
    c
    \alternativeKey f fis
    c
    \alternativeKey ces cis
    c
}

Thanks David Kastrup for his improved \score-markup-command.
Please all have a look at
http://lilypond.1069038.n5.nabble.com/Supporting-my-work-on-LilyPond-financially-td154644.html
and consider support.

Cheers,
  Harm



reply via email to

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