lilypond-user
[Top][All Lists]
Advanced

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

Custom note heads in multi-staff documents


From: address@hidden
Subject: Custom note heads in multi-staff documents
Date: Tue, 20 Sep 2011 21:31:38 +0200

Hey all,

I'm working on a piece that uses a fair bit of spoken text.

The best solution I've found so far to typeset X amount of spoken text in 
measure Y is :

\version "2.14.0"

textnote =
#(define-music-function (parser location music marky) (ly:music? markup?)
#{
  \once \override NoteHead #'stencil = #ly:text-interface::print
  \once \override NoteHead #'text = $marky
  $music
#})

#(define-markup-command (hD layout props) () (interpret-markup layout props 
(markup #:hspace 5)))

\new Staff {
  \textnote b'1 \markup { \hD \hD Attention \hD K-Mart \hD shoppers. }
  \textnote b'1 \markup { \hD \hD Today's \hD Blue \hD Light }
  \textnote b'1 \markup { special \hD can \hD be \hD found \hD in }
  \textnote b'1 \markup { asile \hD seven. \hD \hD }
  \textnote b'1 \markup { Asile \hD seven, \hD K-Mart \hD shoppers. }
}


So far so good.  However, as soon as a second staff is added, the spacing goes 
out of whack.

\version "2.14.0"

textnote =
#(define-music-function (parser location music marky) (ly:music? markup?)
#{
  \once \override NoteHead #'stencil = #ly:text-interface::print
  \once \override NoteHead #'text = $marky
  $music
#})

#(define-markup-command (hD layout props) () (interpret-markup layout props 
(markup #:hspace 5)))

<<
\new Staff {
\repeat unfold 40 a8
}
\new Staff {
  \textnote b'1 \markup { \hD \hD Attention \hD K-Mart \hD shoppers. }
  \textnote b'1 \markup { \hD \hD Today's \hD Blue \hD Light }
  \textnote b'1 \markup { special \hD can \hD be \hD found \hD in }
  \textnote b'1 \markup { asile \hD seven. \hD \hD }
  \textnote b'1 \markup { Asile \hD seven, \hD K-Mart \hD shoppers. }
}
>>

I'm not sure how to get the spacing of the first example while keeping the 
multi-staffitude of the second example.  For the geeks on the list, 
ly:text-interface::print is registered as a pure print callback, so it should 
get fed just fine into the horizontal spacing engine in both examples.

Does anyone have any suggestions as to:

(1) A better way to do this; and/or
(2) If there is no better way, how to fix the horizontal spacing problem above?

Cheers,
MS




reply via email to

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