Re: \path and \postscript in staff

2018-05-27 Thread Thomas Morley
2018-05-26 9:38 GMT+02:00 Helge Kruse :
> Am 25.05.2018 um 13:13 schrieb Thomas Morley:
>> Hi,
>>
>> you'll need a spanner from note to note, Glissando is your best bet, I'd say.
>> I once made the attached code.
>
> Wow! That solves the problem. This fancy glissando can be fine tuned for
> each instrument, so that it produces nearly the picture of the autograph.

Glad you like it.

> the function is now stored in an include file. The excerpt from the
> score is attached.
> Would it be worth to add it to the LSR?


Done.

http://lsr.di.unimi.it/LSR/Item?id=1066

Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \path and \postscript in staff

2018-05-26 Thread Helge Kruse
Am 25.05.2018 um 13:13 schrieb Thomas Morley:
> Hi,
> 
> you'll need a spanner from note to note, Glissando is your best bet, I'd say.
> I once made the attached code.

Wow! That solves the problem. This fancy glissando can be fine tuned for
each instrument, so that it produces nearly the picture of the autograph.

the function is now stored in an include file. The excerpt from the
score is attached.
Would it be worth to add it to the LSR?

Thank you,
Helge
\version "2.18.2"

\include "FancyGliss.ily"



partI = \new PianoStaff \with { connectArpeggios = ##t } <<
  \new Staff=upperI \relative c'' {
\time 2/4
| \override Glissando.cross-staff = ##t
  \fancy-gliss
#'(
 (.5 -2)
 (1 -0.5)
 (1.5 -3)
 (2 0)
 (2.5 -12)
 (3 0)
 )
  \hideNotes e8*12\glissando  \unHideNotes
| 4\arpeggio r
  }
  \new Staff=lowerI \relative c { \clef bass
| s2  s s
| 4\arpeggio r
  }
>>

partII = \new PianoStaff \with { connectArpeggios = ##t } <<
  \new Staff=upperII \relative c' {
\time 2/4
\override Glissando.cross-staff = ##t
s8
\fancy-gliss
#'(
 (.5 -5)
 (1 -2)
 (1.5 -11)
 (2 -7)
 (2.5 -14.5)
 (3 0)
 )
\hideNotes e'8*11\glissando  \unHideNotes
  | 4\arpeggio r
  }
  \new Staff=lowerII\relative c { \clef bass
| s2  s s
| 4\arpeggio r
  }
>>

partIII = \new PianoStaff \with { connectArpeggios = ##t } <<
  \new Staff=upperIII \relative c' {
\time 2/4
| \stemDown \tuplet 3/2 {
  \change Staff=upperI 8
  \change Staff=upperII 
  \change Staff=upperIII 
} \stemNeutral
\override Glissando.cross-staff = ##t
\fancy-gliss
#'(
 (.1 -4)
 (.6 -2.5)
 (1.4 -5)
 (1.6 -2.5)
 (2.1 -14)
 (2.6 0)
 )
\hideNotes e8*10\glissando  \unHideNotes
  | 4\arpeggio r
  }
  \new Staff=lowerIII \relative c { \clef bass
| s2  s s
| 4\arpeggio r
  }
>>

\score {
<<
  \partI
  \partII
  \partIII
>>
}
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \path and \postscript in staff

2018-05-26 Thread Helge Kruse
Am 25.05.2018 um 13:44 schrieb Aaron Hill:
> On 2018-05-24 23:15, Helge Kruse wrote:
>> But these lines are outside the staff. If you change "(rlineto 10 1)" to
>> "(rlineto 10 10)" then the starting point is moved down to keep the
>> markup outside the stuff. Further it doesn't support the x-position of
>> the next/previous note column.
> 
> There is a difference in behavior between \path and \postscript
> regarding bounds.  See the following:
> 
> [...]
> 
> By forcing the bounds of the \path-created object to be "empty," it can
> overlap the staff.
Yes, but how can I draw a line to the next note or spacer rest position?

Helge

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \path and \postscript in staff

2018-05-25 Thread Aaron Hill

On 2018-05-24 23:15, Helge Kruse wrote:
But these lines are outside the staff. If you change "(rlineto 10 1)" 
to

"(rlineto 10 10)" then the starting point is moved down to keep the
markup outside the stuff. Further it doesn't support the x-position of
the next/previous note column.


There is a difference in behavior between \path and \postscript 
regarding bounds.  See the following:



  \version "2.18.2"
  {
f'4_\markup { \postscript #"0 0 moveto 1 5 lineto stroke" }
f'4_\markup { \path #0.1 #'((moveto 0 0) (lineto 1 5) (closepath)) }
f'4_\markup {
  \with-dimensions #'(0 . 0) #'(0 . 0)
  \path #0.1 #'((moveto 0 0) (lineto 1 5) (closepath))
}
  }


By forcing the bounds of the \path-created object to be "empty," it can 
overlap the staff.


-- Aaron Hill

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \path and \postscript in staff

2018-05-25 Thread Aaron Hill

On 2018-05-24 23:15, Helge Kruse wrote:

How can I draw lines from note head to next note head with \path or
\postscript inside the staff? This should be robust to changes in the
other staves, e.g. if the other staff changes to 32th notes.


Hi Helge,

If you just need to draw lines between notes, the following LSR snippet 
uses the TextSpanner to achieve this without needing to use \path or 
\postscript:


http://lsr.di.unimi.it/LSR/Item?id=662

-- Aaron Hill

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \path and \postscript in staff

2018-05-25 Thread Thomas Morley
2018-05-25 8:15 GMT+02:00 Helge Kruse :
> The appendix A.10.3 of the Lilypond notation manual describes several
> possibilities to use \path or \postscript in a \markup context. So you
> can use this to draw some lines:
>
> \version "2.18.2"
>
> <<
>   \relative c' {
> e4^\markup { \path #0.25 #'((rmoveto 0 0)
>
> (rlineto 5 -1)
> (closepath)) }
>
> c'_\markup { \path #0.1 #'((rmoveto 0 0)
>   (rlineto 10 1)
>   (closepath)
>   ) }
>   }
>
>   \relative c' {
> g8 g g g
>   }
>>>
>
> But these lines are outside the staff. If you change "(rlineto 10 1)" to
> "(rlineto 10 10)" then the starting point is moved down to keep the
> markup outside the stuff. Further it doesn't support the x-position of
> the next/previous note column.
>
> How can I draw lines from note head to next note head with \path or
> \postscript inside the staff? This should be robust to changes in the
> other staves, e.g. if the other staff changes to 32th notes.
>
> Regards
> Helge


Hi,

you'll need a spanner from note to note, Glissando is your best bet, I'd say.
I once made the attached code.

HTH,
  Harm
\version "2.19.15"

%#(use-modules (ice-9 pretty-print))

lengthen-gliss = 
#(define-music-function (parser loation nmbr)(number?)
#{
  \once \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods
  \once \override Glissando.minimum-length = #nmbr
#})

fancy-gliss =
#(define-music-function (parser location pts-list)(list?)
#{
 \once \override Glissando.after-line-breaking =
  #(lambda (grob)
(let ((stil (ly:line-spanner::print grob)))
 (if (ly:stencil? stil)
 (let* 
   ((left-bound-info (ly:grob-property grob 'left-bound-info))
(left-bound (ly:spanner-bound grob LEFT))
(y-off (assoc-get 'Y left-bound-info))
(padding (assoc-get 'padding left-bound-info))
(note-column (ly:grob-parent left-bound X))
(note-heads (ly:grob-object note-column 'note-heads))
(ext-X 
  (if (null? note-heads)
  '(0 . 0)
  (ly:relative-group-extent note-heads grob X)))
(dot-column (ly:note-column-dot-column note-column))
(dots 
  (if (null? dot-column)
  '()
  (ly:grob-object dot-column 'dots)))
(dots-ext-X 
  (if (null? dots)
  '(0 . 0)
  (ly:relative-group-extent dots grob X)))
(factor 
  (/ (interval-length (ly:stencil-extent stil X))
 (car (take-right (last pts-list) 2
(new-stil
  (make-connected-path-stencil 
(map
  (lambda (e)
(cond ((= (length e) 2)
   (cons (* (car e) factor) (cdr e)))
  ((= (length e) 6)
   (list
 (* (car e) factor)
 (cadr e)
 (* (third e) factor)
 (fourth e)
 (* (fifth e) factor)
 (sixth e)))
  (else 
(ly:error 
  "Some element(s) of the given list do not fit"   
  pts-list)
(layout-line-thickness grob) ;line-width 
1   ;scaling
1   ;scaling
#f
#f)))
 (ly:grob-set-property! grob 'stencil
   (ly:stencil-translate
new-stil
(cons (+ (interval-length ext-X) 
 (interval-length dots-ext-X) 
 padding) 
  y-off
   (begin
 (ly:warning 
   "Cannot find stencil. Please set 'minimum-length accordingly")
 #f
#})

#(display "\n\tLimitations: 
\t-Does not work with line-break
\t-dotted notes with glissando may return a warning for unknown reasons,
\t strange things may happen, if contexts die prematurely")


%% EXAMPLE


\paper { indent = 28 }

\header { title = "Fancy Glissando" }

music = <<
  \new Staff \with { instrumentName = "fancy-gliss " }
\relative c' {
  \set Score.defaultBarType = #""
  %% If spacing is very tight Glissando sometimes is omitted.
  %% Use 'lengthen-gliss' with an apropiate value in this case.
  %\lengthen-gliss #10
  \override Glissando.cross-staff = ##t
  \fancy-gliss
#'(
 (1 3)
 (2 -10)
 (3 3)
 (4 1)
 (5 3.5)
 (6 0)
 (7 0 8 5 12 0)
 )
  f1\glissando
  f1
}
  
  \new Staff \with { 

\path and \postscript in staff

2018-05-25 Thread Helge Kruse
The appendix A.10.3 of the Lilypond notation manual describes several
possibilities to use \path or \postscript in a \markup context. So you
can use this to draw some lines:

\version "2.18.2"

<<
  \relative c' {
e4^\markup { \path #0.25 #'((rmoveto 0 0)

(rlineto 5 -1)
(closepath)) }

c'_\markup { \path #0.1 #'((rmoveto 0 0)
  (rlineto 10 1)
  (closepath)
  ) }
  }

  \relative c' {
g8 g g g
  }
>>

But these lines are outside the staff. If you change "(rlineto 10 1)" to
"(rlineto 10 10)" then the starting point is moved down to keep the
markup outside the stuff. Further it doesn't support the x-position of
the next/previous note column.

How can I draw lines from note head to next note head with \path or
\postscript inside the staff? This should be robust to changes in the
other staves, e.g. if the other staff changes to 32th notes.

Regards
Helge


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user