Re: Slurs inside a beam

2018-08-12 Thread David F.


On Aug 12, 2018, at 8:24 AM, Thomas Morley  wrote:

> 2018-08-12 3:31 GMT+02:00 Andrew Bernard :
>> Hi David,
>> 
>> One way to do it:
>> 
>> \version "2.19"
>> 
>> {
>>  8. 16
>> }
>> 
>> 
>> From the Changes page:
>> 
>> A new command \=X has been added – where ‘X’ can be any non-negative integer
>> or symbol – so that a specific ‘id’ can be assigned to the start and end of
>> slurs and phrasing slurs.
>> 
>> This is useful when simultaneous slurs are required or if one slur overlaps
>> another or when nesting short slurs within a longer one.
>> 
>> Andrew
>> 
>> 
>> 
>> On Sun, 12 Aug 2018 at 06:31, David F.  wrote:
>>> 
>>> While we’re on the topic of bending slurs to our will, I’d like for
>>> slurred, beamed eighth notes to have the slur printed below or inside the
>>> beam.  This works with a simple ^~ for ties.  How might I accomplish this?
>>> 
> 
> Some background.
> Slurred notes or chords will have their left/right bound set to the
> respective NoteColumn.
> As long as NoteColumns are the bounds, I see no possibility to get
> Slurs "inside" of a Beam (with equal direction for both)
> 
> In-chord Slurs bounds are NoteHeads.
> Thus Andrew's coding above works.
> 
> Another possibility would be to reset bounds for certain Slurs from
> NoteColumn to selected NoteHead:
> 
> #(define (buzz lb rb)
> (lambda (grob)
>  (let* ((left-bound (ly:spanner-bound grob LEFT))
> (left-nhs-array
>   (ly:grob-object left-bound 'note-heads))
> (left-nhs
>   (if (ly:grob-array? left-nhs-array)
>   (sort
> (ly:grob-array->list left-nhs-array)
> (lambda (p q)
>   (ly:pitch (ly:prob-property (ly:grob-property p 'cause) 'pitch)
> (ly:prob-property (ly:grob-property p 'cause) 'pitch
>   '()))
> (right-bound (ly:spanner-bound grob RIGHT))
> (right-nhs-array
>   (ly:grob-object right-bound 'note-heads))
> (right-nhs
>   (if (ly:grob-array? right-nhs-array)
>   (sort
> (ly:grob-array->list right-nhs-array)
> (lambda (p q)
>   (ly:pitch (ly:prob-property (ly:grob-property p 'cause) 'pitch)
> (ly:prob-property (ly:grob-property p 'cause) 'pitch
>   '(
>(ly:spanner-set-bound! grob LEFT (list-ref left-nhs lb))
>(ly:spanner-set-bound! grob RIGHT (list-ref right-nhs rb)
> 
> {
>  8[-\tweak before-line-breaking #(buzz 1 1) ^\=1(_\=2(
>  ]\=1)\=2)
> }
> 
> Making for a different syntax.
> 
> The lower Slur looks nicer, imho
> The upper Slur still needs shaping (with \shape or \shapeII or Aaron's
> coding or whatever)
> 
> Cheers,
>  Harm

Thanks for your explanation, Harm.  But I’m not familiar enough with Lilypond 
internals to completely understand what’s going on here.

In particular, I don’t understand what’s different about beamed notes versus 
non-beamed notes that make this all so tricky.  For example, two slurred 
quarter notes have a perfectly placed slur.  If those two quarter notes were 
beamed just as they are (making them eighth notes, obviously) everything would 
be just fine.

\version "2.19"
{
e'4 ^( a'4 )  % Two slurred quarter notes.  A beam would fit just fine over 
the slur.
e'8 [ ^( a'8 ) ]  % Two beamed eighth notes with the slur above the beam
}

Is there a change in the representation between a quarter note and a beamed 
note that prevents slurred beamed notes from being constructed just like 
slurred quarter notes?

Apologies in advance for my ignorance.

David


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


Re: Slurs inside a beam

2018-08-12 Thread Thomas Morley
2018-08-12 3:31 GMT+02:00 Andrew Bernard :
> Hi David,
>
> One way to do it:
>
> \version "2.19"
>
> {
>   8. 16
> }
>
>
> From the Changes page:
>
> A new command \=X has been added – where ‘X’ can be any non-negative integer
> or symbol – so that a specific ‘id’ can be assigned to the start and end of
> slurs and phrasing slurs.
>
> This is useful when simultaneous slurs are required or if one slur overlaps
> another or when nesting short slurs within a longer one.
>
> Andrew
>
>
>
> On Sun, 12 Aug 2018 at 06:31, David F.  wrote:
>>
>> While we’re on the topic of bending slurs to our will, I’d like for
>> slurred, beamed eighth notes to have the slur printed below or inside the
>> beam.  This works with a simple ^~ for ties.  How might I accomplish this?
>>

Some background.
Slurred notes or chords will have their left/right bound set to the
respective NoteColumn.
As long as NoteColumns are the bounds, I see no possibility to get
Slurs "inside" of a Beam (with equal direction for both)

In-chord Slurs bounds are NoteHeads.
Thus Andrew's coding above works.

Another possibility would be to reset bounds for certain Slurs from
NoteColumn to selected NoteHead:

#(define (buzz lb rb)
(lambda (grob)
  (let* ((left-bound (ly:spanner-bound grob LEFT))
 (left-nhs-array
   (ly:grob-object left-bound 'note-heads))
 (left-nhs
   (if (ly:grob-array? left-nhs-array)
   (sort
 (ly:grob-array->list left-nhs-array)
 (lambda (p q)
   (ly:pitchlist right-nhs-array)
 (lambda (p q)
   (ly:pitch8[-\tweak before-line-breaking #(buzz 1 1) ^\=1(_\=2(
  ]\=1)\=2)
}

Making for a different syntax.

The lower Slur looks nicer, imho
The upper Slur still needs shaping (with \shape or \shapeII or Aaron's
coding or whatever)

Cheers,
  Harm

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


Re: Slurs inside a beam

2018-08-12 Thread Andrew Bernard
Hi Aaron,

All good. But I use \shapeII from the openlilylib library. There are some
insoluble issues with it that crop up sometimes, but in general I hammer it
heavily in use and it holds up well. There are a variety of ways to specify
the shape, including using polar coordinates which is surprisingly
intuitive.

Anyway, I think the OP just wanted a way to get the slurs inside the beam.
But then of course, the moment you achieve this you want to refine them!

Andrew


On Sun, 12 Aug 2018 at 15:33, Aaron Hill  wrote:

> On 2018-08-11 13:30, David F. wrote:
> > While we’re on the topic of bending slurs to our will, I’d like for
> > slurred, beamed eighth notes to have the slur printed below or inside
> > the beam.  This works with a simple ^~ for ties.  How might I
> > accomplish this?
>
> > The behavior I am after can also be seen here:
> >   https://hymnary.org/hymn/SS4C1956/page/561
>
> You can always adjust the control points to get the slur to fit within
> the notes.  However, manually setting control points can be a little
> tedious, especially if you have a slur that is almost correct but just
> needs a little nudging in the right direction.
>
> This (likely over-engineered) approach allows you to transform an
> existing slur by means of scaling, rotation and translation.  It
> automatically scales and rotates about the center of the slur, which
> seemed most natural when I was experimenting with it.
>
> 
> \version "2.19.82"
> \language "english"
>
> #(define (transform-coords coords scale rotate offset)
>(let* ((x-coords (map (lambda (coord) (car coord)) coords))
>   (y-coords (map (lambda (coord) (cdr coord)) coords))
>   (x-center (/ (+ (apply min x-coords) (apply max x-coords)) 2))
>   (y-center (/ (+ (apply min y-coords) (apply max y-coords)) 2))
>   (theta (* rotate (/ PI 180)))
>   (c (cos theta)) (s (sin theta)))
>  (map (lambda (coord) (let (
>  (x (* (- (car coord) x-center) (car scale)))
>  (y (* (- (cdr coord) y-center) (cdr scale
>(cons (+ (* x c) (* y (- s)) x-center (car offset))
>  (+ (* x s) (* y c) y-center (cdr offset) coords)))
>
> #(define ((transform-slur scale rotate offset) grob)
>(let ((coords (ly:slur::calc-control-points grob)))
>  (transform-coords coords scale rotate offset)))
>
> transformSlur =
> #(define-music-function (parser location scale rotate offset)
>  (pair? number? pair?)
>#{ \once \override Slur.control-points =
> #(transform-slur scale rotate offset) #})
>
> \new Staff \with { beamExceptions = #'() } << {
>e'8 ( a'8 )
>\transformSlur #'(0.6 . 0.8) #15 #'(-0.3 . -2.6)
>e'8 ^( a'8 )
>\tuplet 3/2 { b'8 ( a'8 ) f'8 }
>\tuplet 3/2 {
>  \transformSlur #'(0.5 . 0.6) #180 #'(0.4 . 2)
>  b'8 _( a'8 )f'8 }
> } >>
> 
>
> NOTE: Purely for the sake of demonstrating rotation, the second slur is
> a "down" slur that I have flipped over.
>
> -- Aaron Hill___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Slurs inside a beam

2018-08-11 Thread Aaron Hill

On 2018-08-11 13:30, David F. wrote:

While we’re on the topic of bending slurs to our will, I’d like for
slurred, beamed eighth notes to have the slur printed below or inside
the beam.  This works with a simple ^~ for ties.  How might I
accomplish this?



The behavior I am after can also be seen here:
  https://hymnary.org/hymn/SS4C1956/page/561


You can always adjust the control points to get the slur to fit within 
the notes.  However, manually setting control points can be a little 
tedious, especially if you have a slur that is almost correct but just 
needs a little nudging in the right direction.


This (likely over-engineered) approach allows you to transform an 
existing slur by means of scaling, rotation and translation.  It 
automatically scales and rotates about the center of the slur, which 
seemed most natural when I was experimenting with it.



\version "2.19.82"
\language "english"

#(define (transform-coords coords scale rotate offset)
  (let* ((x-coords (map (lambda (coord) (car coord)) coords))
 (y-coords (map (lambda (coord) (cdr coord)) coords))
 (x-center (/ (+ (apply min x-coords) (apply max x-coords)) 2))
 (y-center (/ (+ (apply min y-coords) (apply max y-coords)) 2))
 (theta (* rotate (/ PI 180)))
 (c (cos theta)) (s (sin theta)))
(map (lambda (coord) (let (
(x (* (- (car coord) x-center) (car scale)))
(y (* (- (cdr coord) y-center) (cdr scale
  (cons (+ (* x c) (* y (- s)) x-center (car offset))
(+ (* x s) (* y c) y-center (cdr offset) coords)))

#(define ((transform-slur scale rotate offset) grob)
  (let ((coords (ly:slur::calc-control-points grob)))
(transform-coords coords scale rotate offset)))

transformSlur =
#(define-music-function (parser location scale rotate offset)
(pair? number? pair?)
  #{ \once \override Slur.control-points =
   #(transform-slur scale rotate offset) #})

\new Staff \with { beamExceptions = #'() } << {
  e'8 ( a'8 )
  \transformSlur #'(0.6 . 0.8) #15 #'(-0.3 . -2.6)
  e'8 ^( a'8 )
  \tuplet 3/2 { b'8 ( a'8 ) f'8 }
  \tuplet 3/2 {
\transformSlur #'(0.5 . 0.6) #180 #'(0.4 . 2)
b'8 _( a'8 )f'8 }
} >>


NOTE: Purely for the sake of demonstrating rotation, the second slur is 
a "down" slur that I have flipped over.


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


Re: Slurs inside a beam

2018-08-11 Thread Andrew Bernard
Hi David,

One way to do it:

\version "2.19"

{
  8. 16
}


>From the Changes page:

A new command \=X has been added – where ‘X’ can be any non-negative
integer or symbol – so that a specific ‘id’ can be assigned to the start
and end of slurs and phrasing slurs.

This is useful when simultaneous slurs are required or if one slur overlaps
another or when nesting short slurs within a longer one.

Andrew



On Sun, 12 Aug 2018 at 06:31, David F.  wrote:

> While we’re on the topic of bending slurs to our will, I’d like for
> slurred, beamed eighth notes to have the slur printed below or inside the
> beam.  This works with a simple ^~ for ties.  How might I accomplish this?
>
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Slurs inside a beam

2018-08-11 Thread David F.
While we’re on the topic of bending slurs to our will, I’d like for slurred, 
beamed eighth notes to have the slur printed below or inside the beam.  This 
works with a simple ^~ for ties.  How might I accomplish this? 

\version "2.19"
\language "english"

\new Staff \with { beamExceptions = #'() } << {
 e'8 ~ e'8  % Tie bends down
 e'8 ^~ e'8  % Tie bends up *below* or *inside* the beam

e'8 ( a'8)  % Bends down
e'8 ^( a'8 )  % Bends up *above* or *outside* the beam

\tuplet 3/2 { b'8 ( a'8 ) f'8 }  % Bends down

\tuplet 3/2 { b'8 ^( a'8 ) f'8 }  % Bends up *above* or *outside* the beam
}>>

The behavior I am after can also be seen here:
  https://hymnary.org/hymn/SS4C1956/page/561

Thanks!
David


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