lilypond-user
[Top][All Lists]
Advanced

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

Re: Align above "current" staff


From: Martín Rincón Botero
Subject: Re: Align above "current" staff
Date: Mon, 28 Sep 2020 10:10:15 +0200

Thank you David for this example. I agree with Aaron that ossia notes should be first when the ossia measure goes above the music. That way you have a similar "feeling" of the \relative effect as when using << { %abovemusic} \\ {%belowmusic} >>. However, I went ahead, and, for the sake of completeness, split Aaron's code into two functions, namely \ossiaAbove and \ossiaBelow, because both options should be available (writing f. ex. ossia measures for the left hand of the piano is usually done below the staff). The below ossia poses the question "should notes be written first or after?". By analogy to the << {} \\ {} >> construction, I think they should be written after, since they're some sort of "below" or "second" voice. In that case, as David suggests, an independent \relative block should always be used:

\version "2.20.0"

\layout {
   \context {
     \Staff
     \name OssiaStaff
     \alias Staff
     \remove "Time_signature_engraver"
     \magnifyStaff #2/3
     %\hide Clef
     %firstClef = ##f
     instrumentName = "ossia"
     shortInstrumentName = "ossia"
   }
   \inherit-acceptability OssiaStaff Staff
}

ossiaAbove =
#(define-music-function
   (ossia-music music)
   (ly:music? ly:music?)
   (let ((staff-name #f)
         (clef-props '(clefGlyph
                       middleCClefPosition
                       clefPosition
                       clefTransposition
                       clefTranspositionStyle)))
     (define (initialize context)
       (set! staff-name
         (ly:context-id (ly:context-find context 'Staff)))
       (set! clef-props
         (map (lambda (prop)
                (cons prop (ly:context-property context prop)))
              clef-props)))
     (define (update context)
       (ly:context-set-property! context
         'alignAboveContext staff-name)
       (for-each (lambda (prop)
                   (ly:context-set-property! context
                     (car prop) (cdr prop)))
                 clef-props)
       (ly:set-middle-C! context))
     #{ \applyContext #initialize
        << \new OssiaStaff
             \with #(ly:make-context-mod `((apply ,update)))
             { #ossia-music }
           #music >> #}))

ossiaBelow =
#(define-music-function
   (ossia-music music)
   (ly:music? ly:music?)
   (let ((staff-name #f)
         (clef-props '(clefGlyph
                       middleCClefPosition
                       clefPosition
                       clefTransposition
                       clefTranspositionStyle)))
     (define (initialize context)
       (set! staff-name
         (ly:context-id (ly:context-find context 'Staff)))
       (set! clef-props
         (map (lambda (prop)
                (cons prop (ly:context-property context prop)))
              clef-props)))
     (define (update context)
       (ly:context-set-property! context
         'alignBelowContext staff-name)
       (for-each (lambda (prop)
                   (ly:context-set-property! context
                     (car prop) (cdr prop)))
                 clef-props)
       (ly:set-middle-C! context))
     #{ \applyContext #initialize
        << \new OssiaStaff
             \with #(ly:make-context-mod `((apply ,update)))
             { #music }
           #ossia-music >> #}))

<<
\new StaffGroup \with {
  \override SystemStartBracket.stencil = ##f
  \override SpanBar.glyph-name = #"!"
}
  <<
  \new Staff = "violin"
  \relative {
   c'4 d e g
   f d e g
   f d e g
   \time 3/4
    c b c  
   \time 4/4
   \ossiaAbove {c b c2 } {e4 f g2}
}
  >>

\new StaffGroup \with {
  \override SystemStartBracket.stencil = ##f
  \override SpanBar.glyph-name = #"!"
} <<

\new Staff = "viola"
\relative {
   \clef alto
   c'4 d e g
   f d e g
   f d e g
   \time 3/4
   \ossiaBelow { e d f  }
     \relative { c' b c  }
   \time 4/4
   c b c2
}
  >> >>

image.png


I'd love to see these functions together with the new OssiaStaff context incorporated into Lilypond by default. Doing so wouldn't only provide a syntax for ossias and a useful new context but would also bring the necessary attention that the respective part in the manual is currently in need of.

Best regards,
Martín.


Am Mo., 28. Sept. 2020 um 08:33 Uhr schrieb Aaron Hill <lilypond@hillvisions.com>:
On 2020-09-27 7:35 pm, David Wright wrote:
> I'm not sure that it does produce clarity (as opposed to merely
> explaining the unreliability in perception). Would it not be
> clearer to put the ossia music inside a \relative{}, so that
> the main sequence of pitches carries through undisturbed, and
> the ossia has its correct octave specified within itself, locally.
>
> I always think it rather risky to put structure inside \relative{},
> rather than putting the \relative{}s inside the structure.

\relative is nothing more than a tool for a job.  Providing one
understands how it works and can manage the sequencing of notes, it is
not wrong nor unreliable to use at a top-level.  If it were either, then
LilyPond should not accept such usage.

The original \ossia function flips the arguments so the ordering of
notes behind the scenes as \relative sees them no longer matches the
natural progression within the input file.  As such, argument order
matters to accommodate folks who choose to use \relative at the higher
level and maintain consistency with the existing precedent that parallel
sections of music are processed in the order they occur within the
source:

%%%%
\relative { 1st 2nd << { 3rd 4th } \\ { 5th 6th } >> 7th 8th }
%%%%

With the original \ossia function, one must follow this sequencing:

%%%%
\relative { 1st 2nd \ossia { 5th(!) 6th } { 3rd(!) 4th } 7th(!) 8th }
%%%%

That is three times the natural ordering is disturbed, so fixing the
argument order definitely adds clarity.

Mind you, a user is always free to use \relative in a more localized
scope:

%%%%
{
   \relative { 1st 2nd }
   \ossia \relative { 1st 2nd }
          \relative { 1st 2nd }
   \relative { 1st 2nd }
}
%%%%

But surely the music argument *nearest* the \ossia command should be the
notes in the ossia itself, regardless of ones preference on using
\relative.  The alternative seems madness:

%%%%
{
   music preceding
   \ossia { careful, these are not the notes for the ossia }
          { here, written *below* those notes in the source,
            are the notes that will appear *above* them. }
   music following
}
%%%%


-- Aaron Hill



--
www.martinrinconbotero.com

reply via email to

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