proposal for a \magnifyMusic command

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

proposal for a \magnifyMusic command

Mark Polesky
Hi,

I'm trying to clarify the docs on the (unclear) topic of
changing the notation font size.  While experimenting with
ideas, I typesetted the opening of Chopin's Prelude op.28
no.8, which combines multiple notation sizes on one staff.

There is no flexible, user-friendly way of doing that
(setting fontSize alone doesn't address beams/stems), so I
came up with \magnifyMusic, which takes a magnification
factor and does the dirty work behind the scenes (similar to
the CueVoice definition in engraver-init.ly).

I have found at least two problems with my approach:
1) when different sized note heads merge, the smaller
     voice's stem ends up in the wrong place.
2) when different sized accidentals "merge", both get
   printed (the smaller one should be suppressed)

Is there an elegant way to solve either of these problems,
out of sight from the user, without the need for so many
tweaks?

Thanks
- Mark

____________________________________________________________

Here's my code:

\version "2.19.5"
\language "english"

magnifyMusic =
#(define-scheme-function
     (parser location mag)
     (number?)
   #{
      \set fontSize = #(magnification->font-size mag)
      \override Stem.length-fraction = #mag
      \override Beam.length-fraction = #mag
      % gives beam-thickness=0.48 when mag=1 (like default),
      % gives beam-thickness=0.35 when mag=0.63 (like CueVoice)
      \override Beam.beam-thickness = #(+ 119/925 (* mag 13/37))
   #})

shift =
#(define-scheme-function (parser location) ()
   #{ \once \override NoteColumn.force-hshift = #0.35 #})

<<
  \new Staff <<
    \key fs \minor
    \mergeDifferentlyDottedOn
    \override Staff.TimeSignature.break-visibility = ##(#f #f #t)
    \omit Score.BarNumber
    \new Voice \relative {
      \voiceOne
      \magnifyMusic 0.63
      \mark "desired:"
      \shift cs'32( cs' gs b a fs \shift d d'
      \shift cs, cs' gs b a gs \shift fs fs'
      \shift fs, fs' as, cs b gs \shift \once \omit Accidental es es'
      \shift \once \omit Accidental a, a' bs, d cs b \shift gs gs')
      \mark "without tweaks:"
      \time 4/4
      cs,,32( cs' gs b a fs d d'
      cs, cs' gs b a gs fs fs'
      fs, fs' as, cs b gs es es'
      a, a' bs, d cs b gs gs')
    }
    \new Voice \relative {
      \voiceTwo
      cs'8.  d16 cs8. fs16 fs8. es16 a8. gs16
      cs,8.  d16 cs8. fs16 fs8. es16 a8. gs16
    }
  >>
>>

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel

magnifyMusic.png (101K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: proposal for a \magnifyMusic command

Mark Polesky
Okay, so I was able to suppress the smaller accidentals with
some scheme code, now all I need to do is figure out how to
align the stems properly:

Currently, merged note heads with different stem-directions
are left-aligned with each other, even if they have
different font-sizes.  However, when the note head sizes
differ, if the smaller note head is stemmed up, it should be
*right-aligned* with the larger note head.  Conversely, if
the smaller note head is stemmed down, it should be
*left-aligned* with the larger note head.

How can I get LilyPond to align the stems this way without
needing a new tweak every time there's a merge?  If there is
a way to access one NoteHead grob from another NoteHead grob
that it is merged with, I could probably do it myself in
scheme; but is there a way?  Here's the code for the
attached merge-alignment.png file:

\new Staff <<
  \new Voice {
    \override NoteHead.layer = 2
    \override Stem.layer = 2
    \set fontSize = -4
    \voiceOne b'4 \voiceTwo b'
  }
  \new Voice {
    \override NoteHead.color = #red
    \override Stem.color = #red
    \voiceTwo b'4 \voiceOne b'
  }
>>

I think it would be great to offer the \magnifyMusic
feature, since this type of notation is fairly common (at
least in the mid- to late-Romantic piano repertoire) but the
stem alignment needs to be solved first.

Thanks!  
- Mark
_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel

merge-alignment.png (6K) Download Attachment
magnifyMusic.ly (4K) Download Attachment
magnifyMusic.png (112K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: proposal for a \magnifyMusic command

Mark Polesky
Mark Polesky wrote:
> How can I get LilyPond to align the stems this way without
> needing a new tweak every time there's a merge?

Anyone?

http://lists.gnu.org/archive/html/lilypond-devel/2014-05/msg00141.html
http://lists.gnu.org/archive/html/lilypond-user/2014-05/msg00438.html

- Mark

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel