lilypond-user
[Top][All Lists]
Advanced

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

Re: enlarge vertical distance in time signature


From: Stefan Thomas
Subject: Re: enlarge vertical distance in time signature
Date: Mon, 29 Oct 2012 00:15:11 +0100

Dear Thomas,
thanks very much for Your code, again!
The problem is:
I would like to have a score with drumstaff and a "normal" staff. And only in the normal Staff shall be a wider time signature.
I give you an short example:
global = {
        \time #'(4 3) 7/8
    s2..
    \time #'(2 2 2 3) 9/8
    s8*9
}

drumnotes = \drummode {
  wbl4 wbl wbh4.
  \repeat "unfold" 3 {wbl4 } wbh4.
}
somenotes = \relative c' {
  c4 b c4 d8
  e4 e f e8 d c
}
\score {
  <<
    \new Devnull \global
  \new Staff \somenotes
\new DrumStaff \with {
        \override StaffSymbol #'line-count = #6
%         \widerTimeSignature #3 % this doesn't work!
} { \drumnotes }
>>
}


2012/10/28 Thomas Morley <address@hidden>
2012/10/28 Stefan Thomas <address@hidden>:
> Dear Thomas,
> thanks for Your code!
> I think the code is not the best for my special aim.
> I just want to have a different time-signature style for a custom percussion
> staff with 6 instead of five lines.
> So, I just would like to change this special thing only in this staff. I
> would like to do this in the "with" block, if possible.
> The timesignatures itself are defined in a global variable.
>
> 2012/10/28 Thomas Morley <address@hidden>
>>
>> 2012/10/28 Stefan Thomas <address@hidden>:
>> > Dear community,
>> > I would like to know how to enlarge the vertical distance between
>> > enumerator
>> > and denominator of a time signature.
>> > I hope, this will be possible.
>> >
>> > _______________________________________________
>> > lilypond-user mailing list
>> > address@hidden
>> > https://lists.gnu.org/mailman/listinfo/lilypond-user
>> >
>>
>> Hi Stefan,
>>
>> try:
>>
>> \version "2.16.0"
>>
>> spreadTimeSignature =
>> #(define-music-function (parser location baselineSkip strg
>> music)(number? string? ly:music?)
>> (let* ((num (car (string-split strg #\/)))
>>        (denom (cadr (string-split strg #\/))))
>> #{
>>    \override Staff.TimeSignature #'stencil =
>>      #(lambda (grob)
>>         (grob-interpret-markup grob
>>                        #{
>>                         \markup %\fontsize #5
>>                           \vcenter
>>                           \override #`(baseline-skip . ,baselineSkip)
>>                           \column {
>>                                   \number $num
>>                                   \number $denom
>>                           }
>>                        #}))
>>    $(make-music
>>        'TimeSignatureMusic
>>        'beat-structure '()
>>        'denominator (string->number denom)
>>        'numerator (string->number num))
>>
>>    $music
>> #}))
>>
>> % ---------------- test
>>
>> \relative c' {
>>         \spreadTimeSignature #8 "2/4"
>>         c8 c c c
>>
>>         \spreadTimeSignature #8 "3/4"
>>         c16 c c c   c c c c c4
>> }
>>
>>
>> Usage: \spreadTimeSignature #<baseline-skip> "<time>"
>>
>> Setting \time is integrated in the function.
>> There might arise a problem because of
>>     'beat-structure '()
>> If so, delete
>>    $(make-music
>>        'TimeSignatureMusic
>>        'beat-structure '()
>>        'denominator (string->number denom)
>>        'numerator (string->number num))
>>
>>    $music
>> and use default \time x/y after the function-call.
>>
>>
>> HTH,
>>   Harm
>
>

How about:

\version "2.16.0"

widerTimeSignature =
#(define-music-function (parser location baseline-skip music)(number? ly:music?)
  (let* ((num (number->string (ly:music-property music 'numerator)))
         (denom (number->string (ly:music-property music 'denominator))))
 #{
     \override Staff.TimeSignature #'stencil =
       #(lambda (grob)
          (grob-interpret-markup grob
                         #{
                                \markup
                                  \vcenter
                                  \override #`(baseline-skip . ,baseline-skip)
                                  \column {
                                          \number $num
                                          \number $denom
                                  }
                         #}))
    $music
 #}))

% ---------------- test

global = {
        \widerTimeSignature #3
        \time 15/16
}

\new DrumStaff \with {
        \override StaffSymbol #'line-count = #6
        % \widerTimeSignature #3
        % \time 15/16
}

{ \global \drummode {  bd4  sn  bd toml8 toml bd } }

With the possibility to place \widerTimeSignature in \global or in \with.
Using the latter there's need to write the TimeSignature after
\widerTimeSignature.


Cheers,
 Harm


reply via email to

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