lilypond-devel
[Top][All Lists]
Advanced

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

proposal for a \magnifyMusic command


From: Mark Polesky
Subject: proposal for a \magnifyMusic command
Date: Wed, 14 May 2014 16:21:57 -0700 (PDT)

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
    }
  >>
>>

Attachment: magnifyMusic.png
Description: PNG image


reply via email to

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