Re: Variable systems-per-page only on last page?

2017-09-10 Thread Wols Lists
On 10/09/17 05:20, David F. wrote:
> That doesn’t work for me.  (Lilypond 2.19.58)  I’ve got 3 bars at the end of 
> a piece that would comfortably fit on a single line, but they are stretched 
> to fill two lines.
> 
Is there a ragged-last-staff as well? Something like that, anyway, that
 means that the last line isn't the full width? You might need that as well.

Cheers,
Wol

> David
> 
> On Sep 9, 2017, at 7:38 PM, Kieren MacMillan  wrote:
> 
>> Hi David,
>>
>>> Is there a way to tell Lilypond to put 2 systems per page on all pages 
>>> except the last—the last page can have one or two systems, depending on 
>>> whichever fits best?
>>
>> 1. It would be great if there was some consistent way to tell Lilypond to 
>> consider the first and last page separately from the rest of the score, for 
>> layout purposes — as far as I know, there's no such thing.
>>
>> 2. If you use ragged-last-bottom = ##t, then systems-per-page = 2 should do 
>> what you want. Does that not work for you?
>>
>> Cheers,
>> Kieren.
>> 
>>
>> Kieren MacMillan, composer
>> ‣ website: www.kierenmacmillan.info
>> ‣ email: i...@kierenmacmillan.info
>>
> 
> 
> ___
> 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: Variable systems-per-page only on last page?

2017-09-10 Thread Simon Albrecht

On 10.09.2017 02:47, David F. wrote:

Is there a way to tell Lilypond to put 2 systems per page on all pages except 
the last—the last page can have one or two systems, depending on whichever fits 
best?


I’m afraid you might have to hard-code it. Fortunately, this can be done 
by something like

\paper {
  page-count = 8
  systems-per-page = 2
  system-count = 15
}
– only you might end up with the single system being on another page 
than the last, in which case… you need manual breaks.
It’s a difficult task – sometimes it’s better to just look for 
appropriate conditions in which Lily will space it out nicely without 
being restricted like that, sometimes you have to bite the bullet.


Best, Simon

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


Re: Getting absolute position of objects

2017-09-10 Thread Knut Petersen


I also need to output the absolute coordinates of all objects on the page, to generate training data for optical music recognition. I'm trying to print some information in \applyOutput, and I see that NoteHead X-offset and Y-offset are 0, and X-parent, Y-parent, X-positions, and Y-positions all 
seem to be (). Is there a way to get the absolute coordinates, so that I can add them to event-listener.ly ?




It certainly is possible, but you need to implement an after-line-breaking function. There you can access the paper variables (margins etc.) as well as the xy-position of grobs. You may have a look at videohelper.ily file I published on this list on 2017-07-21. There is a function mkvideo-dump that 
easily could be extended to meet your requirements.


Knut

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


Re: improving Janek's \dynamic function (for combo dynamics)

2017-09-10 Thread Thomas Morley
2017-09-03 18:30 GMT+02:00 Thomas Morley :

> I think I know how to proceed,

@Kieren
Attached the newest and heavily revised version.
Please read comments for usage.

@David
For one example I use predefined markup-commands like
  \markup with-red = \markup \with-color #red \etc

I seem to remember there was some even simpler possibility. Or was it
just a proposal? I can't find it at the moment.

Btw,
\markup my-concat = \markup \concat { \etc "!" }
\markup \my-concat "foo"
fails, no surprise, just a dream ...

Cheers,
  Harm
\version "2.19.64"

#(use-modules (ice-9 regex))

#(define (note-column::main-extent grob)
"Return extent of the noteheads in the 'main column', (i.e. excluding any 
suspended noteheads), or extent of the rest (if there are no heads)."
  (let* ((note-heads (ly:grob-object grob 'note-heads))
 (stem (ly:grob-object grob 'stem))
 (rest (ly:grob-object grob 'rest)))
(cond ((ly:grob-array? note-heads)
   (let (;; get the cdr from all note-heads-extents, where the car 
 ;; is zero
 (n-h-right-coords
   (filter-map
 (lambda (n-h)
   (let ((ext (ly:grob-extent n-h grob X)))
  (and (= (car ext) 0) (cdr ext
 (ly:grob-array->list note-heads
 ;; better be paranoid, find the max of n-h-right-coords and return
 ;; a pair with (cons 0 )
 (cons 0.0 (reduce max 0 n-h-right-coords
  ((ly:grob? rest)
   (ly:grob-extent rest grob X))
  ;; better be paranoid
  (else '(0 . 0)

%% TODO #\space as well?
#(define char-set:dynamics
  (char-set #\f #\m #\p #\r #\s #\z)) 

%% TODO
%% There's the scheme-procedure `make-regexp', I'm not confident with reg-exps 
%% to use it, though
#(define (make-reg-exp separator-pair)
  (format #f "\\~a[^~a~a]*\\~a"
(car separator-pair)
(car separator-pair)
(cdr separator-pair)
(cdr separator-pair)))

#(define (dynamics-list separator-pair strg)
;; Takes a string, which is splitted at space. Local reg-exp and separators are
;; processed from @var{separator-pair}.
;; Dynamic signs within the splitted string (which are rendered by separators)  
;; are selected by matching reg-exp and by containing only dynamic characters 
;; between the separators.  
;;
;; Returns a new list containing not-dynamic strings and sublists with always
;; three entries.  Before-the-dynamic - dynamic - after-dynamic.
;; 
;; Example:
;; (dynamics-list (cons #\{ #\}) "poco -{f}- piu"))
;; =>
;; (list "poco" (list "-" "f" "-") "piu")
;; 
  (let ((reg-exp (make-reg-exp separator-pair))
(separators (char-set (car separator-pair) (cdr separator-pair
(map
  (lambda (s)
(let* ((match (string-match reg-exp s)))
   (if match 
   (let* ((poss-dyn (match:substring match))
  (cand (string-trim-both poss-dyn separators)))
 (if (string-every char-set:dynamics cand)
   (list
 (match:prefix match)
 cand
 (match:suffix match))
 s))  
   s)))
  (string-split strg #\space
  
#(define (get-all-list-indices lst)
"Takes a list and returns a new list of all indices of sublists in @var{lst}"
  (filter-map
(lambda (e c) (if (list? e) c #f))
lst
(iota (length lst

#(define (dynamic-text::format-dynamics fontsize markup-command lst)
;; (1) Convert lst into a list where the targeted string is rendered
;; with dynamic-markup.  The targeted string is identified by being
;; second in a three-element-(sub-)list of lst.
;; (2) remove empty strings from (sub-)lists.
;; (3) insert " " between any element of lst but not between
;; elements of the (sub-)lists
;; (4) Return a new list, unfolded one level
;; TODO disentangle applying markup-commands from other stuff?
(append-map
  (lambda (y) (if (list? y) y (list y)))
  (list-insert-separator
(map
  (lambda (e)
(if (and (list? e) (= (length e) 3))
(remove
   (lambda (x) (and (string? x) (string-null? x)))
   (list
 (car e)
 (if (number? fontsize)
 (make-fontsize-markup fontsize
   (markup-command (second e)))
 (markup-command (second e)))
 (last e)))
e))
  lst)
" ")))

#(define (dynamic-text::format-text fontsize markup-command lst)
"Format string-parts of @var{lst} with @var{fontsize} and @var{markup-command}"
  (map
(lambda (arg)
  (if (string? arg)
  (if (number? fontsize)
  (make-fontsize-markup fontsize
(markup-command arg))
  (markup-command arg))
  arg))
lst))
 

Re: improving Janek's \dynamic function (for combo dynamics)

2017-09-10 Thread David Kastrup
Thomas Morley  writes:

> 2017-09-03 18:30 GMT+02:00 Thomas Morley :
>
>> I think I know how to proceed,
>
> @Kieren
> Attached the newest and heavily revised version.
> Please read comments for usage.
>
> @David
> For one example I use predefined markup-commands like
>   \markup with-red = \markup \with-color #red \etc
>
> I seem to remember there was some even simpler possibility.

That is the simpler possibility.  Or rather, the most straightforward
one.

The previous suggestion was to use

with-red-markup = \markup \with-color #red \etc

(?) but that would not have created a make-with-red-markup convenience
function and/or made (markup #:with-red ...) do anything useful.

> Btw,
> \markup my-concat = \markup \concat { \etc "!" }
> \markup \my-concat "foo"
> fails, no surprise, just a dream ...

More like a nightmare.  Some markup expression with some \etc somewhere
in the middle?  How many arguments is it supposed to stand for?  And
which markup command is it supposed to complete?  And when is the
definition supposed to be complete when \etc is not necessarily the last
part?

And here you put \etc in a position where it could replace an arbitrary
number of markups, but my-concat magically does not get a markup list as
its argument but a single markup?

This is solidly "do what I mean, not what I say" realm, and computers
have nothing to go by but what you say.

-- 
David Kastrup

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


Re: Is there a way to circle around tab numbers?

2017-09-10 Thread Stephen MacNeil
sorry I don't use tab and am not on lilypond that much because of my work
schedule. It shouldn't be that hard .. I suspect you are trying to mimic
guitar world notation or the like. If you still have problems let me know
and when I have a chance I will look at it.

On Sat, Sep 9, 2017 at 10:41 AM, Devin Ulibarri 
wrote:

> Stephen MacNeil:
> > you could just change it to tab
>
> Thanks, this is helpful.
>
> If possible, I would like some more information about how to tweak the
> output.
>
> * Is it possible to make the space within the circle opaque, but without
> hiding the number (just hiding the tab line)? If so, how is this done?
>
> (I could do this in Inkscape, but would rather automate it if possible)
>
> Thanks!
> Devin
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there a way to circle around tab numbers?

2017-09-10 Thread Thomas Morley
2017-09-09 16:41 GMT+02:00 Devin Ulibarri :
> Stephen MacNeil:
>> you could just change it to tab
>
> Thanks, this is helpful.
>
> If possible, I would like some more information about how to tweak the
> output.
>
> * Is it possible to make the space within the circle opaque, but without
> hiding the number (just hiding the tab line)? If so, how is this done?
>
> (I could do this in Inkscape, but would rather automate it if possible)
>
> Thanks!
> Devin



How about below?

The first code simplifies the one you've found already and works as
you want, but the circle has a variable radius depending on the
stencil.
If you're fine with it, great. Otherwise use the second coding where
the circle has a static radius.

circle =
  \once \override TabNoteHead.stencil =
#(lambda (grob)
  (circle-stencil (tab-note-head::print grob) 0.1 0.3))

\new TabStaff { \circle c'' \circle e'' }

circleH =
  \once \override TabNoteHead.stencil =
#(lambda (grob)
  (let ((note (tab-note-head::print grob)))
  (ly:stencil-add
note
(ly:stencil-translate-axis
  ;; 1.5 is the default staff-space in TabStaff, use a little less
  ;; for the circle-radius
  (make-circle-stencil 1.3 0.1 #f)
  (interval-center (ly:stencil-extent note X))
  X

\new TabStaff { \circleH c'' \circleH e'' }



HTH,
  Harm

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


Re: Is there a way to circle around tab numbers?

2017-09-10 Thread Devin Ulibarri
Thomas Morley:
> The first code simplifies the one you've found already and works as
> you want, but the circle has a variable radius depending on the
> stencil.
> If you're fine with it, great. Otherwise use the second coding where
> the circle has a static radius.

This is exactly what I am looking for! :)

I will play around with this a little bit, but this looks sufficient enough.

Thanks everyone!
Devin

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


Another unterminated crescendo issue

2017-09-10 Thread Ivan Kuznetsov
Hello all:

I don't understand why I am getting the error:

 warning: unterminated crescendo
 \new Voice {\voiceTwo r8 d8 bf8  r8   a8
\<  cs8 }

as both the crescendo start and end points (\< and \f) are
in \voiceTwo.

I am implementing one of the solutions I received from
my "Unterminated Crescendo Issue" thread on August 28
(https://www.mail-archive.com/lilypond-user@gnu.org/msg122126.html)
though it does not work here.

Thank you for your help.


\version "2.19.65"
\include "english.ly"


\score {

   \new Staff = "guitar"
   {
 \clef "treble_8"
\time 6/8

<<
{\voiceOne  f'!4.fs'4.}
\new Voice {\voiceTwo r8 d8 bf8  r8   a8\<  cs8 }
>>
\oneVoice
|

\time 3/4

<<
{\voiceOne  r4.   g'8 b4 }
\new Voice {\voiceTwo 2.\f   }
>>
\oneVoice

   }


  \layout {
\context {
 \Score
  proportionalNotationDuration = #(ly:make-moment 1/16)
}
  }

}

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


Re: Another unterminated crescendo issue

2017-09-10 Thread Kieren MacMillan
Hi Ivan,

> I don't understand why I am getting the error:
> warning: unterminated crescendo
> \new Voice {\voiceTwo r8 d8 bf8  r8   a8
>\<  cs8 }
> as both the crescendo start and end points (\< and \f) are
> in \voiceTwo.

But they're in two DIFFERENT \voiceTwos… =)

Try this:

> \context Voice = "two" {\voiceTwo r8 d8 bf8  r8   a8\<  cs8 }
...
> \context Voice = "two" {\voiceTwo 2.\f   }

Hope that helps!
Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


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


Re: Another unterminated crescendo issue

2017-09-10 Thread David Kastrup
Ivan Kuznetsov  writes:

> Hello all:
>
> I don't understand why I am getting the error:
>
>  warning: unterminated crescendo
>  \new Voice {\voiceTwo r8 d8 bf8  r8   a8
> \<  cs8 }
>
> as both the crescendo start and end points (\< and \f) are
> in \voiceTwo.

\voiceTwo is just the style of typesetting, not an actual voice
context.  When you say \new Voice, you _indeed_ get a new Voice.

In this case there was no actual need to switch back to a single Voice
as stuff like | and \time 3/4 will work fine inside of a Voice (and the
latter has effect for the entire Score unless you take special
measures).

Here is one possibility to hook into a preexisting voice (does not work
as soon as any musical time actually passed: in that case the respective
voices are retired and new ones created as necessary).

\version "2.19.65"
\include "english.ly"


\score {

   \new Staff = "guitar"
   {
 \clef "treble_8"
\time 6/8

\voices 1,2 <<
{f'!4.fs'4.} \\
{r8 d8 bf8  r8   a8\<  cs8 }
>>
|

\time 3/4

\voices 1,2 <<
{r4.   g'8 b4 } \\
{2.\f   }
>>
   }


  \layout {
\context {
 \Score
  proportionalNotationDuration = #(ly:make-moment 1/16)
}
  }

}

However, in this case there is no other voice started earlier than the
split voices, so LilyPond will take Voice "1" as its default voice to
continue (and use for \oneVoice and similar).  To avoid that, putting
another \new Voice around the bulk of your music.  That will then be the
default voice outside of the << >> constructs.

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