Re: Beaming until barline

2014-11-01 Thread Pierre Perol-Schneider
Hi David,

2014-10-31 20:39 GMT+01:00 David Nalesnik david.nales...@gmail.com:


 You could scale the stencil.  That way you wouldn't need to reconstruct
 the beam from what you find in 'beaming.


But of course!  Thanks much David!
Cheers,
Pierre
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Beaming until barline

2014-11-01 Thread David Nalesnik
On Fri, Oct 31, 2014 at 6:32 PM, Gilberto Agostinho 
gilbertohasn...@gmail.com wrote:

 David Nalesnik-2 wrote
  The attached file is what I come up with.

 Absolutely fantastic, David! Thanks really a lot, this function is
 looking really great!


Glad I can help!

By the way, part of this can be made a little prettier:


#(define (calc-beam-right segments)
   (fold
(lambda (elem prev)
  (if ( (cddr (cadr elem)) prev)
  (cddr (cadr elem))
  prev))
0
segments))

could be:

#(define (calc-beam-right segments)
   (fold
(lambda (elem prev)
  (max (cddr (cadr elem)) prev))
0
segments))

%%

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


Re: Beaming until barline

2014-11-01 Thread Gilberto Agostinho
David Nalesnik-2 wrote
 By the way, part of this can be made a little prettier:

Thanks David, I also appreciate slim and pretty codes :)

Take care,
Gilberto



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Beaming-until-barline-tp167937p168235.html
Sent from the User mailing list archive at Nabble.com.

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


Re: Beaming until barline

2014-10-31 Thread Gilberto Agostinho
Currently I am using this function written by Pierre Perol-Schneider:

\version 2.19.15

beamLength =
#(define-music-function (parser location myLength myPosition) (number?
number?)
  #{
\once\override Beam.stencil =
  #(lambda (grob) (grob-interpret-markup grob
#{
  \markup
  %% column just in case for multiple beams:
  %\column
  {
\translate #(cons 0 myPosition)
\beam #myLength #0 #0.4
%\vspace #-.73
%\beam #myLength #0 #0.4
   }
  #}))
  #})

\relative c' {
  \beamLength #19.1 #0
  c8[c c c c c c c]
  \stemDown
  \beamLength #20 #-5.5
  c[c c c c c c c]
  \once\override Staff.BarLine.bar-extent = #'(-7 . 2)
}




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Beaming-until-barline-tp167937p168115.html
Sent from the User mailing list archive at Nabble.com.

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


Re: Beaming until barline

2014-10-31 Thread Pierre Perol-Schneider
Hi Gilberto,

2014-10-31 3:37 GMT+01:00 Gilberto Agostinho gilbertohasn...@googlemail.com
 :
 Hi Pierre,

 Thank you so much for your answer. Oddly enough, it did not appear as a
 reply in our forum at Nabble, did you mean to send it privately to me?



Actually no. I did reply to all. Strange that you've got it as a private
message.


 As for your function, it is much more elegant than my previous hack. It is
 just a pity I couldn't so far automate this beam until barline,...


I know ; it's just an idea, it needs to be uppgraded. I'll think about it.


 ... but using your function together with manual adjustments actually
 works wonderfully well. I really appreciate it, thanks a lot.

 All the best,
 Gilberto


Cheers,
Pierre




 On 30/10/14 18:37, Pierre Perol-Schneider wrote:

Hi Gilberto,


2014-10-26 20:35 GMT+01:00 Gilberto Agostinho gilbertohasn...@gmail.com:


 If anyone still has any other ideas/suggestions, they are highly
 appreciated.


 Just a rough idea :

\version 2.19.15

beamLength =
#(define-music-function (parser location myLength myPosition) (number?
number?)
  #{
\once\override Beam.stencil =
  #(lambda (grob) (grob-interpret-markup grob
#{
  \markup
  %% column just in case for multiple beams:
  %\column
  {
\translate #(cons 0 myPosition)
\beam #myLength #0 #0.4
%\vspace #-.73
%\beam #myLength #0 #0.4
   }
  #}))
  #})

\relative c' {
  \beamLength #19.1 #0
  c8[c c c c c c c]
  \stemDown
  \beamLength #20 #-5.5
  c[c c c c c c c]
  \once\override Staff.BarLine.bar-extent = #'(-7 . 2)
}

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


Re: Beaming until barline

2014-10-31 Thread Gilberto Agostinho

Hi Pierre,

On 31/10/14 08:50, Pierre Perol-Schneider wrote:
Actually no. I did reply to all. Strange that you've got it as a 
private message.


That's indeed strange, have a look on this thread at nabble: 
http://lilypond.1069038.n5.nabble.com/Beaming-until-barline-td167937.html#a167952
If you don't mind, I will reply to that thread with a copy of your 
function, in case anyone looking for it in the future.



I know ; it's just an idea, it needs to be uppgraded. I'll think about it.


Sure, but it is a great idea. I really appreciate all your help.

Take care,
Gilberto

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


Re: Beaming until barline

2014-10-31 Thread Pierre Perol-Schneider
Hi Gilberto,

2014-10-26 20:35 GMT+01:00 Gilberto Agostinho gilbertohasn...@gmail.com:


 If anyone still has any other ideas/suggestions, they are highly
 appreciated.


Just a rough idea :

\version 2.19.15

beamLength =
#(define-music-function (parser location myLength myPosition) (number?
number?)
  #{
\once\override Beam.stencil =
  #(lambda (grob) (grob-interpret-markup grob
#{
  \markup
  %% column just in case for multiple beams:
  %\column
  {
\translate #(cons 0 myPosition)
\beam #myLength #0 #0.4
%\vspace #-.73
%\beam #myLength #0 #0.4
   }
  #}))
  #})

\relative c' {
  \beamLength #19.1 #0
  c8[c c c c c c c]
  \stemDown
  \beamLength #20 #-5.5
  c[c c c c c c c]
  \once\override Staff.BarLine.bar-extent = #'(-7 . 2)
}

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


Re: Beaming until barline

2014-10-31 Thread Pierre Perol-Schneider
Hi Gilberto,

Well, I've found this :

\version 2.19.15

beamLength =
#(define-music-function (parser location myLength) (number?)
   (define (myBeamLength grob)
 (let* ((beam (ly:beam::print grob))
   (beam-extent-x (ly:stencil-extent beam X))
   (beam-length-x (interval-length beam-extent-x))
   (beam-thickness (ly:grob-property grob 'beam-thickness))
   (beam-positions (ly:grob-property grob 'positions))
   (mrkp (markup #:beam (* beam-length-x (+ 1 (/ myLength 100)))
   0 beam-thickness))
   (new-Beam (ly:stencil-translate-axis
 (ly:stencil-translate-axis
   (grob-interpret-markup grob mrkp) -0.025 X)
 (car beam-positions)
 Y))) new-Beam))
  #{
\once\override Beam.stencil = #myBeamLength
  #})

\relative c' {
  \beamLength #10
  c8[c c c c c c c]
  \stemDown
  %% limitation: shows only one beam
  \beamLength #6
  c16[c c c c c c c c c c c c c c c]
  \once\override Staff.BarLine.bar-extent = #'(-7 . 2)
}

but, as you can see, it's limited to one beam... :(
Any help from schemers ?
TIA,
Pierre
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Beaming until barline

2014-10-31 Thread Gilberto Agostinho

Hi Pierre,

On 31/10/14 17:44, Pierre Perol-Schneider wrote:

but, as you can see, it's limited to one beam... :(


This new function great! For my particular composition the limitation 
won't be a problem as I only use a single beam, but if anyone could make 
this function more flexible, then it could be nice to add it to the LSR.


Thanks once again and take care,
Gilberto

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


Re: Beaming until barline

2014-10-31 Thread David Nalesnik
Hi,

On Fri, Oct 31, 2014 at 11:44 AM, Pierre Perol-Schneider 
pierre.schneider.pa...@gmail.com wrote:



 but, as you can see, it's limited to one beam... :(
 Any help from schemers ?


You could scale the stencil.  That way you wouldn't need to reconstruct the
beam from what you find in 'beaming.  Of course this will only produce good
results with flat beams!

 \version 2.19.15

beamLength =
#(define-music-function (parser location myLength) (number?)
   (define (myBeamLength grob)
 (let* ((beam (ly:beam::print grob))
(beam-extent-x (ly:stencil-extent beam X))
(beam-length-x (interval-length beam-extent-x))
(new (ly:stencil-scale beam (1+ (/ myLength 100)) 1)))
   new))

   #{
 \once\override Beam.stencil = #myBeamLength
   #})

\relative c' {
  \beamLength #10
  c8[c c c c c c c]
  \stemDown
  \beamLength #6
  c16[c c c c c c c c c c c c c c c]
  \override Staff.BarLine.bar-extent = #'(-7 . 2)
  \beamLength #3
  c32[ c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c]
}


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


Re: Beaming until barline

2014-10-31 Thread David Nalesnik
On Fri, Oct 31, 2014 at 2:39 PM, David Nalesnik david.nales...@gmail.com
wrote:


  Of course this will only produce good results with flat beams!


No, that should be OK.  I was just thinking that the horizontal scaling
might cause the beam to pull away from the stems, but in the examples I've
tried, the distortion isn't enough.

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


Re: Beaming until barline

2014-10-31 Thread David Nalesnik
Hi,

On Fri, Oct 31, 2014 at 2:39 PM, David Nalesnik david.nales...@gmail.com
wrote:


 You could scale the stencil.


This will break down if you have sub-beams because the entire beam is
stretched.  Thankfully, the coordinates of the various beam segments are
cached, and resetting these does get a response from ly:beam::print.

The attached file is what I come up with.

Enjoy!

--David
\version 2.19.15

#(define (calc-beam-right segments)
   (fold
(lambda (elem prev)
  (if ( (cddr (cadr elem)) prev)
  (cddr (cadr elem))
  prev))
0
segments))

#(define (myBeamLength extra)
   (lambda (grob)
 (let* ((segments (ly:beam::calc-beam-segments grob))
(beam-right-edge (calc-beam-right segments)))
   (let loop ((segs segments) (result '()))
 (if (null? segs)
 result
 (let* ((vertical (caar segs))
(horizontal (cadar segs))
(right-coord (cddr horizontal)))
   (if (= right-coord beam-right-edge)
   (set-cdr! horizontal
 (cons (cadr horizontal)
   (+ extra right-coord
   (loop (cdr segs)
 (append result 
   (list (list vertical horizontal))

lengthenBeam =
#(define-music-function (parser location extra-X)
   (number?)
   #{
 \override Beam.beam-segments = #(myBeamLength extra-X)
   #})


\relative c' {
  \lengthenBeam 3.5
  c8[ d e f g a b c]
  \once \offset bar-extent #'(0 . 3) Staff.BarLine
  \stemDown
  \lengthenBeam 3
  c,16[ c c c c c c c c c c c c c c c]
  \once \offset bar-extent #'(-5 . 0) Staff.BarLine 
  \override Staff.BarLine.bar-extent = #'(-7 . 2)
  \stemNeutral
  \lengthenBeam 1.5
  c8[ c16 c c32 c c c c16. c32 c8 c c8.. c32]
  \lengthenBeam 2.5
  c8[ d16 e f32 g a b c16. d32 e8 f g8.. a32]
  \once \offset bar-extent #'(-2 . 0) Staff.BarLine
}___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Beaming until barline

2014-10-31 Thread Gilberto Agostinho
David Nalesnik-2 wrote
 The attached file is what I come up with.

Absolutely fantastic, David! Thanks really a lot, this function is 
looking really great!

Take care,
Gilberto



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Beaming-until-barline-tp167937p168182.html
Sent from the User mailing list archive at Nabble.com.

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


Re: Beaming until barline

2014-10-26 Thread Pierre Perol-Schneider
Hi Gilberto,

2014-10-26 16:01 GMT+01:00 Gilberto Agostinho gilbertohasn...@gmail.com:


 So does anyone have any suggestions on how to extend the beam exactly until
 the barline?



'didn't make any trial yet but maybe this code could bring you some
inspiration :
http://lists.gnu.org/archive/html/lilypond-user/2013-05/msg00549.html

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


Re: Beaming until barline

2014-10-26 Thread Gilberto Agostinho
Hi Pierre,


Schneidy wrote
 'didn't make any trial yet but maybe this code could bring you some
 inspiration :
 http://lists.gnu.org/archive/html/lilypond-user/2013-05/msg00549.html

Thank you very much for the link, but I couldn't make it work. Apparently,
that function only deals with beams that were crossing barlines and are
located on system breaks (none of which happens on my score)

I found a way around this problem by using -\markup {\beam ...}, but it is
really not elegant at all, and I'd love this to be automatic. Here is my
hack:

\version 2.19.15
\relative c' {
  c8[ c c c c c c c]
  c8[ c c c c c c c]
}

\relative c' {  
  c8[ c c c c c c c]
  -\tweak extra-offset #'(1 . -2.75 ) ^\markup { \beam #1.8 #0 #0.4 }
  c8[ c c c c c c c]
  -\tweak extra-offset #'(1 . -2.75 ) ^\markup { \beam #1.8 #0 #0.4 }
}

producing:
http://lilypond.1069038.n5.nabble.com/file/n167952/ex.png 

If anyone still has any other ideas/suggestions, they are highly
appreciated.

Thanks and take care,
Gilberto



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Beaming-until-barline-tp167937p167952.html
Sent from the User mailing list archive at Nabble.com.

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