Valentin
Attached is a version of snippet 204 that works better with 2.11. I did
this some time ago, but forgot to send it. It's still not quite perfect,
though. I've annotated the extra statements with % td and commented out
those that need to be removed in case anyone wishes to see the changes. You
may want to edit these out or even fiddle with it a little more before
adding it to the 2.11 snippet list.
Trevor
----- Original Message -----
From: "Risto Vääräniemi" <[EMAIL PROTECTED]>
To: "Trevor Daniels" <[EMAIL PROTECTED]>
Cc: "Matthias Loitsch" <[EMAIL PROTECTED]>;
<lilypond-user@gnu.org>
Sent: Thursday, April 10, 2008 8:29 AM
Subject: Re: Metronome marks
On 08/04/2008, Trevor Daniels wrote:
It's possible (most things are in LilyPond) but it's not easy (at least
I
don't know an easy way). Essentially you have to create a tiny score
without a staff, etc. Have a look at
http://lsr.dsi.unimi.it/LSR/Item?id=204
This should give you some clues, or maybe easier, you can simply copy
out
the functions and use them.
The snippet 204 doesn't work very well with 2.11 because it uses
negative padding to position the rhythm mark closer to the staff and
that's not supported by 2.11.
I fiddled with it a bit and found out that if the VerticalAxisGroup
#'Y-extent and VerticalAxisGroup #'minimum-Y-extent are set to #'(0 .
0) the output is more or less agreeable.
The mark is positioned a bit to the right from the center of the note
center, possibly because of the two \hspace #0 (they, or something
else, must be there, otherwise the layout breaks).
-Risto
%%%%%%%
\version "2.11.43"
rhythmMarkStaffReduce = #-4
rhythmMarkLabelFontSize = #-3
rhythmMark = \markup
{
\line \vcenter
{
\combine % 1st column in line
\hspace #0
\hspace #0
% 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)
\override VerticalAxisGroup #'minimum-Y-extent = #'(0 . 0)
}
\relative c'' { \stemUp b8[ b] }
\layout {
ragged-right= ##t
indent = 0
\context
{
\Staff
\remove "Clef_engraver"
\remove "Time_signature_engraver"
}
} % layout
} % 1st Score end
\hspace #0
\italic \fontsize #rhythmMarkStaffReduce \column { "=" " " }
\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)
\override VerticalAxisGroup #'minimum-Y-extent = #'(0 . 0)
}
\relative c'' { \stemUp \times 2/3 { b4 b8 } }
\layout
{
ragged-right= ##t
indent = 0
\context
{
\Staff
\remove "Clef_engraver"
\remove "Time_signature_engraver"
}
} % layout end
} % 2nd Score end
} % line end
} % markup end
\relative c'
{
c4^\rhythmMark
}
%%%%%%%
%%% Function: rhythmMark
%%% ============================================================
%%% Purpose: print a sophisticated rehearsal mark e.g
%%% for rhythm directives
%%% Usage: \rhythmMark label music1 music2
%%% ------------------------------------------------------------
%%% Variable: label (string)
%%% ------------------------------------------------------------
%%% Variable: music1 (ly:music)
%%% ------------------------------------------------------------
%%% Variable: music2 (ly:music)
%%% ------------------------------------------------------------
%%% Example: \rhythmMark #"Swing" \rhyMarkIIEighths
%%% \rhyMarkSlurredTriplets
%%% ------------------------------------------------------------
%%% Constants:
%%% rhythmMarkStaffReduce = #-3
%%% rhythmMarkLabelFontSize = #-2
%%% ------------------------------------------------------------
%%% Comment: see below for predefined values for music1&2
%%% ============================================================
% \version "2.11.43"
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
}
\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
}
\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
#})
%%% Function: rhythmMarkC
%%% ============================================================
%%% Purpose: print a sophisticated rehearsal mark e.g for
%%% rhythm directives in a column (music on top)
%%% Usage: \rhythmMarkC label music1 music2
%%% ------------------------------------------------------------
%%% Variable: label (string)
%%% ------------------------------------------------------------
%%% Variable: music1 (ly:music)
%%% ------------------------------------------------------------
%%% Variable: music2 (ly:music)
%%% ------------------------------------------------------------
%%% Example: \rhythmMarkC #"Swing" \rhyMarkIIEighths
%%% \rhyMarkSlurredTriplets
%%% ------------------------------------------------------------
%%% Constants:
%%% rhythmMarkCStaffReduce = #-4
%%% rhythmMarkCLabelFontSize = #-2
%%% ------------------------------------------------------------
%%% Comment: see below for predefined values for music1&2
%%% ============================================================
rhythmMarkCStaffReduce = #-4
rhythmMarkCLabelFontSize = #-2
rhythmMarkC = #(define-music-function (parser location label musicI musicII ) (string? ly:music? ly:music?)
#{
\mark \markup
{
\combine
\line {
\hspace #0
\translate #'(-0.1 . -3.25) \italic \fontsize #rhythmMarkCLabelFontSize $label
} % end Line
\line \vcenter {
\score { % 1st column in line
\new Staff \with {
fontSize = #rhythmMarkCStaffReduce
\override StaffSymbol #'staff-space = #(magstep rhythmMarkCStaffReduce)
\override StaffSymbol #'line-count = #0
\override VerticalAxisGroup #'Y-extent = #'(0 . 0) % td
}
\relative { \stemUp $musicI }
\layout {
ragged-right= ##t
indent = 0
\context {
\Staff
\remove "Clef_engraver"
\remove "Time_signature_engraver" }
} % layout
} % 1st score
\hspace #-0.1 % 2nd column in line
% 3rd column in line
\italic \fontsize #rhythmMarkCStaffReduce "="
\score { % 4th column in line
\new Staff \with {
fontSize = #rhythmMarkCStaffReduce
\override StaffSymbol #'staff-space = #(magstep rhythmMarkCStaffReduce)
\override StaffSymbol #'line-count = #0
\override VerticalAxisGroup #'Y-extent = #'(0 . 0) % td
}
\relative {
\stemUp $musicII
}
\layout {
ragged-right= ##t
indent = 0
\context {
\Staff
\remove "Clef_engraver"
\remove "Time_signature_engraver" }
} % layout
} % 2nd score end
} % line end
% end combine
} % markup end
#})
%%% predefined ly:music-Variables for use
%%% in function rhythmMark and rhythmMarkC
%%% ============================================================
rhyMarkI = { b'1 }
rhyMarkII = { b'2 }
rhyMarkIV = { b'4 }
rhyMarkEighth = { b'8 }
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]
}
rhyMarkTriplets = {
% \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 2) % super-tight
% \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 4) % tight
\override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 3 16) % even
\times 2/3 { b'4 b8 }
}
rhyMarkSlurredTriplets = {
% \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 4) % tight
% \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 5 32) % slighty tighter as even
\override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 8) % even
\times 2/3 { b'8 ~ b8 b8 }
}
rhyMarkDottedEighths = {
% \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 4) % tight
\override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 3 16) % even
% \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 8) % loose
{ b'8. b16 }
}
%%% Begin Example
%%% ============================================================
spacer = {
| g'1
\noBreak
| g'1
| g'1
}
spacerII = {
| g'1
\noBreak
| g'1
}
\score {
{
\override Score.RehearsalMark #'self-alignment-X = #LEFT
\override Score.BarNumber #'break-visibility = #all-invisible
% \override Score.RehearsalMark #'padding = #-2
\once \override Score.RehearsalMark #'X-offset = #5 % td
\rhythmMark #"Swing" \rhyMarkIIEighths \rhyMarkSlurredTriplets
\spacer
\rhythmMark #"straight" \rhyMarkEighth \rhyMarkEighth
\spacer
\rhythmMark #"Shuffle" \rhyMarkIIEighths \rhyMarkDottedEighths
\spacer
\once \override Score.RehearsalMark #'X-offset = #5 % td
\rhythmMark #"straight" \rhyMarkIIEighths \rhyMarkIIEighths
\spacer
\rhythmMark #"Swing" \rhyMarkIIEighths \rhyMarkTriplets
\spacer
\rhythmMark #"in 2" \rhyMarkII \rhyMarkIV
\spacer
\once \override Score.RehearsalMark #'X-offset = #5 % td
\rhythmMark #"Swing feel" \rhyMarkDottedEighths \rhyMarkTriplets
\spacer
\rhythmMark #"Maestoso" \rhyMarkII \rhyMarkI
\spacer
\rhythmMark #"suassa" \rhyMarkII \rhyMarkI % This is just to proof that the basline-fake really works
\spacer
\once \override Score.RehearsalMark #'X-offset = #5 % td
\break
\rhythmMarkC #"Swing" \rhyMarkIIEighths \rhyMarkSlurredTriplets
\spacerII
\rhythmMarkC #"straight" \rhyMarkEighth \rhyMarkEighth
\spacerII
\rhythmMarkC #"Shuffle" \rhyMarkIIEighths \rhyMarkDottedEighths
\spacerII
\rhythmMarkC #"straight" \rhyMarkIIEighths \rhyMarkIIEighths
\spacerII
\rhythmMarkC #"Swing" \rhyMarkIIEighths \rhyMarkTriplets
\spacerII
\rhythmMarkC #"in 2" \rhyMarkII \rhyMarkIV
\spacerII
\once \override Score.RehearsalMark #'X-offset = #5 % td
\rhythmMarkC #"Swing feel" \rhyMarkDottedEighths \rhyMarkTriplets
\spacerII
\rhythmMarkC #"Maestoso" \rhyMarkII \rhyMarkI
\spacerII
}
\layout {
ragged-right= ##t
indent = 0
}
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user