lilypond-user
[Top][All Lists]
Advanced

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

Re: Including notes in rhythm indications


From: Thomas Morley
Subject: Re: Including notes in rhythm indications
Date: Sun, 29 Jan 2012 14:41:45 +0100

Hi Brent,

2012/1/29 Brent Annable <address@hidden>:
> Hi y'all,
>
> I'm trying to include a direction in the 'meter' section of the header block
> that says this:
>
> "Heavy four-beat swing (quaver[ quaver] = quaver[ quaver])"
>
>
> I tried following the instructions given
> at http://lsr.dsi.unimi.it/LSR/Item?u=1&id=204, but nothing would appear in
> the 'meter' heading at all. Here's a watered-down version of what I tried:
>
>
> rhythmMark = #(define-music-function (parser location label musicI musicII )
> (string? ly:music? ly:music?)
>    #{
>       \markup {
>         \line \vcenter {
>           \combine                     % 1st column in line
>             \italic \fontsize #rhythmMarkLabelFontSize $label
>             \transparent \italic \fontsize #rhythmMarkLabelFontSize f
>                 % This fakes a uniform baseline (ie. create common anchor
> for vcenter)
>
>           \score {                     % 2nd column in line
>             \new Staff \with {
>               fontSize = #rhythmMarkStaffReduce
>               \override StaffSymbol #'staff-space = #(magstep
> rhythmMarkStaffReduce)
>               \override StaffSymbol #'line-count = #0
>               \override VerticalAxisGroup #'Y-extent = #'(0 . 0)  % td
>               \override VerticalAxisGroup #'minimum-Y-extent = #'(0 . 0) %RV
>             }
>
>             \relative { \stemUp $musicI }
>
>             \layout {
>               ragged-right= ##t
>               indent = 0
>               \context {
>                 \Staff
>                 \remove "Clef_engraver"
>                 \remove "Time_signature_engraver" }
>             } % layout
>
>           } % 1st Score end
>
>           \hspace #-0.1                % 3rd column in line
>
>                                        % 4th column in line
>           \italic \fontsize #rhythmMarkStaffReduce "="
>
>           \score {                     % 5th column in line
>
>             \new Staff \with {
>               fontSize = #rhythmMarkStaffReduce
>               \override StaffSymbol #'staff-space = #(magstep
> rhythmMarkStaffReduce)
>               \override StaffSymbol #'line-count = #0
>               \override VerticalAxisGroup #'Y-extent = #'(0 . 0)  % td
>               \override VerticalAxisGroup #'minimum-Y-extent = #'(0 . 0) %RV
>             }
>
>             \relative { \stemUp $musicII }
>
>             \layout {
>               ragged-right= ##t
>               indent = 0
>               \context {
>                 \Staff
>                 \remove "Clef_engraver"
>                 \remove "Time_signature_engraver" }
>             } % layout end
>
>           } % 2nd Score end
>
>         } % line end
>       } % markup end
>    #})
>
> rhyMarkIIEighths = {
>   % \override Score.SpacingSpanner #'common-shortest-duration =
> #(ly:make-moment 1 4) % tight
>   \override Score.SpacingSpanner #'common-shortest-duration =
> #(ly:make-moment 3 16) % even
>   b'8[ b8]
> }
>
>  \header {
>  title = "My piece"
>  meter = \rhythmMark #"Heavy four-beat swing" \rhyMarkIIEighths
> \rhyMarkIIEighths
> }
>
>  \score {
>  \relative c' {c1}
> }
>
>
> I'm afraid I don't have a programming background, so when things get
> complicated like this, I hit a dead-end pretty quickly. Can somebody help?
>
> Many thanks,
>
> Brent.
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>

1. You omitted the version. There some commands in the LSR-snippet
which will not work with 2.14.2.
2. The meter-variable of the header expects a markup. \rhythmMark is a
function that returns music. So it doesn't work that easy.
3. If you really want to do it this way, you have to create a markup
containing a score. In this score you can call \rhythmMark which
creates a markup containing some other scores.

This is not very nice. Why not use \rhythmMark as a RehearsalMark as
suggested by the LSR-snippet?

Anyway, below a working solution. Please note that I limited my
activity to make it work. (You forgot some needed settings from the
snippet, commented/enframed  with %!) I didn't simplify or improve
anything else.

\version "2.14.2"
%!
        rhythmMarkStaffReduce = #-3
        rhythmMarkLabelFontSize = #-2
%!
rhythmMark = #(define-music-function (parser location label musicI musicII )
        (string? ly:music? ly:music?)
   #{
%!
      \mark
%!
        \markup {
        \line \vcenter {
          \combine                     % 1st column in line
            \italic \fontsize #rhythmMarkLabelFontSize $label
            \transparent \italic \fontsize #rhythmMarkLabelFontSize f
                % This fakes a uniform baseline (ie. create common
anchor for vcenter)

          \score {                     % 2nd column in line
            \new Staff \with {
              fontSize = #rhythmMarkStaffReduce
              \override StaffSymbol #'staff-space = #(magstep
rhythmMarkStaffReduce)
              \override StaffSymbol #'line-count = #0
              \override VerticalAxisGroup #'Y-extent = #'(0 . 0)  % td
%!              \override VerticalAxisGroup #'minimum-Y-extent = #'(0 . 0) %RV
            }

            \relative { \stemUp $musicI }

            \layout {
              ragged-right= ##t
              indent = 0
              \context {
                \Staff
                \remove "Clef_engraver"
                \remove "Time_signature_engraver" }
            } % layout

          } % 1st Score end

          \hspace #-0.1                % 3rd column in line

                                       % 4th column in line
          \italic \fontsize #rhythmMarkStaffReduce "="

          \score {                     % 5th column in line

            \new Staff \with {
              fontSize = #rhythmMarkStaffReduce
              \override StaffSymbol #'staff-space = #(magstep
rhythmMarkStaffReduce)
              \override StaffSymbol #'line-count = #0
              \override VerticalAxisGroup #'Y-extent = #'(0 . 0)  % td
%!              \override VerticalAxisGroup #'minimum-Y-extent = #'(0 . 0) %RV
            }

            \relative { \stemUp $musicII }

            \layout {
              ragged-right= ##t
              indent = 0
              \context {
                \Staff
                \remove "Clef_engraver"
                \remove "Time_signature_engraver" }
            } % layout end

          } % 2nd Score end

        } % line end
      } % markup end
   #})

rhyMarkIIEighths = {
  % \override Score.SpacingSpanner #'common-shortest-duration =
#(ly:make-moment 1 4) % tight
  \override Score.SpacingSpanner #'common-shortest-duration =
#(ly:make-moment 3 16) % even
  b'8[ b8]
}

meterScoreMarkup = \markup {·
         \score {
                 \new Staff {
                 s \rhythmMark #"Heavy four-beat swing" \rhyMarkIIEighths
\rhyMarkIIEighths
                 }
            \layout {
                 \context {
                         \Staff
                           \remove "Clef_engraver"
                           \remove "Time_signature_engraver"
                           \remove "Staff_symbol_engraver"
                 }
            }
         }
}

\header {
        title = "My piece"
        meter = \meterScoreMarkup
}

\score {
        \relative c' { c1 }
}



HTH,
  Harm



reply via email to

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