[Top][All Lists]

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

Re: Changing slur behavior

From: R. Padraic Springuel
Subject: Re: Changing slur behavior
Date: Thu, 26 Mar 2020 16:40:33 -0400

> On 26 Mar, 2020, at 9:54 AM, Aaron Hill <address@hidden> wrote:
> On 2020-03-26 2:24 am, Kevin Barry wrote:
>> I think the right way to do what you are trying is to write an
>> engraver that listens for slur events and alters the spacing of the
>> music. (I would write one if I could, but I'm not at that level yet.)
> Firstly, know that slurs are not the only way to define melismata.  You can 
> instruct LilyPond to have a single lyric syllable span multiple notes using 
> \melisma and \melismaEnd:
> %%%%
> \version "2.20.0"
> \fixed c' { b4( g a2) | b4\melisma g a2\melismaEnd }
> \addlyrics { one two }
> %%%%
> This does not solve the spacing aspect of the original post, but it shows how 
> you can avoid messing about with slurs.

I’ll have to play with this to see how I like it.  The reason I initially 
wanted to mess with slurs was on the off chance that I later wanted to take the 
chant and turn it into a fully modern

> Assuming you really want to use slurs to adjust spacing, here might be one 
> way to do it:
> …snip...
> The engraver listens for slur-events, injecting a spacing-section-event and 
> adjusting some context properties as needed.  The logic is very simple, and 
> there are no safety checks.  Be warned this likely could fail with more 
> complicated music.
> -- Aaron Hill

Thanks for this Aaron.  After some playing I’ve adapted this to the way I 
usually encode chant (where all notes are basically quarters):

\version "2.19.84"

Slur_spacing_engraver =
#(lambda (context)
 (let ((slur-event-dir #f))
   (define (change-spacing dir)
       (ly:context-event-source context)
         (ly:make-event-class 'spacing-section-event)
     (let ((score-context (ly:context-find context 'Score)))
         (lambda (args)
           (apply ly:context-pushpop-property
             score-context 'SpacingSpanner
             (if (< 0 dir) (drop-right args 1) args)))
         `((base-shortest-duration ,(ly:make-moment -2))
           (shortest-duration-space 2)
           (spacing-increment 0)))))
     ((start-translation-timestep engraver)
       (set! slur-event-dir #f))
       ((slur-event engraver event)
         (let ((dir (ly:event-property event 'span-direction #f)))
           (set! slur-event-dir dir))))
     ((process-music engraver)
       (if (ly:dir? slur-event-dir)
         (change-spacing slur-event-dir))))))

\layout {
    \context {
        \override SpacingSpanner.shortest-duration-space = 3
        timing = ##f
    \context {
        \consists \Slur_spacing_engraver
        \remove Time_signature_engraver
        \omit Stem
        \omit Slur

music = { 
  a' g'
  a'( g')
  a'( ges')
  a'( g')
  a' g'

words = \lyricmode { Some words to go un -- der notes }

\new Staff  
     \new Voice = "mel" { \music }
     \new Lyrics \lyricsto "mel" { \words }

I’ve found a problem: accidentals inside of slurs end up colliding with 
preceding notes.  Is it possible to modify the Slur_spacing_engraver so that it 
doesn’t ignore accidentals and takes them into account when deciding the 
spacing between the notes?

Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
(c) 202-853-7036


reply via email to

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