Page 1 of 2

[LilyPond] Strait slurs and more.

Posted: 22 Sep 2016, 18:17
by Schneider
Hi OCTO, hi All,

Few hours ago, I was very happy to see a major slur shape improvement for LP users:
http://lilypond.1069038.n5.nabble.com/a ... xample.pdf

And also:
http://lilypond.1069038.n5.nabble.com/a ... xample.pdf

Thread here:
http://lilypond.1069038.n5.nabble.com/C ... 94837.html

Cheers, ;)

Re: [LilyPond] Strait slurs and more.

Posted: 23 Sep 2016, 13:06
by MJCube
Great news! Weird examples. Perhaps someone can post in this thread a more practical example of what Lilypond can do with a slur now that it couldn’t before.

Re: [LilyPond] Strait slurs and more.

Posted: 23 Sep 2016, 22:34
by Schneider
Ok, interesting challenge ;)

So let start with this one : viewtopic.php?p=622#p622
Here you go:
mjcubeSlursRavel.png
mjcubeSlursRavel.png (51.77 KiB) Viewed 12950 times
The code:

Code: Select all

\version "2.19"
#(set-global-staff-size 16)
%\include "myTools.ily"
\pointAndClickOff
%% This has to be available:
%\include "../compound-slurs.ily"

#(define (suppress message x)
  (let loop ((c x))
    (if (> c 0)
       (begin
        (ly:expect-warning message)
        (loop (1- c))))))
#(suppress "already have slur" 2)

\layout {
  \context {
    \Staff
    \omit TimeSignature
  }
}

muset-slur =
#(define-event-function (ann? end-x end-y)((boolean?) number? number?)
   #{
     ^\compoundSlur \with {
       annotate = #ann?
       show-grid = #ann?
       start-ratio = #-.1
       end-point = #`(,end-x . ,end-y)
       end-ratio = #-.2
       
       inflection = 
       #'((X-ratio . .02)
          (Y-offset . -8.5)
          (angle . 15)
          )
       
       inflection =
       #'((X-ratio . .085)
          (Y-offset . -7.7)
          (angle . 40)
          (label . "A")
          )

       inflection = 
       #'((X-ratio . .105)
          (Y-offset . 11)
          (angle . -35)
          )
       
       inflection = 
       #'((X-ratio . .235)
          (Y-offset . 11)
          (angle . -45)
          (label . "B")
          )
       
       inflection = 
       #'((X-ratio . .27)
          (Y-offset . -7.5)
          (angle . 45)
          )
       
       inflection = 
       #'((X-ratio . .36)
          (Y-offset . -7.5)
          (angle . 40)
          (label . "C")
          )
       
       inflection = 
       #'((X-ratio . .39)
          (Y-offset . 11)
          (angle . -35)
          )
       
       inflection = 
       #'((X-ratio . .53)
          (Y-offset . 11)
          (angle . -45)
          (label . "D")
          )
       
       inflection = 
       #'((X-ratio . .56)
          (Y-offset . -7.5)
          (angle . 40)
          )
       
       inflection = 
       #'((X-ratio . .652)
          (Y-offset . -7.5)
          (angle . 40)
          (label . "E")
          )
       
       inflection = 
       #'((X-ratio . .68)
          (Y-offset . 11)
          (angle . -35)
          )
       
       inflection = 
       #'((X-ratio . .81)
          (Y-offset . 11)
          (angle . -45)
          (label . "F")
          )
       
       inflection = 
       #'((X-ratio . .84)
          (Y-offset . -8.5)
          (angle . 40)
          )
       
       inflection = 
       #'((X-ratio . .935)
          (Y-offset . -10)
          (angle . 40)
          (label . "G")
          )
       
       inflection = 
       #'((X-ratio . .97)
          (Y-offset . 7.8)
          (angle . -50)
          )
     }
   #})

RH = \fixed c' {
  \time 3/4
  \key d\minor
  | % mes.1
    r4 d''( d')
  | % mes.2
    <g, bes, d g>2 <f, a, c f>4
  | % mes.3
    r4 d''( d')
  | % mes.4
    <a, c e a>4 <bes, d f bes> <d, f, a, d>
  | % mes.5
    r4 d''( d')  
  | % mes.6
    <a, c e a>2 <g, bes, d g>4
  | % mes.7
    r4 d''( d')  
  | % mes.8
    <d, f, a, d>2.
  \bar "||"
}

%% Left hand clef positions:
cleF = { \once\override Staff.Clef.space-alist = #'((staff-bar extra-space . 0.2)) \clef F }
cleG = { \once\override Staff.Clef.space-alist = #'((staff-bar extra-space . 1.5)) \clef G }

LH = \fixed c' {
  \time 3/4
  \key d\minor
  | % mes.1
    \tag #'coord { <bes, f d bes>2_\muset-slur ##t 91.6 12 }
    \tag #'clean { <bes, f d bes>2_\muset-slur ##f 91.6 12 }
    <a, c e a>4
  | % mes.2
    \cleF g,,4_( \once\stemUp d,2)
  | % mes.3
    \cleG <bes, d f bes>2 <d f a \parenthesize d'>4
  | % mes.4
    \cleF g,,4_( \once\stemUp d,2)
  | % mes.5
    \cleG <a, c e a>2 <bes, d f bes>4
  | % mes.6
    \cleF g,,4_( \once\stemUp d,2)
  | % mes.7
    \cleG <f, a, c f>4 <g, bes, d g> <c, e, g, c>
  | % mes.8
    \cleF g,,4^( d, d)
  \bar "||"
}

\paper {
  indent = 0
  ragged-right = ##f
}
\header {
  title = "Le tombeau de Couperin"
  composer = \markup { "Maurice" \caps "Ravel" }
  piece = \markup\left-column { "Musette (extract)" \vspace #1 }
}
\markup\vspace #1
\score { \new PianoStaff << \new Staff \RH \new Staff { \keepWithTag #'clean \LH } >> }
\markup\vspace #5
\score { \new PianoStaff << \new Staff \RH \new Staff { \keepWithTag #'coord \LH } >> }
PDF also enclosed for better view.

Cheers :)

[LilyPond] Strait slurs and more.

Posted: 24 Sep 2016, 03:42
by tisimst
Nice work, Pierre!

Re: [LilyPond] Strait slurs and more.

Posted: 24 Sep 2016, 19:09
by Schneider
Thank you Abraham :)

Re: [LilyPond] Strait slurs and more.

Posted: 27 Sep 2016, 09:39
by OCTO
Well done - indeed!! Can LP make flat slurs?
viewtopic.php?t=48

Re: [LilyPond] Strait slurs and more.

Posted: 27 Sep 2016, 14:26
by tisimst
OCTO wrote:Well done - indeed!! Can LP make flat slurs?
viewtopic.php?t=48
It can, using the functionality that Schneider is using, but all segments maintain the normal curve thickness profile (i.e., thin at the ends and thick in the middle). So, they don't look the best (yet), but we have a number of individuals investigating what it would take to change this so each segment has more control over its thickness profile. The internal code has the functionality to handle this beautifully, but the pieces just need to be connected.

Slightly OT, I have manually created code for flat ties which works quite nicely and is quite flexible, including accounting for optical thickness correction, but I think the flatness is more helpful with slurs, so I'm excited for this functionality to be created! Here's an example showing a variety of flat slur shapes vs. a few normal curved slurs. Everything is customizable and is built using regularly available tie properties.
flat-ties-LilyPond.png
flat-ties-LilyPond.png (31.1 KiB) Viewed 12884 times

Re: [LilyPond] Strait slurs and more.

Posted: 27 Sep 2016, 23:22
by John Ruggero
Congratulations to LilyPond on its new capabilities as shown by Schneider's excellent "rendition" of the Ravel!

I do think that all slurs should maintain at least a slight arch. Flat areas are not attractive.

Re: [LilyPond] Strait slurs and more.

Posted: 28 Sep 2016, 04:11
by OCTO
John Ruggero wrote:I do think that all slurs should maintain at least a slight arch. Flat areas are not attractive.
Slurs shown by tisimst are a bit to straight in my opinion too, yet some composers would love to use just these in Finale.
However, not all straight or flat slurs are uncommon. Many old publishers practice flat slurs in some degree (as discussed at viewtopic.php?t=48 and viewtopic.php?f=7&t=52 ).

Re: [LilyPond] Strait slurs and more.

Posted: 28 Sep 2016, 16:39
by John Ruggero
OCTO., we did discuss this extensively and, of course, notation programs should be capable of producing slurs of any shape including perfectly flat.

I bring it up again only because it could be interesting to see how LilyPond might modify flat areas to give them a very slight arch, which would make them more pleasing for those who prefer that style.

Here is an interesting example, taken somewhat at random from Chopin's Ballade no 4 (Breitkopf Complete Works). The long slur might appear to be a "straight line with two ends bending uniformly" (T. Ross) but comparison of the center area of the slur with the straight upper border of the example will show that this is not so. I see this tendency to avoid flat areas when possible in much fine engraving.
Chopin slur.jpg
Chopin slur.jpg (111.67 KiB) Viewed 12861 times