Re: Indicating duration with lines

2020-06-23 Thread Urs Liska
Hi Harm,

thank you very much! This indeed is helping me to achieve what I'm
right now needing (see attached example).

For now I needed quite some manual tweaking of the right hand lenghts,
and if I'll need something like this more, I'd probably try to wrap it
in a way that a voice will have that attached to all notes
automatically. But I won't touch it anymore until tomorrow evening.

Best
Urs

Am Montag, den 22.06.2020, 22:58 +0200 schrieb Thomas Morley:
> Am Mo., 22. Juni 2020 um 11:46 Uhr schrieb Urs Liska <
> li...@openlilylib.org>:
> > I really don't seem to find useful search terms :-(
> > 
> > I'm trying to achieve horizontal lines "extending" the note head to
> > indicate its duration. The attachement is done by abusing
> > \glissando.
> > I'd be (mostly) happy with the appearance, but glissandi work only
> > in
> > place where a tie is. When there's a different note or a rest after
> > the
> > original note it doesn't.
> > 
> > What would be a term for this notation element, and is there a
> > ready-
> > made solution, e.g. in the LSR?
> > 
> > Thanks
> > Urs
> 
> Hi Urs,
> 
> how about attached?
> There are some features I needed for typesetting some avantgarde
> piece, not sure whether they are of use for your case, though.
> There are two functions defined durLine and durationLine, both have
> pros and cons ...
> 
> Cheers,
>   Harm


Re: Indicating duration with lines

2020-06-22 Thread Thomas Morley
Am Mo., 22. Juni 2020 um 11:46 Uhr schrieb Urs Liska :
>
> I really don't seem to find useful search terms :-(
>
> I'm trying to achieve horizontal lines "extending" the note head to
> indicate its duration. The attachement is done by abusing \glissando.
> I'd be (mostly) happy with the appearance, but glissandi work only in
> place where a tie is. When there's a different note or a rest after the
> original note it doesn't.
>
> What would be a term for this notation element, and is there a ready-
> made solution, e.g. in the LSR?
>
> Thanks
> Urs

Hi Urs,

how about attached?
There are some features I needed for typesetting some avantgarde
piece, not sure whether they are of use for your case, though.
There are two functions defined durLine and durationLine, both have
pros and cons ...

Cheers,
  Harm
 written for 2.19.65


 Flat Glissando (as a duration-line with optional hooks at the end)

 Reads from Glissando.details:
   duration-line-thickness [defaults to 3.4]
   tip-height [defaults to (* staff-space 2/3)]
   tip-thickness [defaults to `duration-line-thickness']
   equal-chord-glissando-start-end [defaults to '(#t . #t)]

%% used for `duration-line':
#(define (get-grob-most-left-relative-coordinate ref-point)
  (lambda (grob)
(if (ly:grob? grob)
(cond
  ((eq? (grob::name grob) 'NoteColumn)
 (let* ((note-heads-array (ly:grob-object grob 'note-heads))
(note-heads-grobs
  (if (ly:grob-array? note-heads-array)
  (ly:grob-array->list note-heads-array)
  '()))
(note-heads-refpoints
  (map
(lambda (nh)
  (ly:grob-relative-coordinate nh ref-point X))
note-heads-grobs))
(sorted-note-heads-refpoints (sort note-heads-refpoints <)))
  (if (not (null? sorted-note-heads-refpoints))
  (car sorted-note-heads-refpoints
   ((eq? (grob::name grob) 'AccidentalPlacement)
  (let* ((acc-list (ly:grob-object grob 'accidental-grobs))
 (acc-refpoints
   (map
 (lambda (acc)
   (ly:grob-relative-coordinate (cadr acc) ref-point X))
 acc-list))
 (sorted-acc-refpoints (sort acc-refpoints <)))
   (if (not (null? sorted-acc-refpoints))
   (car sorted-acc-refpoints
   (else
 (if (ly:grob? grob)
 (ly:grob-relative-coordinate grob ref-point X
'(

#(define same-gliss-start-end
  ;; Looks at details.equal-chord-glissando-start-end whether all glissandi
  ;; between chords should start at the same X-coordinate, same for
  ;; glissando-endings
  ;; 'equal-chord-glissando-start-end?' takes a pair of booleans indicating it.
  (lambda (grob)
(let* ((left-bound (ly:spanner-bound grob LEFT))
   (parent-nc (ly:grob-parent left-bound X))
   (details (ly:grob-property grob 'details))
   (equal-chord-glissando-start-end
 (assoc-get 'equal-chord-glissando-start-end details '(#t . #t)))
   (vertical-axis-group-elts
 (ly:grob-object (ly:grob-parent grob Y) 'elements))
   ;; Filter VerticalAxisGroup-elements for Glissandi, restricted to
   ;; those starting at the NoteHeads from same NoteColumn.
   ;; Return their 'X-value for start/end
   (relevant-gliss-Xs
 (if (ly:grob-array? vertical-axis-group-elts)
 (filter-map
   (lambda (elt)
 (and
   (grob::has-interface elt 'glissando-interface)
   (equal?
 (ly:grob-parent (ly:spanner-bound elt LEFT) X)
 parent-nc)
   (cons
 (assoc-get 'X
(ly:grob-property elt 'left-bound-info))
 (assoc-get 'X
(ly:grob-property elt 'right-bound-info)
   (ly:grob-array->list vertical-axis-group-elts))
 '(
  ;; Depending on `equal-chord-glissando-start-end':
  ;; Get the most left 'X for the resulting 'X-value of the end.
  ;; Get the most right 'X for the resulting 'X-value of the start.
  ;; Override left/right-bound-info with those values.
  (if (car equal-chord-glissando-start-end)
  (ly:grob-set-nested-property! grob '(left-bound-info X)
(apply max (map car relevant-gliss-Xs
  (if (cdr equal-chord-glissando-start-end)
  (ly:grob-set-nested-property! grob '(right-bound-info X)
(apply min (map cdr relevant-gliss-Xs)))


Re: Indicating duration with lines

2020-06-22 Thread Urs Liska
Am Montag, den 22.06.2020, 15:56 +0200 schrieb Pierre Perol-Schneider:
> Is there a maximum length value? Any tiny example?

The attached is what I did with \glissandoThe main problem with that
example is that it's hard to discern single notes from those with
(invisible) rests afterwards.
Best
Urs
> Cheers,
> Pierre
> 
> Le lun. 22 juin 2020 à 15:47, Urs Liska  a
> écrit :
> > Hi Pierre,
> > thank you for the nice suggestion. Do you (or anybody else) have an
> > idea how to make the length automatic? This looks nice, but of
> > course when the horizontal spacing of the music changes things will
> > go wrong.
> > Best
> > Urs
> > Am Montag, den 22.06.2020, 13:12 +0200 schrieb Pierre Perol-
> > Schneider:
> > > Hi Urs,
> > > How about:
> > > 
> > > \version "2.20.0"
> > > 
> > > ext =
> > > #(define-music-function (long) (number?)
> > >#{
> > >  \once\override NoteHead.stencil = 
> > >#(lambda (grob) 
> > >   (grob-interpret-markup grob 
> > >  (markup #:concat
> > > (#:musicglyph "noteheads.s2" #:hspace -0.85 
> > >  (#:override (cons (quote filled) #t)
> > >   (#:path 0 
> > > `((moveto 0 .543)
> > >   (rlineto ,long 0)
> > >   (rlineto -.4 -1.086)
> > >   (rlineto ,(* long -1) 0)
> > >   (closepath
> > >  #:hspace -0.85 #:musicglyph "noteheads.s2" 
> > >#})
> > > 
> > > %% Test:
> > > \layout {
> > >   \context {
> > > \Voice
> > > \omit Stem
> > >   }
> > > }
> > > 
> > > \fixed c' {
> > >   \ext #5 ais4 \ext #4 4 \ext #2 4 \ext #2 4 
> > > }
> > > 
> > > HTH, cheers,
> > > Pierre
> > > 
> > > Le lun. 22 juin 2020 à 11:47, Urs Liska  a
> > > écrit :
> > > > I really don't seem to find useful search terms :-(
> > > > 
> > > > 
> > > > 
> > > > I'm trying to achieve horizontal lines "extending" the note
> > > > head to
> > > > 
> > > > indicate its duration. The attachement is done by abusing
> > > > \glissando.
> > > > 
> > > > I'd be (mostly) happy with the appearance, but glissandi work
> > > > only in
> > > > 
> > > > place where a tie is. When there's a different note or a rest
> > > > after the
> > > > 
> > > > original note it doesn't.
> > > > 
> > > > 
> > > > 
> > > > What would be a term for this notation element, and is there a
> > > > ready-
> > > > 
> > > > made solution, e.g. in the LSR?
> > > > 
> > > > 
> > > > 
> > > > Thanks
> > > > 
> > > > Urs
> > > > 


Re: Indicating duration with lines

2020-06-22 Thread Urs Liska
Am Montag, den 22.06.2020, 16:00 +0200 schrieb Urs Liska:
Am Montag, den 22.06.2020, 15:56 +0200 schrieb Pierre Perol-Schneider:
Is there a maximum length value? Any tiny example?

The attached is what I did with \glissando
The main problem with that example is that it's hard to discern single notes 
from those with (invisible) rests afterwards.



Ehm, sorry for hitting "send" too fast. What I would want to do is
replace the sequences of equal pitches with one long line each.

> Best
> Urs
> > Cheers,
> > Pierre
> > 
> > Le lun. 22 juin 2020 à 15:47, Urs Liska  a
> > écrit :
> > > Hi Pierre,
> > > thank you for the nice suggestion. Do you (or anybody else) have
> > > an idea how to make the length automatic? This looks nice, but of
> > > course when the horizontal spacing of the music changes things
> > > will go wrong.
> > > Best
> > > Urs
> > > Am Montag, den 22.06.2020, 13:12 +0200 schrieb Pierre Perol-
> > > Schneider:
> > > > Hi Urs,
> > > > How about:
> > > > 
> > > > \version "2.20.0"
> > > > 
> > > > ext =
> > > > #(define-music-function (long) (number?)
> > > >#{
> > > >  \once\override NoteHead.stencil = 
> > > >#(lambda (grob) 
> > > >   (grob-interpret-markup grob 
> > > >  (markup #:concat
> > > > (#:musicglyph "noteheads.s2" #:hspace -0.85 
> > > >  (#:override (cons (quote filled) #t)
> > > >   (#:path 0 
> > > > `((moveto 0 .543)
> > > >   (rlineto ,long 0)
> > > >   (rlineto -.4 -1.086)
> > > >   (rlineto ,(* long -1) 0)
> > > >   (closepath
> > > >  #:hspace -0.85 #:musicglyph "noteheads.s2" 
> > > >#})
> > > > 
> > > > %% Test:
> > > > \layout {
> > > >   \context {
> > > > \Voice
> > > > \omit Stem
> > > >   }
> > > > }
> > > > 
> > > > \fixed c' {
> > > >   \ext #5 ais4 \ext #4 4 \ext #2 4 \ext #2 4 
> > > > }
> > > > 
> > > > HTH, cheers,
> > > > Pierre
> > > > 
> > > > Le lun. 22 juin 2020 à 11:47, Urs Liska 
> > > > a écrit :
> > > > > I really don't seem to find useful search terms :-(
> > > > > 
> > > > > 
> > > > > 
> > > > > I'm trying to achieve horizontal lines "extending" the note
> > > > > head to
> > > > > 
> > > > > indicate its duration. The attachement is done by abusing
> > > > > \glissando.
> > > > > 
> > > > > I'd be (mostly) happy with the appearance, but glissandi work
> > > > > only in
> > > > > 
> > > > > place where a tie is. When there's a different note or a rest
> > > > > after the
> > > > > 
> > > > > original note it doesn't.
> > > > > 
> > > > > 
> > > > > 
> > > > > What would be a term for this notation element, and is there
> > > > > a ready-
> > > > > 
> > > > > made solution, e.g. in the LSR?
> > > > > 
> > > > > 
> > > > > 
> > > > > Thanks
> > > > > 
> > > > > Urs
> > > > > 
> 
> 


Re: Indicating duration with lines

2020-06-22 Thread Pierre Perol-Schneider
Is there a maximum length value? Any tiny example?
Cheers,
Pierre

Le lun. 22 juin 2020 à 15:47, Urs Liska  a écrit :

> Hi Pierre,
>
> thank you for the nice suggestion. Do you (or anybody else) have an idea
> how to make the length automatic? This looks nice, but of course when the
> horizontal spacing of the music changes things will go wrong.
>
> Best
> Urs
>
> Am Montag, den 22.06.2020, 13:12 +0200 schrieb Pierre Perol-Schneider:
>
> Hi Urs,
> How about:
>
> \version "2.20.0"
>
> ext =
> #(define-music-function (long) (number?)
>#{
>  \once\override NoteHead.stencil =
>#(lambda (grob)
>   (grob-interpret-markup grob
>  (markup #:concat
> (#:musicglyph "noteheads.s2" #:hspace -0.85
>  (#:override (cons (quote filled) #t)
>   (#:path 0
> `((moveto 0 .543)
>   (rlineto ,long 0)
>   (rlineto -.4 -1.086)
>   (rlineto ,(* long -1) 0)
>   (closepath
>  #:hspace -0.85 #:musicglyph "noteheads.s2" 
>#})
>
> %% Test:
> \layout {
>   \context {
> \Voice
> \omit Stem
>   }
> }
>
> \fixed c' {
>   \ext #5 ais4 \ext #4 4 \ext #2 4 \ext #2 4
> }
>
> HTH, cheers,
> Pierre
>
> Le lun. 22 juin 2020 à 11:47, Urs Liska  a écrit :
>
> I really don't seem to find useful search terms :-(
>
> I'm trying to achieve horizontal lines "extending" the note head to
> indicate its duration. The attachement is done by abusing \glissando.
> I'd be (mostly) happy with the appearance, but glissandi work only in
> place where a tie is. When there's a different note or a rest after the
> original note it doesn't.
>
> What would be a term for this notation element, and is there a ready-
> made solution, e.g. in the LSR?
>
> Thanks
> Urs
>
>


Re: Indicating duration with lines

2020-06-22 Thread Urs Liska
Hi Pierre,
thank you for the nice suggestion. Do you (or anybody else) have an
idea how to make the length automatic? This looks nice, but of course
when the horizontal spacing of the music changes things will go wrong.
Best
Urs
Am Montag, den 22.06.2020, 13:12 +0200 schrieb Pierre Perol-Schneider:
> Hi Urs,
> How about:
> 
> \version "2.20.0"
> 
> ext =
> #(define-music-function (long) (number?)
>#{
>  \once\override NoteHead.stencil = 
>#(lambda (grob) 
>   (grob-interpret-markup grob 
>  (markup #:concat
> (#:musicglyph "noteheads.s2" #:hspace -0.85 
>  (#:override (cons (quote filled) #t)
>   (#:path 0 
> `((moveto 0 .543)
>   (rlineto ,long 0)
>   (rlineto -.4 -1.086)
>   (rlineto ,(* long -1) 0)
>   (closepath
>  #:hspace -0.85 #:musicglyph "noteheads.s2" 
>#})
> 
> %% Test:
> \layout {
>   \context {
> \Voice
> \omit Stem
>   }
> }
> 
> \fixed c' {
>   \ext #5 ais4 \ext #4 4 \ext #2 4 \ext #2 4 
> }
> 
> HTH, cheers,
> Pierre
> 
> Le lun. 22 juin 2020 à 11:47, Urs Liska  a
> écrit :
> > I really don't seem to find useful search terms :-(
> > 
> > 
> > 
> > I'm trying to achieve horizontal lines "extending" the note head to
> > 
> > indicate its duration. The attachement is done by abusing
> > \glissando.
> > 
> > I'd be (mostly) happy with the appearance, but glissandi work only
> > in
> > 
> > place where a tie is. When there's a different note or a rest after
> > the
> > 
> > original note it doesn't.
> > 
> > 
> > 
> > What would be a term for this notation element, and is there a
> > ready-
> > 
> > made solution, e.g. in the LSR?
> > 
> > 
> > 
> > Thanks
> > 
> > Urs
> > 


Re: Indicating duration with lines

2020-06-22 Thread Pierre Perol-Schneider
Hi Urs,
How about:

\version "2.20.0"

ext =
#(define-music-function (long) (number?)
   #{
 \once\override NoteHead.stencil =
   #(lambda (grob)
  (grob-interpret-markup grob
 (markup #:concat
(#:musicglyph "noteheads.s2" #:hspace -0.85
 (#:override (cons (quote filled) #t)
  (#:path 0
`((moveto 0 .543)
  (rlineto ,long 0)
  (rlineto -.4 -1.086)
  (rlineto ,(* long -1) 0)
  (closepath
 #:hspace -0.85 #:musicglyph "noteheads.s2" 
   #})

%% Test:
\layout {
  \context {
\Voice
\omit Stem
  }
}

\fixed c' {
  \ext #5 ais4 \ext #4 4 \ext #2 4 \ext #2 4
}

HTH, cheers,
Pierre

Le lun. 22 juin 2020 à 11:47, Urs Liska  a écrit :

> I really don't seem to find useful search terms :-(
>
> I'm trying to achieve horizontal lines "extending" the note head to
> indicate its duration. The attachement is done by abusing \glissando.
> I'd be (mostly) happy with the appearance, but glissandi work only in
> place where a tie is. When there's a different note or a rest after the
> original note it doesn't.
>
> What would be a term for this notation element, and is there a ready-
> made solution, e.g. in the LSR?
>
> Thanks
> Urs
>


Indicating duration with lines

2020-06-22 Thread Urs Liska
I really don't seem to find useful search terms :-(

I'm trying to achieve horizontal lines "extending" the note head to
indicate its duration. The attachement is done by abusing \glissando.
I'd be (mostly) happy with the appearance, but glissandi work only in
place where a tie is. When there's a different note or a rest after the
original note it doesn't.

What would be a term for this notation element, and is there a ready-
made solution, e.g. in the LSR?

Thanks
Urs