Re: \textLengthOn relative to bar lines instead of following note

2018-04-27 Thread Thomas Morley
2018-04-27 17:39 GMT+02:00 Robert Hickman :
>>
>> Another hack:
>>
>> \version "2.18.2"
>>
>> pushRight =
>> #(define-event-function (parser location amount)(number?)
>> #{
>>   \tweak text \markup \with-dimensions #(cons 0 amount) #'(0 . 0) ""
>>   -\rightHandFinger #5
>> #})
>>
>> {
>>   \partial 2
>>   a'4^"Unprefixed" a'\pushRight 7
>>   |
>>   a' a'^"Prefixed" a' a'
>> }
>>
>> Cheers,
>>   Harm
>>
>
> This produces the desired result, thanks.

Hi Robert,

glad it works for you.

Please always reply to all, even in case just conforming a suggestion works.
So that others know the problem is solved.

Thus, cc-ing the list again.

Cheers,
  Harm

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


Re: large bottom text area only on first page

2018-04-27 Thread Thomas Morley
2018-04-27 10:32 GMT+02:00 Thomas Morley <thomasmorle...@gmail.com>:

> I'd go for a page-footer and `on-page'.

For page 1 `first-page' would do it already.

Cheers,
  Harm

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


Re: spacer rest *

2018-04-27 Thread Thomas Morley
2018-04-27 10:53 GMT+02:00 Gianmaria Lari :
>
>
>
> On 25 April 2018 at 10:09, Gianmaria Lari  wrote:
>>
>> I don't understand the difference between s8 8 8 and s8*3.
>>
>> For example have a look to the following code that engrave two scores:
>>
>> \version "2.19.81"
>> rh = \fixed c'{g8 8 8 8}
>>
>> dyn = { s8 \> 8 8 8 \!}
>> { << \rh \new Dynamics \dyn >> }
>>
>> dyn = { s8 \> 8*3 \!}
>> { << \rh \new Dynamics \dyn >> }
>>
>>
>> These are the resulting scores:
>>
>>
>> I expected that dynamics would be the same. Why they are not?
>> Thank you, g.
>
>
> I made some test with the code above and discovered something that maybe for 
> you all was clear but it wasn't for me. Have a look to the following code:
>
> \version "2.19.81"
> \score {
>   \new Voice <<
> {f4 g a b}
> {s4\< 4 4 4\!}
>   >>
>   \layout {}
> }
>
> I didn't expect to see this output:
>
>
>
> If I understood correctly this is the fact that spacer rest (and normal rest) 
> does not "propagate".
>
> To fix it I found two different ways.
> First one:
>
> \version "2.19.81"
> \score {
>   \new Voice <<
> {f4 g a b}
> {s4\< s4 s4 s4\!}
>   >>
>   \layout {}
> }
>
>
>
> ... and second one (but I'm not sure it is "correct" even if it compiles and 
> works...)
>
> \version "2.19.81"
> \score {
>   \new Voice <<
> {f4 g a b}
> \new Dynamics {s4\< 4 4 4\!}
>   >>
>   \layout {}
> }
>
>
> Any comments?
>
> And why spacer rests and rests don't "propagate" like note?
>
> Thank you, g.


>From Changes:
"Isolated durations in music now stand for unpitched notes. Pitches
are taken from the preceding note or chord."

Spacers and rests don't have a pitch.
Iiuc the last seen note-event-pitch is taken, `b' in your case.
Falling back to c' if none was entered so far.

Cheers,
  Harm

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


Re: large bottom text area only on first page

2018-04-27 Thread Thomas Morley
2018-04-27 9:50 GMT+02:00 Werner LEMBERG :
>
> Folks,
>
>
> let's assume that I want to add a large block of text at the bottom of
> the first page only:
>
>
>page 1   page 2, 3, ...
> +-+  +-+
> | |  | |
> | music   |  | music (cntd.)   |
> | |  | |
> | |  | |
> | |  | |
> | |  | |
> |-|  | |
> | text|  | |
> | |  | |
> | |  | |
> | |  | |
> +-+  +-+
>
>
> How can I achieve that?
>
>
> Werner



Hi Werner,

I'd go for a page-footer and `on-page'.

Below our modified
input/regression/page-headers-and-footers.ly

txt = \markup \wordwrap-string
"Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua.  Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat. Lorem ipsum dolor sit amet,
consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua.  Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat."

\paper {
  ragged-last-bottom = ##f


  oddHeaderMarkup = \markup  {
\override #'(baseline-skip . 2.5)
\center-column {
  \fill-line { \teeny " " " " }
  \on-the-fly #not-first-page \fromproperty #'page:page-number-string
}
  }

  evenHeaderMarkup = \oddHeaderMarkup

  oddFooterMarkup = \markup \fill-line {
\override #'(baseline-skip . 1)
\center-column {
\on-the-fly #(on-page 1) \txt
\fill-line { \teeny " " " " }
}
  }
}

#(set-default-paper-size "a6" 'portrait)

\book {
  \score {
\new Staff \relative {
  \repeat unfold 18 { a b c d \break }
}
  }
}

HTH,
  Harm

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


Re: Make TOC entries available to LaTeX

2018-04-26 Thread Thomas Morley
2018-04-26 8:48 GMT+02:00 Urs Liska <li...@openlilylib.org>:
> Hi Harm,
>
> thanks for looking into this.
>
>
> Am 25.04.2018 um 23:13 schrieb Thomas Morley:
>>
>> 2018-04-25 16:00 GMT+02:00 Urs Liska <li...@openlilylib.org>:
>> ...
>>>
>>> 2)
>>> Assuming the TOC items are created using \tocItem then it should be
>>> guaranteed that there is the same label present as key in both
>>> label-table
>>> and one of the (toc-items) sublists. So (IISC) several further checks
>>> could
>>> be removed additionally (or am I missing something?):
>>>
>>>   (let* ((label (car toc-item))
>>>  (text  (caddr toc-item))
>>>  (page (assoc-ref label-table label)))
>>>
>>> should be sufficient? Therefore the whole function could be written as
>>
>> Being always paranoid, I would do some thorough testings.
>
>
> OK, I've found the case where my assumption would break. A rare (and
> pointless) case but an existing one:
>
> %%%
> #(define (oly:create-toc-file layout pages)
>(format #t "label-page-table:\n~a\n" (ly:output-def-lookup layout
> 'label-page-table))
>(format #t "toc-items:\n~a\n" (toc-items)))
>
> \paper {
>   #(define (page-post-process layout pages) (oly:create-toc-file layout
> pages))
> }
>
>
> \tocItem \markup "A TOC entry"
> {
>   c'
> }
>
> \tocItem \markup "Another TOC entry"
> %%%
>
>
> The \tocItem without anything following it will create an entry in the
> toc-items list but no label. So this second simplification won't work
> reliably.

I think I've seen usecases for this. So better be prepared to deal with it.

>
>> ...
>>
>>> 3)
>>> I think the inclusion in the TeX TOC can (now?) be done in a simpler way
>>> using the catchfile package:
>>>
>>> \documentclass{article}
>>> \usepackage{pdfpages,catchfile}
>>> \newcommand\includelilypond[1]{%
>>>\begingroup
>>>  \CatchFileDef\currentlilypondtoc{#1.toc}{}
>>>
>>>
>>> \edef\x{\noexpand\includepdf[pages=-,addtotoc={\currentlilypondtoc}]{#1.pdf}}
>>>\expandafter\endgroup\x
>>> }
>>> \begin{document}
>>> \tableofcontents
>>> \includelilypond{test}
>>> \end{document}
>>>
>>>
>>> (Answer from
>>>
>>> https://tex.stackexchange.com/questions/428239/merge-in-manual-toc-entries-in-a-lualatex-document)
>>>
>>> There's only one issue: The TOC will create wrong entries when LilyPond's
>>> first page number is not 1. So there should actually be an offset in
>>> place.
>>> How can I read the value of the first-page-number variable to set up this
>>> offset?
>>
>> page-post-process has the layout-variable.
>> (ly:output-def-lookup layout 'first-page-number) should do the trick.
>
>
> Thanks, this works.
> What do you think: this example code is much easier to understand than the
> one currently in the manual. Should I propose an update?


Would be very nice.
You noticed my other mail about relying on "ancester-layout"?
Should be implemented as well.

Though, I don't have the knowledge to judge the Tex-coding.

Cheers,
  Harm

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


Re: Make TOC entries available to LaTeX

2018-04-26 Thread Thomas Morley
2018-04-25 23:13 GMT+02:00 Thomas Morley <thomasmorle...@gmail.com>:

>> There's only one issue: The TOC will create wrong entries when LilyPond's
>> first page number is not 1. So there should actually be an offset in place.
>> How can I read the value of the first-page-number variable to set up this
>> offset?
>
> page-post-process has the layout-variable.
> (ly:output-def-lookup layout 'first-page-number) should do the trick.

Rethinking this ...
With the code above you'll catch the first-page-number of the
book_part_ not the entire book.

You need to find the topmost parent layout and look for first-page-number there:

%% slightly changed `book-first-page' from define-markup-comands
#(define-public (get-book-first-page layout)
  "Return the @code{'first-page-number} of the entire book"
  (define (ancestor layout)
"Return the topmost layout ancestor"
(let ((parent (ly:output-def-parent layout)))
  (if (not (ly:output-def? parent))
  layout
  (ancestor parent
  (ly:output-def-lookup (ancestor layout) 'first-page-number))

Cheers,
  Harm

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


Re: Slurs do not work with Larsen articulations

2018-04-25 Thread Thomas Morley
2018-04-25 23:23 GMT+02:00 Carl Sorensen :
>
>
> On 4/25/18, 2:34 PM, "David Kastrup"  wrote:
>
> So I see it more as a documentation challenge than a design failure.
>
>
> I agree, and I think we can improve the documentation.
>
> Carl
>
>

startSlur, stopSlur was by no means meant as a proposal!
I was simply musing around.

Ofcourse it's a documentation issue, nothing else.

Best,
  Harm

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


Re: Make TOC entries available to LaTeX

2018-04-25 Thread Thomas Morley
2018-04-25 16:00 GMT+02:00 Urs Liska <li...@openlilylib.org>:
> Hi Harm
>
>
> Am 19.04.2018 um 23:23 schrieb Thomas Morley:
>
> 2018-04-19 16:19 GMT+02:00 Urs Liska <li...@openlilylib.org>:
>
> Hi all,
>
> I'm preparing an automated edition process using LuaLaTeX, Pandoc and
> LilyPond.
>
> After some experimentation I have come to the conclusion that I'll have to
> insert the multi-movement score as a single PDF created by LilyPond (but
> through lyluatex to make use of caching and the layout mechanics).
>
> I first had used lyluatex's facility to include the score's system by system
> and print all the titles with LaTeX, but this didn't work out - for the
> first time I realized that lilypond-book-preamble.ly makes the vertical
> staff-staff spacing as tight as possible, which often makes the page layout
> pretty bad. Creating the movements separately is not an option either
> because not all movements will start on a new page.
>
> So now I have included a multi-movement score in the LaTeX document and
> don't know how to add TOC entries (in LaTeX) for the movements. I can see
> two possible ways, but don't know if they are really possible and if so how
> to approach them:
>
> Is it possible to insert something in the PDF output that LaTeX can pick up
> as TOC entries?
> (actually I doubt this is possible, but since it would be the easiest way I
> thought I'd ask anyway)
> Can I reliably retrieve the current page number of a given score's title
> block?
> With that information I could write them to a log file and read that later
> in LaTeX.
>
> TIA
> Urs
>
> PS: I don't know if it matters but the file is produced using
> ly:book-process etc.
>
>
> Doesn't
> http://lilypond.org/doc/v2.19/Documentation/usage-big-page#sharing-the-table-of-contents
> do what you want?
>
>
> Thank you, yes, this is what I needed, and finally I got the time to make it
> work.
> I must admit I wouldn't have thought about looking in the *usage* manual for
> that information.
>
> On closer inspection of the code I have some questions about it.

I'll try to answer ...

> %%%
> #(define (oly:create-toc-file layout pages)
>   (let* ((label-table (ly:output-def-lookup layout 'label-page-table)))
> (if (not (null? label-table))
>   (let* ((format-line (lambda (toc-item)
>  (let* ((label (car toc-item))
> (text  (caddr toc-item))
> (label-page (and (list? label-table)
>  (assoc label label-table)))
> (page (and label-page (cdr label-page
>(format #f "~a, section, 1, {~a}, ~a" page text label
>  (formatted-toc-items (map format-line (toc-items)))
>  (whole-string (string-join formatted-toc-items ",\n"))
>  (output-name (ly:parser-output-name))
>  (outfilename (format "~a.toc" output-name))
>  (outfile (open-output-file outfilename)))
> (if (output-port? outfile)
> (display whole-string outfile)
> (ly:warning (_ "Unable to open output file ~a for the TOC
> information") outfilename))
> (close-output-port outfile)
>
> \paper {
>   #(define (page-post-process layout pages) (oly:create-toc-file layout
> pages))
> }
> %%%
>
> 1)
> If I see correctly the inner let* will only be evaluated if
> 'label-page-table has successfully been found and is not empty.
> If this object is not found or if there are no TOC entries in the file
> label-table will be an empty list, right?
> If that's true the (and (list? label-table) ... is redundant, isn't it?

Yep.

> 2)
> Assuming the TOC items are created using \tocItem then it should be
> guaranteed that there is the same label present as key in both label-table
> and one of the (toc-items) sublists. So (IISC) several further checks could
> be removed additionally (or am I missing something?):
>
>  (let* ((label (car toc-item))
> (text  (caddr toc-item))
> (page (assoc-ref label-table label)))
>
> should be sufficient? Therefore the whole function could be written as

Being always paranoid, I would do some thorough testings.

> #(define (oly:create-toc-file layout pages)
>   (let* ((label-table (ly:output-def-lookup layout 'label-page-table)))
> (if (not (null? label-table))
>   (let* ((format-line (lambda (toc-item)
>  (let* ((label (car toc-item))
> (text  (caddr toc-item))
> (page (assoc-ref label-table label)))
>(format #f "~a, section, 1, {~a}, ~a" page 

Re: Slurs do not work with Larsen articulations

2018-04-25 Thread Thomas Morley
2018-04-25 21:32 GMT+02:00 Carl Sorensen :
>
>
>
>
> From: Evan Driscoll 
> Date: Wednesday, April 25, 2018 at 12:42 PM
> To: Carl Sorensen 
> Cc: Robert Hickman , Kieren MacMillan
> , David Kastrup , Lilypond-User
> Mailing List 
> Subject: Re: Slurs do not work with Larsen articulations
>
>
>
>
>
> That sounds good to me.
>
> Thanks for the feedback.
>
> In case it's not clear, my pseudo-objection to the wording
>
> +Note that @code{[} and @code{]} do not enclose the notes to be
> +slurred.
>
> is that the ( and ) literally *do* enclose the notes that are slurred,
> except for the first. I get that the intent seems somehow different between
> 'a( b c)' and '(a b c)' in terms of what the parens mean, but the 'b' and
> 'c' still are enclosed by the parens even in the LilyPond syntax.
>
> Since they only enclose *all but the first* note of the slur, they don’t
> enclose the notes to be slurred.
>
> a b ( c d ) will not put a slur encompassing c and d, but encompassing b, c,
> and d.  That is the primary mistake that newcomers make.
>
> But the wording that you helped me to see is probably clearer, so I will
> certainly go with that.
>
> Thanks,
>
> Carl



Sometimes I think using "(" and ")" to indicate slurs leads to
misunderstandings, they are read as a sort of brackets (they are not)
Ofcourse it's conveniant, but I wonder, if doing like below would lead
to the same misinterpretation:

startSlur =  #(make-span-event 'SlurEvent START)
stopSlur = #(make-span-event 'SlurEvent STOP)


{
  a'-\startSlur b' c''-\stopSlur
}

Cheers,
  Harm

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


Re: Slurs do not work with Larsen articulations

2018-04-25 Thread Thomas Morley
Hi Carl,

2018-04-25 13:26 GMT+02:00 Carl Sorensen :
> Evan,
>
> Thanks for your feedback.  Feedback from new users is important for improving 
> the Learning Manual.

Indeed.

> There is a point that I was trying to make with these changes, without 
> jumping right out and saying it (because I couldn’t find a good place to jump 
> out and say it).  In LilyPond, *ALL* extra things that apply to a note are 
> added *after* a note, not before.

To be complete.
There's one exception I'm aware of: ligatures:
\[ g' c, a' f d' \]

> And they are *not* added after a "note pitch".  A note consists of a pitch 
> plus a duration.  For a given note, either the pitch or the duration can be 
> implicit, which means they are not included in the input but instead get 
> their value from the previous note.  Following the note, we get all the 
> modifiers.
>
> This pattern needs to be understood to be successful in working with 
> LilyPond.  Once you understand this, it's clear that you can't use the ABC 
> notation of enclosing a series of notes in parentheses.

Reading this thread I looked for a LM section explaining this
postfix-syntax and couldn't find any, did I overlook something?

If not,  think it should be inserted in section
LM
3. Fundamental concepts
3.1 How LilyPond input files work

My proposal:

 proposal-start

LM 3.1.4 Attaching other elements to a note - postfix-syntax

Writing a note means to enter a pitch with a duration (which may be implicit).
Ofcourse several other elements may belong to this note, like fingerings,
articulations, slurs, ties, text etc.

All those elements are _attached_ to the note. An example in pseudo-code:

  Note-of-pitch-c'-and-duration-8
with fingering 1
with articulation tenuto
with starting slur
with starting tie
with text 'what-ever-remark'

Attaching elements in this mannor is called postfix-syntax.

The above pseudo-code-example would be done in LilyPond-syntax as

{
  c'8-1---(-~-\markup "what-ever-remark"
  %% end Slur
  c'-)
}

The "-"-sign inserts the elements into the list of elements attached to this
note.
Ofcourse all those "-"-signs are probably hard to read, so for convenience most
of them can be omitted. Above can be rewritten as:

{
  c'8-1--(~\markup "what-ever-remark" c')
}


LM 3.1.5 On the un-nestedness of brackets and ties

 proposal-end


Ofcourse this only a sketch.
Probably links to further explanations should be added. etc


Cheers,
  Harm

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


Re: How can I adjust length-fraction of tremolo on beamed stem?

2018-04-25 Thread Thomas Morley
2018-04-25 8:05 GMT+02:00 takumi ikeda :
> \version "2.19.61"
>
> {
>   \override Stem.length = #10
>   \override StemTremolo.beam-thickness = #0.3
>   \override StemTremolo.slope = #0.2
>   \override StemTremolo.beam-width = #1.5
>   \override StemTremolo.extra-offset = #'(0 . 1)
>   \override StemTremolo.length-fraction = #0.7 %% not works on the beams.
>   %\override Beam.length-fraction = #0.7 %% would like to adjust
> only tremolo, not beams.
>   c''4:64 c''8.:64 c''16:64
> }
>
> % Thanks,
> % Takumi



Does below help already?

\version "2.19.81"

tst =
#(define-music-function (y)(number?)
#{
  \override StemTremolo.after-line-breaking =
  #(lambda (grob)
(let* ((y-off (ly:grob-property grob 'Y-offset))
   (dir (ly:grob-property grob 'direction)))
  (ly:grob-set-property! grob 'Y-offset (+ y-off (* y dir)
#})

{
  \override Stem.length = #10
  \tst -0.5
  c''4:64 c''8.:64 c''32:128 c''32:128
}


Cheers,
  Harm

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


Re: \textLengthOn relative to bar lines instead of following note

2018-04-24 Thread Thomas Morley
2018-04-25 0:10 GMT+02:00 Kieren MacMillan :

> That version, while good to know about, doesn’t allow the notes to space 
> themselves normally:
>
> I believe the OP wanted (and I definitely want) the notes in that measure to 
> be spaced normally.


Hi Kieren,

I read
https://lists.gnu.org/archive/html/lilypond-user/2018-04/msg00741.html
different, i.e. the OP wants the needed space inserted at the end of the bar.

Anyway, ofcourse my code was made with the purpose _not_ to stretch or
compress, just inserting space at a certain location.

Cheers,
  Harm

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


Re: \textLengthOn relative to bar lines instead of following note

2018-04-24 Thread Thomas Morley
2018-04-24 17:09 GMT+02:00 Kieren MacMillan :
> Hi all,
>
>>> It would be nice to be able to arbitrarily set the duration of the moment 
>>> that would (if necessary) be stretched.
>> Ah, I follow now. Interesting! Thanks Kieren!
>
> Here’s a hack that shows the desired outcome [in the first measure]:
>
> \version "2.18.2"
>
> {
>\partial 2
><<
>  { \oneVoice a'4^\markup { Unprefixed }( a'4) }
>  \\
>  { \once \hide Rest \tweak extra-spacing-width #'(10 . 10) r2 }
>>>
>a'4( a'4^\markup { Prefixed } a'4)
> }
>
> Cheers,
> Kieren.



Another hack:

\version "2.18.2"

pushRight =
#(define-event-function (parser location amount)(number?)
#{
  \tweak text \markup \with-dimensions #(cons 0 amount) #'(0 . 0) ""
  -\rightHandFinger #5
#})

{
  \partial 2
  a'4^"Unprefixed" a'\pushRight 7
  |
  a' a'^"Prefixed" a' a'
}

Cheers,
  Harm

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


Re: Hairpins, brackets and dynamics

2018-04-24 Thread Thomas Morley
2018-04-24 9:51 GMT+02:00 Davide Liessi :
> Dear all,
> I need to engrave a hairpin in brackets after a \fz.
> I tried LSR 771 (http://lsr.di.unimi.it/LSR/Item?id=771) with the
> following results:
>
> \version "2.19.65"
>
> %http://lsr.di.unimi.it/LSR/Item?id=771
> hairpinBetweenText =
> #(define-music-function (leftText rightText) (markup? markup?)
>#{
>  \once \override Hairpin.stencil =
>  #(lambda (grob)
> (ly:stencil-combine-at-edge
>  (ly:stencil-combine-at-edge
>   (ly:stencil-aligned-to (grob-interpret-markup grob leftText) Y 
> CENTER)
>   X RIGHT
>   (ly:stencil-aligned-to (ly:hairpin::print grob) Y CENTER)
>   0.6)
>  X RIGHT
>  (ly:stencil-aligned-to (grob-interpret-markup grob rightText) Y 
> CENTER)
>  0.6))
>#})
>
> music = { c'1\fz\> c' c' c' d'1\! }
>
> \score {
>   <<
> \new Staff {
>   \music
> }
> \new Staff {
>   \hairpinBetweenText "[" "]"
>   \music
> }
> \new Staff {
>   \once \hide DynamicText
>   \hairpinBetweenText \markup { \dynamic { fz } "[" } "]"
>   \music
> }
> \new Staff {
>   \once \override Hairpin.shorten-pair = #'(0 . 2)
>   \once \hide DynamicText
>   \hairpinBetweenText \markup { \dynamic { fz } "[" } "]"
>   \music
> }
>   >>
> }
>
> Is there a way to make the second Staff look like the last one?
> I.e., is it possible to avoid the clash between the dynamic mark and
> the hairpin and to automatically shorten the hairpin?
>
> (By the way, in the third and fourth Staff hiding the DynamicText is
> not necessary, since the normal \fz and the one in \hairpinBetweenText
> are perfectly aligned; however if the DynamicText is omitted instead
> of hidden the hairpin is shifted to the right, which I didn't expect.)
>
> Best wishes.
> Davide



How about below?
It is ensured the bracketed hairpin is always of equal length as the
original. Ofcourse this means the visible hairpin is shortened a
little.
Applying 'shorten-pair is still possible, though. The "kerning" is adjustable.

\version "2.19.81"

#(define (hairpin-between-text kern left-text right-text)
  (lambda (grob)
(let* ((v-centered-left-text
 (ly:stencil-aligned-to
   (grob-interpret-markup grob left-text) Y CENTER))
   (left-text-x-ext (ly:stencil-extent v-centered-left-text X))
   (v-centered-right-text
 (ly:stencil-aligned-to
   (grob-interpret-markup grob right-text) Y CENTER))
   (right-text-x-ext (ly:stencil-extent v-centered-right-text X))
   (prev-shorten-pair
 (ly:grob-property grob 'shorten-pair '(0 . 0)))
   (thick
 (ly:grob-property grob 'thickness 1))
   (line-thick (ly:staff-symbol-line-thickness grob))
   (actual-thick (* thick line-thick))
   (shorten
 (+ (* 2 kern)
(cdr right-text-x-ext)
(cdr left-text-x-ext)
(- (* 2 actual-thick)

  (ly:grob-set-property! grob 'shorten-pair
(coord-translate
  prev-shorten-pair
  (cons 0 shorten)))

  (let* ((v-centered-hairpin
   (ly:stencil-aligned-to
 (ly:hairpin::print grob) Y CENTER))
 (hairpin-x-ext (ly:stencil-extent v-centered-hairpin X)))

(ly:stencil-translate-axis
  (ly:stencil-add
(ly:stencil-translate-axis
  v-centered-left-text
  (-
(car hairpin-x-ext)
(cdr left-text-x-ext)
actual-thick)
  X)
(ly:stencil-translate-axis
  v-centered-hairpin
  (- kern actual-thick)
  X)
(ly:stencil-translate-axis
  v-centered-right-text
  (+
(cdr hairpin-x-ext)
(* 2 kern))
  X))
  (cdr left-text-x-ext)
  X)

hairpinBetweenText =
#(define-music-function (space text-left text-right)
  ((number? 0.6) markup? markup?)
  #{
 \once \override Hairpin.stencil =
   #(hairpin-between-text space text-left text-right)
  #})

music = { c'1\fff\> c' c' c' d'1\! }

\score {
  <<
\new Staff {
  \music
}
\new Staff {
  \hairpinBetweenText "[" "]"
  \music
}
\new Staff {
  \hairpinBetweenText 0.2 "[" "]"
  \music
}
\new Staff {
  \override Hairpin.shorten-pair = #'(1 . 2)
  \hairpinBetweenText "[" "]"
  \music
}
  >>
}

HTH,
  Harm

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


Re: Lilypond <-> Sibelius

2018-04-23 Thread Thomas Morley
2018-04-23 20:04 GMT+02:00 Karlin High <karlinh...@gmail.com>:
> Thomas Morley posted code once for
> auto-generating a sight-reading worksheet.

I did?
Can't remember. Do you have a link?

Cheers,
  Harm

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


Re: repeatTie length

2018-04-22 Thread Thomas Morley
2018-04-22 5:24 GMT+02:00 Andrew Bernard :
> How can you make a repeatTie longer? The default is a little too crimped for
> my style.
>
> Andrew



Hi Andrew,

Malte already pointed to the LSR-snippet and Auke posted some
functions which adapted the LSR-snippet.
Though, for me this snippet always had some disadvantages. Using
X-extent '(0 . 0) and applying some extra-offset results in
Repeat/LaissezVibrerTies which may collide/overlap other things. Ok,
this is mostly on pupose, but there's no method to get reasonable
results, if overlapping is undesired.

So I tried to do it different, using make-tie-stencil and create a new stencil.
This stencil will not overlap other stuff. Though, it could be reached
by applying an appropriate X-extent-override.

Advantages:
- only one definition for LaissezVibrerTie and RepeatTie
- reacts on minimum-length

Disadvantages:
- height-limit, ratio and angularity are hard-coded in
make-tie-stencil, so it behaves a little different than the default.
- there's is a flaw in make-tie-stencil: even if I made height-limit
settable it had no impact. I think there's a bug in it (will report
soon).
- even correcting the bug will not make the behaviour of those ties
equal to there defaults. I'm currently not able to find the reason.
I'll continue research later.


Anyway here the code so far:

\version "2.19.81"

#(define semi-tie-stencil
  (lambda (grob)
(let* ((cps (ly:grob-property grob 'control-points))
   (first-cp (car cps))
   (last-cp (last cps))
   (actual-length
 (- (car last-cp) (car first-cp)))
   (thickness (ly:grob-property grob 'thickness 1))
   (orientation (ly:grob-property grob 'direction -1))
   (minimum-length
 (ly:grob-property grob 'minimum-length
   (+ (car first-cp) actual-length)))
   (head-dir (ly:grob-property grob 'head-direction))
   (used-length (max actual-length minimum-length))
   (line-thick (ly:staff-symbol-line-thickness grob)))
  (make-tie-stencil
(if (positive? head-dir)
(cons (- used-length) (cdr first-cp))
first-cp)
(if (positive? head-dir)
last-cp
(cons used-length (cdr first-cp)))
(* thickness line-thick)
orientation

\layout {
  \override LaissezVibrerTie.stencil = #semi-tie-stencil
  \override RepeatTie.stencil = #semi-tie-stencil

  %\override LaissezVibrerTie.X-extent = #'(0 . 0)
  %\override RepeatTie.X-extent = #'(0 . 0)
}

{
  %% default
  1\laissezVibrer

  \once \override LaissezVibrerTie.minimum-length = 10
  1\laissezVibrer
  1
  1
  1
  1
}

{
  %% default
  1\repeatTie

  \once \override RepeatTie.minimum-length = 10
  1\repeatTie
%% the following works only for 2.21.0
%% 2.19.81 will not print any RepeatTie
  1
  1
  1
  1
}

Cheers,
  Harm

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


Re: Replacing a certain character sequence in lyrics

2018-04-20 Thread Thomas Morley
2018-04-20 17:53 GMT+02:00 Simon Albrecht :
> Hello everybody,
>
> I have a favour to ask from any LilyPond-Guile crack on the list, because I
> couldn’t quite figure it out myself: (technical requirement here, rationale
> in PS.)
>
> For a scholarly edition project, I’d like to have a global boolean variable
> and a toplevel music function that goes through all lyric syllables and
> replaces (for example) two apostrophes "’’" with either a single apostrophe
> "’" or nothing, depending on the value of that global switch variable. How
> could such a music function be done?
>
> Best, Simon
>
> PS. The reason behind this is: Haydn’s „Jahreszeiten“ use a lot of
> apostrophes in the original German text; some of them seem weird to the
> modern eye and don’t help understanding, while others are perfectly normal.
> I would like to be able to easily switch between modernising spelling in
> that regard or just leaving it as is, and I figured the way to go would be
> coding the ‘weird’ ones as double apostrophes and having a
> toplevel-music-function deal with them.

Probably:

\version "2.19.81"

#(define my-replacement-alist
  '(
("foo" . "Is")
("bar" . "this")
("buzz" . "what")
("ding" . "you")
("dong" . "want?")
("’’" . "’")
   ))

tst =
#(define-music-function (mus)(ly:music?)
  (music-map
(lambda (m)
  (if (music-is-of-type? m 'lyric-event)
  (let ((txt (ly:music-property m 'text)))
(if (string? txt)
(begin
  (ly:music-set-property! m 'text
(make-replace-markup my-replacement-alist txt))
  m)
m))
  m))
mus))

\tst
<<
  \new Voice = "v" { c'4 d' e' f' g'1 }
  \new Lyrics \lyricsto "v" { ’’foo bar buzz ding dong’’ }
>>

Cheers,
  Harm

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


Re: Make TOC entries available to LaTeX

2018-04-19 Thread Thomas Morley
2018-04-19 16:19 GMT+02:00 Urs Liska :
> Hi all,
>
> I'm preparing an automated edition process using LuaLaTeX, Pandoc and
> LilyPond.
>
> After some experimentation I have come to the conclusion that I'll have to
> insert the multi-movement score as a single PDF created by LilyPond (but
> through lyluatex to make use of caching and the layout mechanics).
>
> I first had used lyluatex's facility to include the score's system by system
> and print all the titles with LaTeX, but this didn't work out - for the
> first time I realized that lilypond-book-preamble.ly makes the vertical
> staff-staff spacing as tight as possible, which often makes the page layout
> pretty bad. Creating the movements separately is not an option either
> because not all movements will start on a new page.
>
> So now I have included a multi-movement score in the LaTeX document and
> don't know how to add TOC entries (in LaTeX) for the movements. I can see
> two possible ways, but don't know if they are really possible and if so how
> to approach them:
>
> Is it possible to insert something in the PDF output that LaTeX can pick up
> as TOC entries?
> (actually I doubt this is possible, but since it would be the easiest way I
> thought I'd ask anyway)
> Can I reliably retrieve the current page number of a given score's title
> block?
> With that information I could write them to a log file and read that later
> in LaTeX.
>
> TIA
> Urs
>
> PS: I don't know if it matters but the file is produced using
> ly:book-process etc.



Doesn't
http://lilypond.org/doc/v2.19/Documentation/usage-big-page#sharing-the-table-of-contents
do what you want?

Cheers,
  Harm

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


Re: Dotted notes

2018-04-19 Thread Thomas Morley
Hi,

today I'm too tired to work on anything complicated ...
Though, some remarks:

2018-04-19 17:23 GMT+02:00 foxfanfare :
> foxfanfare wrote
> Anyway, I tried your code this morning, but I wasn't able to get the desired
> result. Maybe because I use the 2.19.80 version. I will try again later this
> afternoon.
>
> Okay I tested with the 2.19.81 version but the DotColumn.padding and
> details.dots-padding-factor doesn't seem to work.

Please post some code. so that we can debug what's wrong and why.
The code was developed with 2.19.81 so at least the example works for me.

> On the contrary, the dots
> doesn't collide with the stems anymore!

Really?
I still see a collision with

\paper {
  #(define fonts
(set-global-fonts
  #:music "beethoven"
  #:brace "beethoven"
  #:factor (/ staff-height pt 20)))
}

{ d'16.. }

> But don't worry Harm, since the
> solution seems to be very difficult to implement and as you said "fragile",

"Difficult" doesn't scare me, Au contraire. Anything else is boring :)

> I will probably let the default output for the dots-dots placement. Too bad,
> this was an option in Sibelius! I guess I'll wait for a next LilyPond
> version which may (or not!) implement this!

This code (\dotsAndDotColumnPadding) will most likely never been
implemented in the source.

Postprocessing a delivered stencil is a _method_ I sometimes use, when
no other method sounds doable.

What should be documented?
- get the stencil-expression
- do the wished modifications with appropriate procedures
- set 'stencil to a new stencil with this new stencil-expression and
appropriate extents
That's all :)

As said, it's a method. Of sort 'last resort' :)

Though, it would be nice to have some user-settable grob-properties :
Probably a padding-property to adjust the space between NoteColumn and
DotColumn and a dot-padding-property to adjust the space between the
dots themselves.


Cheers,
  Harm

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


Re: Stanzas over staves

2018-04-19 Thread Thomas Morley
2018-04-19 21:09 GMT+02:00 Partitura Organum :
>
>
> On 19-4-2018 00:30, Simon Albrecht wrote:
>>
>> You have to quote line-width because it’s a symbol, not a variable. That
>> can also be done in a verbose or in a practical way:
>> \override #(cons 'line-width dim)
>> or
>> \override #(cons (quote line-width) dim).
>> The two are exactly equivalent.
>
>
> The second is new for me, nice to learn. The first form I did try (after
> having found out about cons). It does compile, but it does not work.
> Somehow, inside a scheme function the 'line-width argument does not point to
> the actual line-width property of the markup being constructed.
>
> I.e. this does work as intended:
>
> scoreAUpperHarpI = \relative c'' {
> \once\override TextScript.extra-spacing-width = #'(0 . 0)
> s1^\markup
>  \with-dimensions #'(0 . 22) #'(0 . 0)
>  \whiteout \override #'(line-width . 20)
>  \translate #'(0 . 0)
>  \wordwrap   { Ah, how oft we read or hear of  Boys we almost stand in
> fear of!  For example, take these stories
>}
> }
>
> scoreALowerHarpI = \relative c' { s1  }
>
> scoreAHarpIPart = \new PianoStaff \with {
>   instrumentName = "Harfe I"
> } <<
>   \new Staff = "upper" \scoreAUpperHarpI
>   \new Staff = "lower" { \clef bass \scoreALowerHarpI }
>>>
>
> \score {
>   <<
> \scoreAHarpIPart
>   >>
>   \layout { }
> }
>
>
> However, when transforming this into a scheme function the line-width and
> wordwrap do not work as intended:
>
> narrator=#(define-music-function
>   (parser location dim text) (number? string?)
>
>#{
>   \override TextScript.extra-spacing-width = #'(0 . -0.50)
>  s1^\markup
>   \with-dimensions #(cons 0 dim) #'(0 . 0)
>   \whiteout
>   \override #(cons (quote line-width) dim)
>   \translate #'(0 . -1.5)
>   \wordwrap {  #text }

The function expects `text' to be a string. So
(1) use wordwrap-string
(2) without {}

>#})
>
> scoreAUpperHarpII = \relative c'' {
>   \narrator#30 "Of named Max and Moritz, Who, instead of early turning
> etcetc"
>  }
>
> scoreALowerHarpII= \relative c' { s1  }
>
> scoreAHarpIIPart = \new PianoStaff \with {
>   instrumentName = "Harfe II"
> } <<
>   \new Staff = "upper" \scoreAUpperHarpII
>   \new Staff = "lower" { \clef bass \scoreALowerHarpII }
>>>
>
> \score {
>   <<
> \scoreAHarpIIPart
>   >>
>   \layout { }
> }
>
> How should the function be constructued toi make this work an intended?
>
> Regards,
> Auke
>



Cheers,
  Harm

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


Re: temporarily disable Dot_column_engraver?

2018-04-18 Thread Thomas Morley
2018-04-18 13:22 GMT+02:00 foxfanfare :
> This post is old, but I can't find the solution for this specific problem.
> In a general way, I wonder how it is possible to remove an engraver
> temporarily?
>
> For this dot_column case, here's the exemple wrote in Elaine Gould's book:
>
> \version "2.19.80"
>
> \score {
>   \relative c' {
> \cadenzaOn
> \omit Staff.TimeSignature
><< { c'2.^"OK" b \bar "|" b4. a } \\
>{ b2. a c4. b } >> \bar "|"
> << { c2. \bar "|" b } \\
>{ b2 a4 a2 g4 } >> \bar "|"
>
> << { *2.^"Not OK" 1. } \\
>{ 2. 4. r 2. } >> \bar "|"
>   }
> }
>
> \score {
>   \relative c' {
> \cadenzaOn
> \omit Staff.TimeSignature
><< { c'2. b^"Not OK" \bar "|" b4. a } \\
>{ b2. a c4. b } >> \bar "|"
> << { c2. \bar "|" b } \\
>{ b2 a4 a2 g4 } >> \bar "|"
>
> << { *2.^"OK" 1. } \\
>{ 2. 4. r 2. } >> \bar "|"
>   }
>   \layout {
> \context {
>   \Staff
>   \remove Dot_column_engraver
> }
> \context {
>   \Voice
>   \consists Dot_column_engraver
> }
>   }
> }
>
> How is it possible to combine those two solutions in a same staff?
> Dot_column.PNG
> 



It's not possible to consist/remove engraver temporarily, but you can
have several named Voices (keep them alive) with and without the
engraver:


\score {
\new Staff \with { \omit TimeSignature }
<<
  \new Voice = "x" \with { \consists Dot_column_engraver } s4*24
  \new Voice = "y" \with { \consists Dot_column_engraver } s4*24
  \new Voice ="z"
\relative c' {
\cadenzaOn
\voiceOne
c'2. b
\bar "|"
b4. a c2.
\bar "|"
b
\bar "|"
\context Voice = "x" {
  \voiceOne
  < b c d >2. 1.
}
c2. b
\bar "|."
}
  \new Voice = "xy"
\relative c' {
\voiceTwo
b'2. a
c4. b b2
\context Voice = "y" {
  \voiceTwo
  a4 a2 g4 < c, d f >2. 4. r 2.
}
b'2. a
}
>>
}


Cheers,
  Harm

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


Re: Dotted notes

2018-04-18 Thread Thomas Morley
2018-04-19 1:56 GMT+02:00 Thomas Morley <thomasmorle...@gmail.com>:

> obviously the flags from the beethoven-font have less y-extent.
> Sometimes too less, so DotColumn doesn't notice there's flag which
> should be avoided.
> (I've cc-ed the original author of the font. Maybe he joins the discussion.)

Actually I forgot to cc :(

Instead of resending the whole mail, a link to  the archives:
https://lists.gnu.org/archive/html/lilypond-user/2018-04/msg00580.html

Cheers,
  Harm

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


Re: Dotted notes

2018-04-18 Thread Thomas Morley
2018-04-17 23:34 GMT+02:00 foxfanfare :
> I struggle on this:
>
> \version "2.19.80"
>
> \paper {
>   #(set-paper-size "a7")
> }
> \bookpart {
>
>   \score {
> \relative c' {
>   \cadenzaOn
>   \omit Staff.TimeSignature
>   c1.^"Default" d4.. e8... f16
> }
>   }
> }
>
> \bookpart {
>
>   \paper {
> #(define fonts
> (set-global-fonts
>   #:music "beethoven"
>   #:brace "beethoven"
>   #:factor (/ staff-height pt 20)
>   ))
>   }
>   \score {
>
>\relative c' {
>  \cadenzaOn
>  \omit Staff.TimeSignature
>
>  c1.^"New Font" d4.. e8... f16 \bar "" \break
>
>  \override Staff.Dots.font-size = #-1.5
>  %closer to note head:
>  \override Staff.Dots.extra-offset = #'(-0.1 . 0)
>
>  c1.^"Some Changes ?" d4.. e8... f16
>
>}
>   }
> }
>
> \layout {
>   ragged-right = ##t
> }
>
> When the font is changed, the dotted notes doesn't avoid the flags as it did
> with default emmentaler!
> I think it could be solved by settting some "padding" for the flags, but I
> wasn't able to find this command! (?)
>
> Also, when playing with their options, I was able to find a way to make them
> smaller and closer to the notehead (extra-offset) but I am unable to find
> the solution get the following dots closer to each other!
>
> Any suggestions?



Hi,

obviously the flags from the beethoven-font have less y-extent.
Sometimes too less, so DotColumn doesn't notice there's flag which
should be avoided.
(I've cc-ed the original author of the font. Maybe he joins the discussion.)

To watch the values uncomment
\printFontFlagYExtent
in the test-code below.

Additionally I wrote some procedures to deal with this problem as well
as to get access and manipulate the dots of a DotColumn.
Per default most work is done in C++ and locked from the user, though
with a little trickery there's a way.

(1) The too short flags form beethoven-font may be corrected with
\tallerBeethovenFlags
(2) Alternatively you can move the DotColumn with \moveBeethovenDotColumn

Both functions are limited to beethoven-font, they will have no impact
on other fonts

(3) \dotsAndDotColumnPadding is the most generic one.
Put it in layout and add
\override Staff.DotColumn.padding = 
and/or
\override Staff.DotColumn.details.dots-padding-factor = 
where you want.
Both properties will influence each other.

Be aware, although it's the most generic one, it is also the most fragile one:
Because Dots in DotColumn are processed in C++ and only very few
grob-properties are accessible we have little chance to customize it,
apart from post-processing the ready stencil. A tedious and involved
work. This also means: if LilyPond internals change,
\dotsAndDotColumnPadding may break.

But here the code.

\version "2.19.81"

printFontFlagYExtent =
  \override Flag.after-line-breaking =
#(lambda (grob)
   (let* ((stil (ly:flag::print grob))
  (stil-y-ext (ly:stencil-extent stil Y))
  (grob-default-font (ly:grob-default-font grob))
  (font (ly:font-name grob-default-font))
  (font-name (car (string-split font #\-
 (newline)
 (format #t "\nfont: ~a" font-name)
 (format #t "\nstil-y-ext:~a" stil-y-ext)))

tallerBeethovenFlags =
  \override Flag.before-line-breaking =
#(lambda (grob)
   (let* ((stil (ly:flag::print grob))
  (stil-y-ext (ly:stencil-extent stil Y))
  (grob-default-font (ly:grob-default-font grob))
  (font (ly:font-name grob-default-font))
  (font-name (car (string-split font #\-
 (if (string=? font-name "beethoven")
 (ly:grob-set-property! grob 'stencil
   (ly:make-stencil
 (ly:stencil-expr stil)
 (ly:stencil-extent stil X)
 (coord-translate
   stil-y-ext
   '(-0.054 . 0)))

moveBeethovenDotColumn =
\override Staff.DotColumn.before-line-breaking =
  #(lambda (grob)
(let* ((grob-default-font (ly:grob-default-font grob))
   (font (ly:font-name grob-default-font))
   (font-name (car (string-split font #\-
  (if (string=? font-name "beethoven")
  (ly:grob-set-property! grob 'positioning-done
(lambda (grob)
  (ly:dot-column::calc-positioning-done grob)
  (ly:grob-translate-axis! grob 1 X)
  #t)

#(define (lists-map function ls)
   "Apply @var{function} to @var{ls} and all of it sublists.
First it recurses over the children, then the function is applied to
@var{ls}."
   (if (list? ls)
   (set! ls (map (lambda (y) (lists-map function y)) ls))
   ls)
   (function ls))

#(define (delete-adjacent-duplicates lst)
  (if (pair? lst)
  (fold-right
(lambda (elem ret)
  (if (equal? elem (first ret))
  ret
  (cons elem ret)))
(list (last lst))
lst)
  lst))

#(define 

Re: Ottava mark: edge dashed line

2018-04-18 Thread Thomas Morley
2018-04-17 22:50 GMT+02:00 foxfanfare :

> Btw, is there any interest to put "(text . #f)" for the right-broken? Or was
> this just for me to understand how the code should be written?

If you set left.text to some value, then every part of a possibly
broken spanner wil start with it.
Technical speaking, if left-broken.text is unset it will inherit the
value of left.text. Some holds for right.text and right-broken.text.

In the end it depends on your needs what you should do. I wouldn't
want the text at the end of every broken spanner, only at the very
end.
Thus I've set right-broken #f.

Below a demonstration using the more simple TextSpanner.

\paper {
  line-width = 80
}

mus = {
  c'1 c'\startTextSpan
  \break
  d' d'
  \break
  e' e'
  \break
  f' f'\stopTextSpan
}

{
  \override TextSpanner.bound-details.left.text = "left"
  \override TextSpanner.bound-details.right.text = "right"
  \mus
}

{
  \override TextSpanner.bound-details.left.text = "left"
  \override TextSpanner.bound-details.right.text = "right"
  \override TextSpanner.bound-details.left-broken.text = "left-broken"
  \override TextSpanner.bound-details.right-broken.text = "right-broken"
  \mus
}

{
  \override TextSpanner.bound-details.left.text = "left"
  \override TextSpanner.bound-details.right.text = "right"
  \override TextSpanner.bound-details.left-broken.text = ##f
  \override TextSpanner.bound-details.right-broken.text = ##f
  \mus
}

> I also discovered that I can then alterate some individual values directly
> in the score block:
> \once \override Staff.OttavaBracket.bound-details.right-broken.padding = #4

Indeed. This updates only a certain subsubproperty leaving others unchanged.

> Gosh, I'm starting to fall in love for this software! So many capabilites,
> it's amazing!

:)

Best,
  Harm

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


Re: Ottava mark: edge dashed line

2018-04-17 Thread Thomas Morley
2018-04-17 13:03 GMT+02:00 foxfanfare :
> One more thing: I have this problem when the modified 8va breaks lines:
[skipping example-code]
> How is it possible to modify the "ottavaUp" shortcut to personalize this?

'bound-details allows for left/right/left-broken/right-broken subproperties.
Possible subsubproperties (read by ly:line-spanner::print) are documented here:
http://lilypond.org/doc/v2.19/Documentation/notation/spanners#using-the-line_002dspanner_002dinterface

Please specify which problem(s) you see with you're example-code in
the future. ;)

My guessing below:

\version "2.19.81"

ottavaUp = {

  \once \override Staff.OttavaBracket.stencil = #ly:line-spanner::print
  \once \override Staff.OttavaBracket.bound-details =
#`((left . ((Y . -0.2)
(attach-dir . ,LEFT)
(padding . 0)
(stencil-align-dir-y . ,UP)))
   (left-broken . ((Y . -0.2)
   (text
 .
 ,#{ \markup \bold \concat { "8" \hspace #0.25 } #})
   (padding . 2.5)
   (attach-dir . ,RIGHT)))
   (right-broken . ((text . #f)
(padding . 0)))
   (right . ((Y . -0.2)
 (padding . -0.75)
 (attach-dir . ,RIGHT)
 (text . ,#{
\markup
\override #'(full-length . #f)
\override #'(on . 0.15)
\override #'(off . 0.5)
\override #'(thickness . 1.8)
\draw-dashed-line #'(0 . -1.5)
  #}

  \once \override Staff.OttavaBracket.left-bound-info =
 #ly:line-spanner::calc-left-bound-info-and-text
  \once \override Staff.OttavaBracket.right-bound-info =
 #ly:line-spanner::calc-right-bound-info
  \override Staff.OttavaBracket.style = #'dashed-line
  \override Staff.OttavaBracket.dash-fraction = #0.2
  \override Staff.OttavaBracket.dash-period = #0.7
  \override Staff.OttavaBracket.thickness = #1.5

  \ottava #1
  \set Staff.ottavation = \markup \bold \concat { "8" \hspace #0.25 }
}

\relative c' {

  \ottava #1
  a'''1^"Default" a a a \break
  a a a a4 \ottava #0 r2. \break

  \ottavaUp a^"Modified" a a a \break
  a a a a4 \ottava #0 r2.
}

\layout {
 ragged-right = ##t
}


HTH,
  Harm

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


Re: Ottava mark: edge dashed line

2018-04-17 Thread Thomas Morley
2018-04-17 9:16 GMT+02:00 foxfanfare <foxfanf...@gmx.com>:
> Thomas Morley-2 wrote
>> Would be nice the default would offer more tweaking-possibilities to
>> avoid such messing around.
>> Also, ly:line-spanner::print should have at least the option to cover
>> the whole specified length, _avoiding_ space at start/end.
>>
>>
>> Best,
>>   Harm
>
> Isn't this working? :
>
> with-ottava-line-spanner =
> \with {
> \override OttavaBracket.stencil =
>   #(lambda (grob) (box-stencil (ly:line-spanner::print grob) 0 0))
> \override OttavaBracket.bound-details =
>   #`((left . ((Y . 0)
>   (attach-dir . ,LEFT)
>   (padding . 0)
>   (stencil-align-dir-y . ,UP)))
>  (right . ((Y . 0)
>(padding . 0)
>(attach-dir . ,RIGHT
>
> \override OttavaBracket.style = #'dashed-line
> \override OttavaBracket.dash-period = #4
> \override OttavaBracket.dash-fraction = #0.001
> \override OttavaBracket.thickness = #4
> \override OttavaBracket.left-bound-info =
>#ly:line-spanner::calc-left-bound-info-and-text
> \override OttavaBracket.right-bound-info =
>#ly:line-spanner::calc-right-bound-info
> }
>
> $@(map
> (lambda (val)
>   #{
> \new Staff \with \with-ottava-line-spanner
>   {
> \ottava #1
> c''4
> \override NoteColumn.X-offset = $val
> d''
>   }
>   #})
> (iota 10 0 2))

Sure.

Though, I think every dashed/dotted line should start/end without
space out of the box. Or at least with an option to ensure this. And
without the need for manual adjustments.

Cheers,
  Harm

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


Re: Consistent vertical alignment of annotations, disable time signiture

2018-04-16 Thread Thomas Morley
2018-04-17 0:24 GMT+02:00 Thomas Morley <thomasmorle...@gmail.com>:
> 2018-04-16 23:23 GMT+02:00 foxfanfare <foxfanf...@gmx.com>:
>
>> *OMG, my first comment which isn't aimed to ask for help but "try" to help
>> someone else :-)
>
> lol
>
> More seriously, your help is very appropriated!

Forgive me, this should read "very appreciated"
Non-native-speaker here...

>
> Best,
>   Harm

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


Re: Consistent vertical alignment of annotations, disable time signiture

2018-04-16 Thread Thomas Morley
2018-04-16 23:23 GMT+02:00 foxfanfare :

> *OMG, my first comment which isn't aimed to ask for help but "try" to help
> someone else :-)

lol

More seriously, your help is very appropriated!

Best,
  Harm

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


Re: Ottava mark: edge dashed line

2018-04-16 Thread Thomas Morley
2018-04-16 23:45 GMT+02:00 Carl Sorensen :
> On 4/16/18, 3:31 PM, "foxfanfare"  wrote:
>
> Noeck wrote
> > As I said, I think it’s a question where the line starts: on the left or
> > on the right and then it’s kind of luck how they meet in the corner.
>
> I see what your means. But even if the line started on right, you'll get 
> the
> same problem at the left then no? The distance from the "8" text will 
> vary.
> But maybe it is something you accomodate better.
>
> Could not it be more easy to just change the dash period a bit in order to
> get it done?
>
> The slur dash code does just that, IIRC.  It goes from 0 to 1 on the t-value 
> of the Bezier, and makes sure that the end of the slur is always a full solid 
> part.
>
> I haven't looked at the ottava bracket code, but it seems like it ought to be 
> able to do the same, since it's a spanner like the slur is.
>
> Carl



Hi Carl,

you are right with the default-stencil for OttavaBracket.

But in this thread ly:line-spanner::print was used to get more
tweaking-possibilities. For this stencil I could verify the issue.

Below some test-code using box-stencil to make dimensions visible.
All for 2.19.81

(1) All fine for the default, i.e. ly:ottava-bracket::print

$@(map
(lambda (val)
  #{
\new Staff
  \with {
\override OttavaBracket.stencil =
  #(lambda (grob) (box-stencil (ly:ottava-bracket::print grob) 0 0))
  }
  {
\ottava #1
c''4
\override NoteColumn.X-offset = $val
d''
  }
  #})
(iota 10 0 2))

(2) Using ly:line-spanner::print and dotted-style returns sometimes a
gap at line-end.

with-ottava-line-spanner =
\with {
\override OttavaBracket.stencil =
  #(lambda (grob) (box-stencil (ly:line-spanner::print grob) 0 0))
\override OttavaBracket.bound-details =
  #`((left . ((Y . 0)
  (attach-dir . ,LEFT)
  (padding . 0)
  (stencil-align-dir-y . ,UP)))
 (right . ((Y . 0)
   (padding . 0)
   (attach-dir . ,RIGHT

\override OttavaBracket.style = #'dotted-line
\override OttavaBracket.thickness = #4
\override OttavaBracket.left-bound-info =
   #ly:line-spanner::calc-left-bound-info-and-text
\override OttavaBracket.right-bound-info =
   #ly:line-spanner::calc-right-bound-info
}

$@(map
(lambda (val)
  #{
\new Staff \with \with-ottava-line-spanner
  {
\ottava #1
c''4
\override NoteColumn.X-offset = $val
d''
  }
  #})
(iota 10 0 2))


Would be nice the default would offer more tweaking-possibilities to
avoid such messing around.
Also, ly:line-spanner::print should have at least the option to cover
the whole specified length, _avoiding_ space at start/end.


Best,
  Harm

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


Re: Key signatures in modes other than Ionian & Aeolian

2018-04-16 Thread Thomas Morley
2018-04-16 21:18 GMT+02:00 Peter Crighton :
> Hello all,
>
> my question is not exclusive to LilyPond, but I hope you can enlighten me
> anyway.
>
> I am transcribing a song in D Mixolydian and am wondering which key
> signature to notate it in – d \mixolydian (because that is the mode it is
> in) or d \major (because a D major chord clearly is the tonic of the song).
> I’d rather notate it in d \mixolydian, which seems correct to me, but might
> it be easier to read (especially for non-professional musicians) in d \major
> just with a natural sign before every c?
> What is everyone doing in such a case? Any experiences which is easier to
> read? Also, could the style of music matter? In Early Music I’d be even more
> inclined to notate in d \mixolydian, but in this case it is a pop song where
> people might only expect to see major or minor keys.
>
> Curious to hear what you all think.
>
> Thanks,
> Peter


If it's really D Mixolydian, go for `d \mixolydian'. D-major would be
simply wrong and confusing.


My 2cts,
  Harm

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


Re: Ottava mark: edge dashed line

2018-04-16 Thread Thomas Morley
2018-04-16 23:31 GMT+02:00 foxfanfare :
> Noeck wrote
>> As I said, I think it’s a question where the line starts: on the left or
>> on the right and then it’s kind of luck how they meet in the corner.
>
> I see what your means.

I don't. Though, there were other cases where I noticed similar.
Thus, while coding draw-dashed/dotted-line-markup-commands I
implemented the 'full-length-property (#t per default) to ensure the
line never ends with space.
You can ofcourse set it #f to gain space, if desired.
The line-styles defined in C++ , which are used in
OttavaBracket.stencil lack this feature.

> But even if the line started on right, you'll get the
> same problem at the left then no? The distance from the "8" text will vary.
> But maybe it is something you accomodate better.
>
> Could not it be more easy to just change the dash period a bit in order to
> get it done?

All you can do. But tedious and needs readjusting every time layout changes.


Cheers,
  Harm

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


Re: Ottava mark: edge dashed line

2018-04-16 Thread Thomas Morley
2018-04-16 22:42 GMT+02:00 Noeck <noeck.marb...@gmx.de>:
>
>
> Am 16.04.2018 um 22:32 schrieb Thomas Morley:
>> If you use dotted-lines the result could be:
>
> Thanks. The dotted-line sounds better than a dashed-line with
> dash-fraction zero. But the output seems to be the same and the issue in
> the top-right corner, too. The dots are not aligned. It just depends on
> how long the line is.
>
> Best,
> Joram

Again, I can see misaligned dots with evince but _not_ with Foxit Reader.
A pdf-viewer artefact?
Not sure how to verify...

Cheers,
  Harm

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


Re: Ottava mark: edge dashed line

2018-04-16 Thread Thomas Morley
2018-04-16 22:07 GMT+02:00 Noeck :
> Nice. I still thought that this is impossible as it was some time ago (3
> years?).
>
> Is it feasible to align the dots (if I set the dash length to 0) such
> that there is exactly one dot in the top right corner? I.e. start the
> horizontal dotted line from the right end? Then it would be perfect.

If you use dotted-lines the result could be:

\relative c' {
  \override Staff.OttavaBracket.stencil = #ly:line-spanner::print
  \override Staff.OttavaBracket.bound-details =
#`((left . ((Y . 0) ; Change the integer here
(attach-dir . ,LEFT)
(padding . 0)
(stencil-align-dir-y . ,UP)))
   (right . ((Y . 0) ; Change the integer here
 (padding . 0)
 (attach-dir . ,RIGHT)
 (text .
   ,#{
  \markup
\override #'(full-length . #f)
\override #'(off . 0.15)
\draw-dotted-line #'(0 . -4)
   #}

  \override Staff.OttavaBracket.style =
#'dotted-line
  \override Staff.OttavaBracket.dash-period = #0.4
  \override Staff.OttavaBracket.thickness = #1.5
  \override Staff.OttavaBracket.left-bound-info =
 #ly:line-spanner::calc-left-bound-info-and-text
  \override Staff.OttavaBracket.right-bound-info =
 #ly:line-spanner::calc-right-bound-info

  \ottava #1
  \set Staff.ottavation = #"8"

  c'''1 a
  f

}


Though, my pdf-viewers present me different results.

With Foxit Reader there's exact one dot at top right.
With evince it looks like the dotted line is half of own thickness
displaced (if other than default-thickness is used).
I'm not really sure with evince, though. Evince can't do more than
400% resolution.

Cheers,
  Harm

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


Re: Ottava mark: edge dashed line

2018-04-16 Thread Thomas Morley
2018-04-16 13:17 GMT+02:00 foxfanfare :
> Hi everyone,
>
> I cannot figure why I cannot change the ottava mark as I'd like.
>
> I am interested in using a dashed line, but also for the right edge, as
> shown in this exemple:
> http://lilypond.org/doc/v2.18/Documentation/snippets-big-page.html#text-ottava-text
> 
>
> I don't understand why mine always appear filled!?
>
> \version "2.19.80"
[...]

Please always use the docs of your lily-version.
The link points to 2.18, but you're using 2.19.80

It was changed with

commit 0119c1b84108674cf2b1c72bd8c231d831ce1f0f
Author: Keith OHara 
Date:   Sun Aug 24 15:54:45 2014 -0700

Ottava Bracket bounds; issue 3690

Ottava Bracket: do not dash edges; issue 3866

Which is in the source since 2.19.14
See:
https://sourceforge.net/p/testlilyissues/issues/3866/
https://sourceforge.net/p/testlilyissues/issues/3690/


2018-04-16 13:39 GMT+02:00 foxfanfare :
> Oh, I just found a clue to do that:
>
> \version "2.19.80"
>
> \relative c' {
>   \override Staff.OttavaBracket.stencil = #ly:line-spanner::print
>   \override Staff.OttavaBracket.bound-details =
> #`((left . ((Y . 0) ; Change the integer here
> (attach-dir . ,LEFT)
> (padding . 0)
> (stencil-align-dir-y . ,UP)))
>(right . ((Y . 0) ; Change the integer here
>  (padding . 0)
>  (attach-dir . ,RIGHT)
>  (text . ,(make-draw-dashed-line-markup (cons 0 -2.5))
>
>   \override Staff.OttavaBracket.style = #'dashed-line
>   \override Staff.OttavaBracket.dash-fraction = #0.2
>   \override Staff.OttavaBracket.dash-period = #0.65
>   \override Staff.OttavaBracket.thickness = #1.5
>   \override Staff.OttavaBracket.left-bound-info =
>  #ly:line-spanner::calc-left-bound-info-and-text
>   \override Staff.OttavaBracket.right-bound-info =
>  #ly:line-spanner::calc-right-bound-info
>
>   \ottava #1
>   \set Staff.ottavation = #"8"
>   c'''1 a f
>
> }
>
> But now I struggle finding how to change the end corner dashed fraction...

draw-line-markup has some properties you could use: on, off, probably
full-length (it's #t per default, meaning the dashed-line will be
scaled to full-fill the specified length, partly disregarding your
on/off-values) and thickness (thickness will default to 1 or the
grob's thickness)

\relative c' {
  \override Staff.OttavaBracket.stencil = #ly:line-spanner::print
  \override Staff.OttavaBracket.bound-details =
#`((left . ((Y . 0) ; Change the integer here
(attach-dir . ,LEFT)
(padding . 0)
(stencil-align-dir-y . ,UP)))
   (right . ((Y . 0) ; Change the integer here
 (padding . 0)
 (attach-dir . ,RIGHT)
 (text .
   ;,(make-draw-dashed-line-markup (cons 0 -2.5))
   ,#{
  \markup
\override #'(full-length . #f)
\override #'(on . 0.2)
\override #'(off . 0.45)
\draw-dashed-line #'(0 . -4)
   #}


   

  \override Staff.OttavaBracket.style = #'dashed-line
  \override Staff.OttavaBracket.dash-fraction = #0.2
  \override Staff.OttavaBracket.dash-period = #0.65
  \override Staff.OttavaBracket.thickness = #1.5
  \override Staff.OttavaBracket.left-bound-info =
 #ly:line-spanner::calc-left-bound-info-and-text
  \override Staff.OttavaBracket.right-bound-info =
 #ly:line-spanner::calc-right-bound-info

  \ottava #1
  \set Staff.ottavation = #"8"

  c'''1 a
  f
}


HTH,
  Harm

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


Re: Defining custom symbols

2018-04-15 Thread Thomas Morley
2018-04-15 18:22 GMT+02:00 Robert Hickman :
> ok, the latest compiled version seems to be 2.19.80

2.19.81

http://lilypond.org/downloads/binaries/linux-64/

Cheers,
  Harm

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


Re: Defining custom symbols

2018-04-15 Thread Thomas Morley
2018-04-15 16:56 GMT+02:00 Robert Hickman :
> I'm trying to set the page size so that it automatically
> matches the size of the staff with zero margins. Looking
> at the documentation on this shows the following command,
>
> but I cannot see how to set it to scale 'as big or small
> as needed'. The section on automatic scaling isn't clear
> as this appears to relate to internal operation of the software,
>
> not to automatically scaling the size of the page..
>
>
> #(set-default-paper-size "quarto")
>
> Attached is what I'm currently getting, with a large amount
>
> of empty space.


Hi,

I'm pretty sure the attached pdf isn't "quarto".

Could you share your code?

Cheers,
  Harm

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


Re: Pedal bracket alignment

2018-04-15 Thread Thomas Morley
2018-04-15 5:04 GMT+02:00 Edward Neeman :
> My dream option would be to be able to create a function that would give one
> set of shorten-pair values at the Ped. marking, and another set of values
> for the pedal changes.


How about attached.

It doesn't move the "Ped."-marking, though.
Please read comments and doc-strings.
Not tested beyond the given example!

Cheers,
  Harm
\version "2.18.2" 


#(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)

#(define (adjust-piano-pedal-bracket val)
  (lambda (grob)
;; grob is supposed to be PianoPedalBracket.
;; Returns a number-pair to set shorten-pair.
;; This pair is calculated warranting no gap between consecutive
;; PianoPedalBrackets.
;; If `val' is #f the extent of left and right bounding
;; NoteColumns are calculated. Half of those lengths are taken then.
;; (Only the NoteColumn's main extent is taken, disregarding suspended
;; NoteHeads)
 (let* ((orig (ly:grob-original grob))
(siblings (if (ly:grob? orig)
  (ly:spanner-broken-into orig) '()))
(with-text? (ly:grob? (ly:grob-object grob 'pedal-text)))
(left-val #f)
(right-val #f))

   (if val
   (begin
 (set! left-val val)
 (set! right-val (- val)))
   (let* ((left-bound (ly:spanner-bound grob LEFT))
  (left-bound-elts-array (ly:grob-object left-bound 'elements))
  (left-bound-elts-list 
(if (ly:grob-array? left-bound-elts-array)
(ly:grob-array->list left-bound-elts-array)
'()))
  (left-bound-nc-list
(filter
  (lambda (g)
(grob::has-interface g 'note-column-interface))
  left-bound-elts-list))
  (left-bound-note-column
(if (pair? left-bound-nc-list)
(car left-bound-nc-list)
#f))
  (left-val-default
(if left-bound-note-column
(/
   (interval-length 
 (note-column::main-extent left-bound-note-column))
   2)
0))
  (right-bound (ly:spanner-bound grob RIGHT))
  (right-bound-elts-array 
(ly:grob-object right-bound 'elements))
  (right-bound-elts-list 
(if (ly:grob-array? right-bound-elts-array)
(ly:grob-array->list right-bound-elts-array)
'()))
  (right-bound-nc-list
(filter
  (lambda (g)
(grob::has-interface g 'note-column-interface))
  right-bound-elts-list))
  (right-bound-note-column
(if (pair? right-bound-nc-list)
(car right-bound-nc-list)
#f))
  (right-val-default
(if right-bound-note-column
(/ 
   (interval-length 
 (note-column::main-extent right-bound-note-column))
   -2)
0)))
  (set! left-val left-val-default)
  (set! right-val right-val-default)))

   (if (pair? siblings) 
   (cond
 ((equal? grob (car siblings))
   (if with-text?
   (cons 0 0)
   (cons left-val 0)))
 ((equal? grob (last siblings))
   (cons 0 right-val))
 (else
   (cons 0 0)))
   (if with-text?
   (cons 0 right-val)
   (cons left-val right-val))


Re: Override music fonts for specific glyphs

2018-04-12 Thread Thomas Morley
2018-04-12 21:23 GMT+02:00 Noeck :
> Hi,
>
> I also asked that some time ago. I can’t find the thread (I am
> notoriously bad at finding anything on the list archive).
> I use it for the clef.

Probably:
http://lilypond.1069038.n5.nabble.com/Feedback-Request-for-Music-Fonts-tt167354.html#none

Cheers,
  Harm

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


Re: Is it right how oneVoice reverts direction settings?

2018-04-10 Thread Thomas Morley
2018-04-10 22:45 GMT+02:00 Simon Albrecht :
> Hello everybody,
>
> suppose I want to globally override the direction of slurs, as far as
> neutral voices go. If I do this:
>
> %%% \version "2.19.80" \layout {   \context { \Voice
> \override Slur.direction = #UP   } } music = { c'( d' e' f') } {   \music
> \voiceTwo   \music   \oneVoice   \music } 
>
> then in bar 3 the slur will go below the notes, i.e. \oneVoice reverted the
> direction without knowing that an override was in effect.
>
> I’d love to be able to redefine \voiceTwo & Co. such as to imply \temporary,
> but that’s not currently possible:
>
> warning: Cannot make PropertySet revertible.
>
> Does anybody have an idea for another solution?
>
> Best, Simon


\voiceXxx contain
\set Voice.graceSettings = ...

Setting a context-property revertible is not yet possible. All other
settings are overrides, so probably below may work.
Please be aware it's not tested beyond the given example!

foo =
#(define-music-function (mus)(ly:music?)
 (music-map
   (lambda (m)
 (if (music-is-of-type? m 'override-property-event)
 (begin
   (ly:music-set-property! m 'pop-first '())
   m)
 m))
   mus))

myVoiceOne = \foo \voiceOne
myVoiceTwo = \foo \voiceTwo
myVoiceThree = \foo \voiceThree
myVoiceFour = \foo \voiceFour

music = { c'4(-^ d'-1\startTrillSpan e' f'\stopTrillSpan) }


\markup \box \fill-line { "DEFAULT \\voiceXxx" }
{
  \music
  \voiceTwo
  \music
  \oneVoice
  \music
}

\markup \box \fill-line { "Custom \\voiceXxx" }

{
  \music
  \myVoiceTwo
  \music
  \oneVoice
  \music
}


Cheers,
  Harm

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


Re: First steps in Lilypond

2018-04-09 Thread Thomas Morley
2018-04-10 0:07 GMT+02:00 foxfanfare <foxfanf...@gmx.com>:
> I checked with Gould book and upload an extract.

Thanks.

> gould.jpg <http://lilypond.1069038.n5.nabble.com/file/t5604/gould.jpg>

> Thomas Morley-2 wrote
>> Instead I had a quick look through some editions of major publishers.
>> As a result I wouldn't say the end of the Slur should always "align
>> itself with the top of the last stem!".
>
> Actually you were right! But even if slurs may be prefered to be attached
> closer to note head, it shouldn't go after the notecolumn!

Well, I can't read that explecitely in the Gould extract. Also, I
found some examples for this behaviour, as already said.
Sometimes Slurs are very difficult to set, even manually.
That said, generally I'd agree.

> Thomas Morley-2 wrote
>> Engraving nice looking Slurs is always a challenge and no, LilyPond
>> doesn't end Slurs beyond the last Note.
>> Though, your example triggers some cases where LilyPond does so.
>>
>> Sometimes you could use details.edge-attraction-factor,
>> details.free-head-distance, ratio, height-limit.
>
> Nice to hear that the problem wasn't my beginner code but something else!
> About the 'details' commands like "same-slope-penalty",
> "steeper-slope-factor, "non-horizontal-penalty"... is there any place where
> it is explained or do we have to guess what it affects?

Some concise description:
http://lilypond.org/doc/v2.19/Documentation/internals/slur_002dinterface
Not that helpful ...

> Thomas Morley-2 wrote
>> Ofcourse this also
>> means LilyPond should be improved. Wanna join? :)
>
> Who knows :) Still have to travel a long run first!

:)

> I will try the Openlylib tomorrow, last time I tried, I didn't understand it
> completely...

Well, openlilylib can be run in a git-repository. It's the recommended method.
Though, you can also copy/paste the relevant code, delete certain
openlilylib-commands and can start playing ...
Again, the code in question doesn't work with 2.19.

Cheers,
  Harm

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


Re: First steps in Lilypond

2018-04-09 Thread Thomas Morley
2018-04-09 20:24 GMT+02:00 foxfanfare :

> \version "2.19.80"
>
> \relative c, {
>
>   \voiceOne
>   \clef bass
>   \time 3/8
>   \key c\minor
>   %THIS IS THE PROBLEM
>   \scaleDurations 2/3 { c16( f' aes \clef treble f'[ d f~] }  8)
>   %ANOTHER EXEMPLE
>   c'8( d' e,\noBeam)
>   %NORMAL
>   c8( d e\noBeam) \bar "||"
>
>   
>
>   %THE END OF THE SLUR SHOULD BE ALIGNED WITH THE STEM
>
>   \shape #'((0 . 0) (0 . 0) (0 . 0) (-0.5 . 0)) Slur
>   \clef bass \scaleDurations 2/3 { c,,,16( f' aes \clef treble f'[ d f~] }
> 8)
>   \shape #'((0 . 0) (0 . 0) (0 . 0) (-0.5 . 0)) Slur
>   c8( d' e,\noBeam)
>   c8( d e\noBeam)
> }

> Well, as you see, by default, in the first 2 measures of my exemple,
> lilypond place the end of the slurs very strangely : after the last note!
> And I don't understand why it doesn't align itself with the top of the last
> stem!


I don't have Gould at hand, someone know what she has to say about the topic?

Instead I had a quick look through some editions of major publishers.
As a result I wouldn't say the end of the Slur should always "align
itself with the top of the last stem!".

In many found cases the Slur ends even before the NoteColumn!
Others end at the NoteHead or the Stem, very few behind the NoteColumn.

>
> Sure I could use the \shape control, as shown in the measures 4 & 5
> \shape #'((0 . 0) (0 . 0) (0 . 0) (-0.5 . 0)) Slur
>
> ...and this solve my issue
>
> BUT in my initial question, I was wondering if I missed something, like a
> basic option that would need to be set first and won't need me to adjust
> every slurs which could encounter this issue!
>
> I tried Urs solution, to play with the default shape. So I added to the
> code:
>
>  \override Score.Slur.details = #'(
>   (region-size . 4)
>   (head-encompass-penalty . 1000.0)
>   (stem-encompass-penalty . 30.0)
>   (edge-attraction-factor . 4)
>   (same-slope-penalty . 20)
>   (steeper-slope-factor . 50)
>   (non-horizontal-penalty . 15)
>   (max-slope . 1.1)
>   (max-slope-factor . 10)
>   (free-head-distance . 0.3)
>   (free-slur-distance . 0.8)
>   (gap-to-staffline-inside . 0.2)
>   (gap-to-staffline-outside . 0.1)
>   (extra-object-collision-penalty . 50)
>   (accidental-collision . 3)
>   (extra-encompass-free-distance . 0.3)
>   (extra-encompass-collision-distance . 0.8)
>   (head-slur-distance-max-ratio . 3)
>   (head-slur-distance-factor . 10)
>   (absolute-closeness-measure . 0.3)
>   (edge-slope-exponent . 1.7)
>   (close-to-edge-length . 2.5)
>   (encompass-object-range-overshoot . 0.5)
>   (slur-tie-extrema-min-distance . 0.2)
>   (slur-tie-extrema-min-distance-penalty . 2))
>
> ... and I tried to play with all the values (without understand every
> variables) but without succes.
> So, is it normal Lilypond is drawing slurs beyond the last note and we
> cannot change this default behavior?!

Engraving nice looking Slurs is always a challenge and no, LilyPond
doesn't end Slurs beyond the last Note.
Though, your example triggers some cases where LilyPond does so.

Sometimes you could use details.edge-attraction-factor,
details.free-head-distance, ratio, height-limit.

\paper {
  ragged-right = ##t
  indent = 30
  short-indent = 30
}

\new Staff \with {
  instrumentName = "Untweaked"
  shortInstrumentName = "2 Slurs tweaked"
}
\relative c, {

  \time 3/8
  \key c\minor
  \clef bass

  \voiceOne
  \scaleDurations 2/3 { c16( f' aes \clef treble f'[ d f~] }
  8)
  c'8( d' e,\noBeam)
  c8( d e\noBeam)

  \break

  \clef bass
  \scaleDurations 2/3 {
  \once \override Slur.details.free-head-distance = 1
c,,,16( f' aes \clef treble f'[ d f~]
  }
  8)
  \once \override Slur.ratio = 10
  \once \override Slur.height-limit = 3
  \once \override Slur.details.edge-attraction-factor = 100
  c'8( d' e,\noBeam)
  c8( d e\noBeam) \bar "||"
  \break
}

Tbh, I don't like the result either 
->attachment

You also may try the code by Janek here:
https://github.com/openlilylib/bezier/blob/master/slur-attachments/module.ily
Example:
https://github.com/openlilylib/bezier/blob/master/usage/slur-attachments.ly
Though, it doesn't compile with recent 2.19.-versions, (someone should
upgrade it ...), 2.18.2 works.
Also, there's a mentioned issue in
https://github.com/openlilylib/bezier/blob/master/README.md



To summarize, no, LilyPond does not end Slurs beyond the
Stem/NoteColumn per default.
Also, no, you didn't miss a single command. As said, printing Slurs
(and PhrasingSlurs and Ties) is a challenge for both, the used
type-setting program _and_ the type-setter himself.
Currently LilyPond quite often needs manual help. Ofcourse this also
means LilyPond should be improved. Wanna join? :)
Several tools for manual adjustments are available. (You may also
check for shapeII at openlilylib).

Cheers,
  Harm
___
lilypond-user mailing list

Re: Extraneous TabStaff printing when I don't want tab output

2018-04-06 Thread Thomas Morley
2018-04-06 18:38 GMT+02:00 Larry Morandi :
> I'm trying to print a score that does not include the TabStaff which I
> include on my individual parts. I'm finding that I get extraneous partial
> tab clefs and lines placed in my output whenever a "TabStaff.minimumFret"
> definition is found.
>
> So I'm looking for a way have this fixed, or to do something like the
> equivalent of conditional compilation to remove references to TabStaff in
> the cases where I don't want the tab to be printed. I've tried using tags,
> and they offer no relief. What I really need is something like the old C
> preprocessor where I can just silently remove code so the parser doesn't see
> it. (I'm using Frescobaldi on a Mac as my editor and LilyPond front end.)
>
> Here's an simple example (just modified from the normal new file template):
>
> \version "2.18.0"
>
> \header {
>   title = "Test showing extraneous TabStaff output"
> }
> global = {
>   \time 4/4
>   \key c \major
>   \tempo 4=100
> }
> chordNames = \chordmode {
>   \global
>   c1
> }
> melody = \relative c'' {
>   \global
>   c4 d
>   \set TabStaff.minimumFret = #0

Use
\set Staff.minimumFret = #0
instead.
TabStaff will still hear it.



Cheers,
  Harm

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


Re: Problem with a font

2018-04-06 Thread Thomas Morley
Hi Walter,



2018-04-06 9:49 GMT+02:00 Walter Garcia-Fontes :
> * Torsten Hämmerle, torsten.haemme...@web.de [05/04/18 20:48]:
>> A missing bold font can be emulated by printing the stencil several times
>> (slightly shifted) - like in Don E. Knuth's "poor man's bold" (TeX).
>>
>> If you get stuck, don't hesitate to ask.
>
> OK, here is an ugly solution (font experts please look somewhere
> else):

I'm not a font expert ;)

However, I thought it might be nice to have commands to fake
text-appearance, if the font-to-use doesn't deliver what' needed.
We already have
smallCaps-markup
slanted-markup by Torsten
Below my approach for poor-mans-bold-markup and in combination with \slanted
It uses `stencil-whiteout-outline' which is already in 2.19, here
downgraded to make it work with 2.18.2

\version "2.18.2"

#(define*-public (stencil-whiteout-outline
 stil #:optional (thickness 0.3) (color white)
 (angle-increments 16) (radial-increments 1))
  "This function works by creating a series of white or @var{color}
stencils radially offset from the original stencil with angles from
0 to 2*pi, at an increment of @code{angle-inc}, and with radii
from @code{radial-inc} to @var{thickness}.  @var{thickness} is how big
the white outline is, as a multiple of line-thickness.
@var{radial-increments} is how many copies of the white stencil we make
on our way out to thickness.  @var{angle-increments} is how many copies
of the white stencil we make between 0 and 2*pi."
  (if (or (not (positive? angle-increments))
  (not (positive? radial-increments)))
  (begin
   (ly:warning
"Both angle-increments and radial-increments must be positive numbers.")
   stil)
  (let* ((angle-inc (/ 360 angle-increments))
 (radial-inc (/ thickness radial-increments)))

(define (circle-plot ang dec radius original-stil new-stil)
  ;; ang (angle) and dec (decrement) are in degrees, not radians
  (if (<= ang 0)
  new-stil
  (circle-plot (- ang dec) dec radius original-stil
(ly:stencil-add
 new-stil
 (ly:stencil-translate original-stil
   ;(ly:directed ang radius)
   ;; 2.18.2:
   (cons
 (* radius (cos (degrees->radians ang)))
 (* radius (sin (degrees->radians ang
   )

(define (radial-plot radius original-stil new-stil)
  (if (<= radius 0)
  new-stil
  (ly:stencil-add new-stil
(radial-plot
 (- radius radial-inc)
 original-stil
 (circle-plot 360 angle-inc
   radius original-stil empty-stencil)

(let ((whiteout-expr
(ly:stencil-expr
 (stencil-with-color
  (radial-plot thickness stil empty-stencil)
  color
  (ly:stencil-add
(ly:make-stencil
  `(delay-stencil-evaluation ,(delay whiteout-expr)))
stil)

#(define-markup-command
  (slanted layout props arg)
  (markup?)
  #:category font
  #:properties ((slant-angle 12))
  "Fake a slanted font"
  (let* ((alpha-rad (* 0.5 (acos (tan (* (/ PI -180) slant-angle)
 (alpha-deg (* (/ 180 PI) alpha-rad))
 (stencil
  (if (markup? arg)
  (interpret-markup layout props arg)
  empty-stencil))
 (x-ext (ly:stencil-extent stencil X))
 (y-ext (ly:stencil-extent stencil Y)))
(ly:make-stencil
  (ly:stencil-expr
(ly:stencil-scale
  (ly:stencil-rotate
(ly:stencil-scale
  (ly:stencil-rotate
(ly:make-stencil
  (ly:stencil-expr stencil)
  (cons 0 0)
  (cons 0 0))
45 0 0)
  1
  (* (tan alpha-rad)))
   (* (- alpha-deg)) 0 0)
 (* (sqrt 2) (cos alpha-rad)) (/ 0.5 (sqrt 0.5) (sin alpha-rad
  x-ext
  y-ext)))

#(define-markup-command (poor-mans-bold layout props arg)(markup?)
  #:properties ((thickness 0.03)
(color black)
(angle-increments 4)
(radial-increments 1))
   ;; Currently the entire stencil of `arg' will be outlined.
   ;; TODO better results by splitting `arg' in characters, outlining them
   ;;  and putting them together again?
   ;;  -> smallCaps
   (stencil-whiteout-outline
 (interpret-markup layout props
   arg)
   thickness
   color
   angle-increments
   radial-increments))

tst =
\markup
  \override #'(font-name . "Escolar2")
  %\override #'(font-name . "Purisa")
  %\override #'(font-name . "Times New Roman,")
  \wordwrap {
Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et dolore magna

Re: Corrected: Beaming in LilyPond

2018-04-05 Thread Thomas Morley
2018-04-05 17:10 GMT+02:00 Filip May'r <sapphire23...@outlook.com>:
> Dear Thomas,
>
>
> Thank you so much! The result is exactly what I had been trying to achieve.
> I had been looking for a solution for a while, and it was a relief to apply
> your fix.

Glad I could help.

> I understand it may seem unusual to copy the stem direction according to the
> manuscript, but I'm not sure why you think it is ugly. It's for my personal
> use, and it worked beautifully for me.

I call it ugly, because the stems are way too short.

> I'm just wondering why you signed your email the way you did. Your solution
> was constructive and helpful, and I don't see any harm in it.

Well, I want not to be indentified.
"Harm" is a malapropism of my real name, nothing to do with the
meaning of 'harm'
"Thomas Morley" is an alias as well.

I hate companies like google, for tracking me and collecting my data.
Facebook, WhatsApp, etc are another thing. Sometimes "hate" is not
strong enough. Everyone with an account there deserves what he/she
gets.
Though, having no account doesn't prevent me from them, that's the real badness.

If I can puzzle those companies a little bit, it's worth the effort
writing such mails every now and then.


Cheers,
  Harm

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


Re: Exited with return code -1073741819

2018-04-05 Thread Thomas Morley
2018-04-05 5:40 GMT+02:00 Bruce Daniel :
> Thanks David and Harm.
> Before troubling you more I will try 2.19.81. In fact I am already using
> 2.18.1.
>
> The .ly file was 24 KB.
> The problem only occurs when I take a song already (successfully) scored as
> a volta of 3 to 5 verses and split it into two back-to-back voltas to make
> for easier sight reading.
>
> Cheers, Bruce



Hi  Bruce,

without the code nobody can say anything well-founded, only guessing
will not help much...
So I'd offer you send me the code privately and I'll have a look.

Cheers,
  Harm

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


Re: Corrected: Beaming in LilyPond

2018-04-05 Thread Thomas Morley
2018-04-04 23:56 GMT+02:00 Filip May'r :
>
> Hello all,
>
>
> I am a new user of LilyPond and so far have found it to be a great tool. It 
> is relatively easy to learn (at least the basics), free and extensive.
>
>
> May I suggest an added feature: An option to stack additional note beams for 
> shorter note values on the opposite side of the first beam, that is, stacking 
> up (or down) away from, instead of toward, the note head.
>
>
> I ran into this problem when transcribing Bach's double violin concerto using 
> LilyPond.
>
>
> This is the bar (31) in the manuscript:
>
>
>
>
> Specifically the issue is with the 2nd and 3rd (c & d) notes into the bar:
>
>
>
>
> Attempting the usual stem direction changes and manual beaming results in 
> this:
>
>
>
> The 16th note beam collides with the c and d note heads!
>
>
> I have not found how to correct this. However, a feature that would simply 
> allow that the diminutive note value beams stack down away from the note head 
> would fix this very neatly. To further demonstrate: I will change the 16th 
> notes in the bar to 32nd notes:
>
>
>
> For every halving of the note value an additional beam is stacked up going up 
> toward the note head. In such circumstance as the above examples demonstrate 
> it would be ideal that those beams would stack going down away from the note 
> head, toward the bottom of the staff, exactly what is done in the handwritten 
> copy.
>
>
> If anyone knows or finds a work-around to this, please share.
>
>
> Regards
>
> - F.M.


You could do:

{
  \stemUp
  g'8[
  \stemDown
  \once \override Stem.beaming = #'((0) . (-1 0))
  c''16
  \once \override Stem.beaming = #'((-1 0) . (0))
  d''
  e''8
  \stemUp
  c']
}

Though, lily warns (with or without the overrides):
warning: no viable initial configuration found: may not find good beam slope

And is absolutely correct, the output _is_ ugly.
So I agree with Andrew.


Cheers,
  Harm

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


Re: Issue a key change in Scheme syntax

2018-04-04 Thread Thomas Morley
2018-04-04 17:08 GMT+02:00 David Kastrup :
> Urs Liska  writes:

> It's confusing for experienced users but
> not for beginners.
>
> It's designed to work as expected, for completely unrealistic
> expectations.
>
>> Arrgh.
>
> You got that right.
>
> --
> David Kastrup

ROFL

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


Re: DynamicLineSpanner.staff-padding in temporary polyphony

2018-04-04 Thread Thomas Morley
2018-04-04 7:30 GMT+02:00 Flaming Hakama by Elaine :
>
>>
>> I am not top posting
>
>
>
> HI.
>
> Please let me know if you can answer this question.
>
> I am using temporary voices to set horizontal dynamic spacing.  Which works
> fine.
> But the side effect is that the dynamics in the second voice don't obey
> DynamicLineSpanner.staff-padding
>
> How can I get the dynamics on the second voice to obey the staff padding?
>
> \version "2.19.15"
>
> \new Staff {
> \override DynamicLineSpanner.staff-padding = #3.0
> \relative c' {
>  f1\p
>  <<
>  \relative c' { f1 } \\
>
>  %  How do I get this voice to obey the DynamicLineSpanner.staff-padding
> ?
>  { s1\p }
>  >>
> }
> }
>
>
> (The actual version I'm running is 2.19.81)
>
>
> Thanks,
>
> David Elaine Alt

\version "2.19.81"

% The << \\ >> construct creates two new Voices named "1" and "2".
% The override before is in an unnamed Voices and only working in this Voice.
% I'll demonstrate with colors:

%% Default
{
  \override DynamicText.color = #red
  f'1\p
  <<
  f'1
  \\
  s\p
  >>
}

%% Apply to new Voice as well
{
  \override DynamicText.color = #red
  f'1\p
  <<
  f'1
  \\
  { \override DynamicText.color = #red s\p }
  >>
}

%% Initiate \new Voice  = "2" and put the override in \with { }
%% Keep it alive
\new Staff <<
  \new Voice  = "2"
  \with { \override DynamicText.color = #red }
  s1*2

  {
\override DynamicText.color = #red
f'1\p
<<
f'1
\\
s\p
>>
  }
>>


%% Use named Voices and apply \voices
\new Voice = "main" {
  \override DynamicText.color = #red
  f'1\p
  \voices 1,main
  <<
  f'1
  \\
  s\p
  >>
}

%% or manually
\new Voice = "main" {
  \override DynamicText.color = #red
  f'1\p
  <<
  f'1
  \\
  \context Voice = "main" s\p
  >>
}

%% Use \layout
\score {
  {
f'1\p
<<
f'1
\\
s\p
>>
  }
  \layout {
  %% Using \context { \Voice ... } } is actually not needed here.
  %% The override is already in a Bottom-context
  \context {
\Voice
  \override DynamicText.color = #red
}
  }
}

%% Apply the override in Staff-context via \with
\new Staff \with { \override DynamicText.color = #red }
{
  f'1\p
  <<
  f'1
  \\
  s\p
  >>
}

%% Probably easiest
%% Don't use << ... \\ ... >> to avoid creation of new Voices
{
  \override DynamicText.color = #red
  f'1\p
  <<
  f'1
  s\p
  >>
}


HTH,
  Harm

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


Re: Custom drum noteHead in define expression

2018-04-03 Thread Thomas Morley
2018-04-03 18:25 GMT+02:00 Karim Haddad :

> And thanx also for your snippet. I have already tried it and works 
> marvelously.
> But concerning customizing new note heads i think checking the code itself 
> seems necessary.
> Do you know if define-grobs.scm is a good place to start with ?

Well, some scheme-knowledge is needed.
There is a scheme-tutorial in the docs. Several guile tutorials out
there, as well as the guile manual.
Best general training is reading this list, though, trying to
understand the requests and trying to solve them.
If you read someones code, try to understand what happens and why, can
it be improved and ...

The Extending Manual is not bad as well.
I remember as a starter I did several exercises, defining several
custom-markup-command, markup-list-commands, substitution functions
etc etc
Homework, like a decade ago, but I'm still learning ;)

If you try to solve an own problem searching the archives is always a
good starting point.



On topic.
There's something annoying happening while using custom-styles. I just
wrote a bug-report about it:
http://lilypond.1069038.n5.nabble.com/custom-style-custom-stencil-combination-returns-warning-tt211374.html

So with the workaround, in the bug-report as well you could do:

\version "2.19.81"

#(define mydrums '(
 (bassdrummyStyle   #f   -1)
 (snare   myStyleII   #f   0)
 (hihat   cross #f   1)
 (halfopenhihat   cross "halfopen"   1)
 (pedalhihat  xcircle   "stopped"2)
 (lowtom  diamond   #f   3)))

#(define stencil-for-my-style
  (lambda (grob)
(cond
  ((eq? 'myStyle (ly:grob-property grob 'style))
(begin
  (ly:grob-set-property! grob 'style '())
  (grob-interpret-markup grob
#{
  \markup \vcenter \musicglyph #"pedal.*"
#})))
  ((eq? 'myStyleII (ly:grob-property grob 'style))
(begin
  (ly:grob-set-property! grob 'style '())
  (grob-interpret-markup grob
#{
%% from http://lsr.di.unimi.it/LSR/Item?id=515
%% slightly changed
   \markup \vcenter \scale #'(0.4 . 0.4) {
   \combine
 \translate #(cons -1.25 0) \combine
   \draw-circle #0.65 #0 ##t
   \override #'(thickness . 2.5) \draw-line #'(3 . -3)
 \translate #(cons 1.25 0) \combine
   \draw-circle #0.65 #0 ##t
   \override #'(thickness . 2.5) \draw-line #'(-3 . -3)
 }
#})))
  (else (ly:note-head::print grob)

\new DrumStaff
  \with {
drumStyleTable = #(alist->hash-table mydrums)
\override NoteHead.stencil = #stencil-for-my-style
  }
  \drummode {
bd8
sn
hh
hhho
hhp
toml
  }

You may want to adjust stem-attachment.
I leave it as an exercise ;)


HTH,
  Harm

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


Re: Get default value for grob properties

2018-04-03 Thread Thomas Morley
2018-04-03 14:39 GMT+02:00 Noeck :
> Hi Kieren,
>
> thanks for pointing me to this long and interesting discussion.
> The code¹ worked pretty well for some grobs:
>   Staff.BarLine
> (hair-thickness is 1.9)
> but did not yield anything for
>   Staff.StaffSymbol or Staff.LedgerLineSpanner
>
> I am currently trying to export to SVG and measure the dimensions in
> Inkscape. Not very comfortable but it works.
>
> Cheers,
> Joram



Hi,

Staff.StaffSymbol.thickness is the thickness of the lines from which
the StaffSymbol is build.
Per default it's line-thickness from grob-layout multiplied with the
grob-thickness, defaulting  to 1, if unset.
Though, line-thickness from grob-layout is calculated as well, it's
not the same as line-thickness from \paper.

Easiest would be to use ly:staff-symbol-line-thickness.
(If nothing else helps have a look in the stencil-expression)

For further inside read and compile below.

For finding thickness of ledgers I'd go for StaffSymbol.ledger-line-thickness.
Both values you get, have impact, but I didn't followed them, take it
as an exercise ;)

At least it should be clear why it's not that easy like reading a
simple grob-property...

HTH a bit,
  Harm

#(define (get-actual-thickness grob)
  (let* ((grob-layout (ly:grob-layout grob))
 (line-thick (ly:output-def-lookup grob-layout 'line-thickness))
 (output-scale (ly:output-def-lookup grob-layout 'output-scale))
 (thick (ly:grob-property grob 'thickness 1))
 (paper-line-thickness
   (ly:output-def-lookup $defaultpaper 'line-thickness))
 (paper-output-scale
   (ly:output-def-lookup $defaultpaper 'output-scale)))
(format #t "\n~y"
  (list
;(cons 'paper-line-thickness: paper-line-thickness)
;(cons 'paper-output-scale: paper-output-scale)
;;; same as
;;(cons 'grob-layout-output-scale output-scale)
;(cons 'devide-them::result: (/ paper-line-thickness
paper-output-scale))
(cons 'grob-layout-line-thickness: line-thick)
;(cons 'grob-thickness thick)
;(cons '(* grob-thickness line-thickness) (* thick line-thick))
;(cons '(* (/ 0.3 output-scale) thick) (* (/ 0.3 output-scale) thick))
;; grob-line-thickness from stencil-expression
(cadr (last (cadr (ly:stencil-expr (ly:grob-property grob 'stencil)
;; grob-line-thickness from `ly:staff-symbol-line-thickness'
(ly:staff-symbol-line-thickness grob)



mus = {
  \override Staff.StaffSymbol.after-line-breaking =
  #get-actual-thickness
  R1
}


%% Per default `line-thickness' and `output-scale' from \paper are used to
%% get the default `line-thickness' of the grob-layout:
%%   (/ paper-line-thickness paper-output-scale))
%%   ->  0.1
%\score {
%  \mus
%}

%% If you provide your own `line-thickness' then this value is taken:
%%   (/ (provided value: 0.3) paper-output-scale)
%%   ->  0.170716535433071,
\score {
  \mus
  \layout {
line-thickness = 0.3
  }
}
%%
%% If you provide an own grob-thickness-value, then this value gets multiplied
%% with `line-thickness' of the grob-layout.
%%   (* grob-thickness line-thickness)
%%   -> 0.2
\score {
  \mus
  \layout {
\override Staff.StaffSymbol.thickness = 2
  }
}

%% If you provide both, grob-thickness and layout-line-thickness then it's:
%%   (* (/ 0.3 output-scale) grob-thickness)
%%  -> 0.341433070866142
\score {
  \mus
  \layout {
\override Staff.StaffSymbol.thickness = 2
line-thickness = 0.3
  }
}

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


Re: Problem with a font

2018-04-03 Thread Thomas Morley
2018-04-03 18:31 GMT+02:00 Walter Garcia-Fontes :

> I get an error in your code for "slanting" the font:
>
> Parsing...letras.ly:18:5:
> In expression (ly:stencil-outline (ly:stencil-scale # # ...) stencil):
> letras.ly:18:5: Unbound variable: ly:stencil-outline

Ah yes, it's not available in 2.18., which I suppose you're using.

Cheers,
  Harm

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


Re: Upline articulation

2018-04-03 Thread Thomas Morley
2018-04-02 3:17 GMT+02:00 Andrew Bernard :
> Hi Malte and Thomas,
>
> This is all really great and appreciated.
>
> But where are these functions located, or, dare I ask, documented?
>
> Andrew

Hi Andrew,

The Extending Manual 2.5 "Markup functions" is not that bad in
explaining what happens.

The `what-ever-name-markup' procedures themselves are not documented
or listed otherwise.
You may read most of them (but not all) compiling:

#(pretty-print
  (sort
(map
  car
  (filter
(lambda (x) (markup-command-signature (cdr x)))
(ly:module->alist (resolve-module '(lily)
symbolhttps://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Problem with a font

2018-04-03 Thread Thomas Morley
2018-04-03 17:30 GMT+02:00 Walter Garcia-Fontes :
> * Abraham Lee, tisimst.lilyp...@gmail.com [03/04/18 17:23]:
>> Hi, Walter!
>> I took at a look at the internals of the font and you're not seeing
>> anything unintended (unfortunately). The single ASCII apostrophe is set
>> abnormally low compared to most any other font out there, which is why it
>> looks vertically offset by LilyPond. In LibreOffice and other
>> word-processors, when the user hits the button on the keyboard for the
>> ASCII apostrophe (same goes for quotation marks), the ASCII character gets
>> replaced by the true (curly) typographic apostrophe, which is set in the
>> more appropriate vertical position. Could be just an oversight or it could
>> be intentional. I'm not sure, but from what I am seeing, it's a "feature"
>> of the font and nothing that LilyPond is doing wrong. The obvious
>> alternative is to use typographic aposotrophes/quotation marks in your
>> source file and the problem should go away, appearing just like in
>> LibreOffice.
>
> Thanks a lot!, that's very clear.
>
> Just a question, sorry if it is obvious, what do you mean by
> "typographic apostrophes/quotation marks"?
>
> --
> Walter Garcia-Fontes
> L'Hospitalet de Llobregat



Probably:  ‘ or ’

As for italic you may try Torsten's markup-command `slanted' from:
http://lilypond.1069038.n5.nabble.com/How-to-prevent-ly-stencil-rotate-to-modify-dimensions-tt210800.html

Leading to:

#(define-markup-command
  (slanted layout props arg)
  (markup?)
  #:category font
  #:properties ((slant-angle 12))
  "Fake a slanted font"
  (let* ((alpha-rad (* 0.5 (acos (tan (* (/ PI -180) slant-angle)
  (alpha-deg (* (/ 180 PI) alpha-rad))
  (stencil
(if (markup? arg)
(interpret-markup layout props arg)
empty-stencil)))

(ly:stencil-outline
  (ly:stencil-scale
(ly:stencil-rotate
  (ly:stencil-scale
(ly:stencil-rotate
  (ly:stencil-outline stencil point-stencil)
  45 0 0)
   1
   (* (tan alpha-rad)))
 (* (- alpha-deg)) 0 0)
   (* (sqrt 2) (cos alpha-rad)) (/ 0.5 (sqrt 0.5) (sin alpha-rad)))
 stencil)))

\markup
  \override #'(font-name . "Escolar2")
  \line {
  problem‘s’s
\override #'(slant-angle . 18)
\slanted
{ problem‘s’s }
  }



Cheers,
  Harm

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


Re: Problem with a font

2018-04-03 Thread Thomas Morley
2018-04-03 15:51 GMT+02:00 Walter Garcia-Fontes <walter.gar...@upf.edu>:
> * Thomas Morley, thomasmorle...@gmail.com [03/04/18 15:44]:
>> Hi,
>>
>> 2018-04-02 20:10 GMT+02:00 Walter Garcia-Fontes <walter.gar...@upf.edu>:
>> > I have a problem using this font:
>> >
>> > http://puna.upf.edu/Escolar_N.ttf
>>
>> this link is dead...
>
> Sorry, it is:
>
> http://puna.upf.edu/Escolar_N.TTF
>
> --
> Walter Garcia-Fontes
> L'Hospitalet de Llobregat



Thanks, works now, although it was a little more difficult to install
than usual, for unknown reason.
I'm not an expert for fonts, so all I say here is by hearsay or simply guessing.

That said, regarding the images you provided the printed '-sign is not
the same in LilyPond and in LibreOffice.
I seem to remember somebody explained that text-typesetting programs
sometimes use a similiar font if a sign is not available.

Similar for bold, italic, bold-italic: if the font doesn't contain
them the program scales it.

In LibreOffice doing bold and font-size 60 prints ugly as well with Escolar2.

So I think the font itself is buggy.



Sorry to be of not more help,
  Harm

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


Re: Problem with a font

2018-04-03 Thread Thomas Morley
Hi,

2018-04-02 20:10 GMT+02:00 Walter Garcia-Fontes :
> I have a problem using this font:
>
> http://puna.upf.edu/Escolar_N.ttf

this link is dead...


Cheers,
  Harm

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


Re: Custom drum noteHead in define expression

2018-04-03 Thread Thomas Morley
2018-04-03 2:25 GMT+02:00 Karim Haddad :
> Hi,
>
>
> Just trying to figure out if this is possible :
>
> When defining  a drum instrument with this expression:
>
>
> #(define mydrums '(
>  (bassdrumdefault   #f   -1)
>  (snare   default   #f   0)
>  (hihat   cross #f   1)
>  (halfopenhihat   cross "halfopen"   1)
>  (pedalhihat  xcircle   "stopped"2)
>  (lowtom  diamond   #f   3)))
>
> Is there a way to define a very custom notehead in the 2nd argumrnt of the 
> list such as any other glyph not being a notehead, like per example a pedal 
> glyph (pedal.*)
> or any other glyph or even eps ?
>
> I have searched (maybe not too thouroughly) trying to figure this out. Any 
> help or idea will be just great. this will prevent me to use an override 
> NoteHead.stencil tweak for every note.
>
> Best
>
> --
> Karim Haddad

Hi,

in
http://lsr.di.unimi.it/LSR/Item?id=1033
I tried to explain thoroughly how to customize drums-appearance.
Probably some general help...

It should be clear then that the list-argument in question is a note-head-style.
Ofcourse only estabished styles will work.

Not sure if it might possible to define a custom style and let the
stencil-procedure rely on it.
(And not the time yet to try.)


Cheers,
  Harm

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


Re: Bug? Accidentals from tied notes having stencils that occupy space

2018-04-03 Thread Thomas Morley
2018-04-02 19:21 GMT+02:00 Stefano Troncaro :
> Hi everyone,
>
> I've experienced that in certain situations, when notes with accidentals are
> tied, the accidental grobs have stencils that seem to be hidden (not shown
> but occupy space) which creates very awkward spacing.
>
> I made this snippet to showcase this:
>>
>> \version "2.19.80"
>> \language "english"
>>
>> \paper {
>>   ragged-right = ##t
>> }
>>
>> %Tied accidentals have the same placement as the untied ones,
>> %even though that with ties there should be less grobs occupying space
>> \score {
>>   \relative c'' {
>> 1  \break
>> ~  \break
>> ~  \break
>> ~  \break
>>   }
>> }
>>
>> %Checking that there are accidental grobs for each notehead
>> \score {
>>   \relative c'' {
>>  ~
>> \override Accidental.before-line-breaking =
>> #(lambda (grob)
>>(pretty-print grob))
>> 
>> %Output:
>> %#
>> %#
>> %#
>> %#
>> %Showing there are 4 accidental grobs instead of only the required 2
>>   }
>> }
>>
>> %Deleting the tied accidentals "fixes" placement, shouldn't this be
>> default?
>> \score {
>>   \relative c'' {
>>  ~
>> \override NoteColumn.before-line-breaking =
>> #(lambda (nc)
>>(let* ((nhds (ly:grob-array->list (ly:grob-object nc 'note-heads)))
>>   (accs
>> (filter ly:grob?
>>   (map
>>(lambda (nhd)
>>  (ly:grob-object nhd 'accidental-grob))
>>nhds)))
>>   (stils
>>(list
>>  ly:accidental-interface::print
>>  #f
>>  ly:accidental-interface::print
>>  #f)))
>>  (for-each
>>   (lambda (acc stil)
>> (ly:grob-set-property! acc 'stencil stil))
>>   accs
>>   stils)))
>> 
>>   }
>> }
>>
>
> I'm fairly confident that the accidental grobs shouldn't be taking up space
> in those cases. But maybe this is intended by design and I'm failing to see
> it's use.
>
> So, is this a bug?



Hi,

in general I'd agree calling it a bug of type ugly.

Looking for an even worse example I found:

chrd = < cis~ dis~ eis~ fis gis~ ais~ bis >1
\relative c' { \chrd q }

Though, according to common type-setting rules accidentals of tied
notes have to be repeated at line-start.

chrd = < cis~ dis~ eis~ fis gis~ ais~ bis >1
\relative c' { \chrd \break q }

This _is_ correct!
So it should be clear that simply deleting accidental-stencils via
'before-line-breaking is not the way to go.

I observed the following interesting behaviour.
If you set
AccidentalPlacement.positioning-done = ##t
i.e. don't let Lilypond place the accidentals, only _two_ accidentals
are printed.
Uncommenting the break will print all accidentals, as wished.


chrd = < cis~ dis~ eis~ fis gis~ ais~ bis >1
\relative c' {
  \chrd
  %\break
  \override Staff.AccidentalPlacement.positioning-done = ##t
  q
}

Ofcourse now no placement happens and all clashes.
Also this means it doesn't matter, whether accidental-grobs or their
stencils are present or not.
Rather that the default-procedure, i.e.
ly:accidental-placement::calc-positioning-done should be improved,
imho.


Cheers,
  Harm

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


Re: Beams and staff line thickness

2018-04-02 Thread Thomas Morley
2018-04-02 21:35 GMT+02:00 Noeck :
> Hi,
>
> when playing with staff line thicknesses, I encountered the following
> problem:
>
> \relative {
>   \override Staff.StaffSymbol.thickness = #4
>   c''8 g a a
> }
>
> In general, I thought Lilypond scales a lot of thicknesses and distances
> according to staff lines and staff spaces. But here the beams don’t
> start and end aligned with the stems but more centered on the stems.
> With normal staff symbol thickness this looks ok (although I can’t tell
> at 300% zoom).
>
> Should I just not play with this thickness in that uncoordinated way or
> is that an issue?
>
> Cheers,
> Joram



Hi Joram,

this was
https://sourceforge.net/p/testlilyissues/issues/3653/
Fixed_2_21_0

Cheers,
  Harm

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


Re: Key Signature name in Markup

2018-04-02 Thread Thomas Morley
Hi,

2018-04-02 6:32 GMT+02:00 brob2684 :
> Hi Harm,
>
> I hadn't really thought about no key signature as being an issue, but I can
> certainly see how it can cause confusion.
>
> I think you are correct in suggesting "no key signature present" would be
> the appropriate output, although I'll admit I'm unlikely to ever come across
> such a case in my use of lilypond.

Well, even your first musical example has no (initial) KeySignature ;)

>>> melody = \relative c'' {
>>>   \time 4/4
>>>   c1 \key d \major d \key e \major e \key f \major f
>>> }

For the arbitrary reuse of a variable, this variable needs to be
defined at toplevel.
It's possible to update such a toplevel-variable by using an engraver,
though if you clear that variable in the engraver the value(s)/entries
are only available _in_ the score where the engraver works.
For multiple scores in the same file this means: if you don't clear it
then the values will accumulate (or override themselves).
Additionally the engraver updates it too late to have direct access to
the new values for other toplevel-markups.

So I decided to let the key-sig-names accumulate in a toplevel-list,
numbering them. Also, I wrote a markup-command where you need to
select the correct entry by using a number. A markup-command is
processed late enough.

Code attached, note the comments.

HTH,
  Harm

\version "2.19.81"


 After:

 http://lsr.di.unimi.it/LSR/Item?id=856
 see also lists.gnu.org/archive/html/lilypond-user/2013-12/msg00828.html
 by Paul Morris

%% tonic-num: number of the tonic note 0-6, C=0, B=6
%% acc-type: the accidental sign type, 1/2=sharp, -1/2=flat
%% acc-count: the number and type of accidentals in the key signature
%%  values are: -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
%%  (negative = flats, positive = sharps)
%% tonic-acc: #f if the tonic note is not sharp or flat, otherwise a pair
%% maj-num: number of the tonic note 0-6, if the key sig were major
%% mode-num: number of the mode 0-6
%% txt-size: size of key name text
%% mult: for correct resizing when the staff is resized

%% This list will be filled by the engraver and 
%% 'replace-key-sig-name'-markup-command accesses it
#(define key-signature-list '())

#(define update-key-signature-list
;; Update `key-signature-list' by a pair containing a number and `entry'
;; The numbers increase.
  (lambda (entry)
(set! key-signature-list
  (cons 
(cons (1+ (length key-signature-list)) entry)
key-signature-list

#(define (initial-moment? ctx)
  "Is current-moment the @code{ZERO-MOMENT} or before?"
  (not
(ly:momentstring arg) "key-signature-name")
(make-line-markup (assoc-get which key-signature-list (list "??")))
arg)))

\layout {
  \context {
\Staff
\consists \Store_initial_key_engraver
  }
}

%
%% EXAMPLES
%

txt =
\markuplist {
  Some text later that states that the above piece starts in key-signature-name 
  key
}

lazySpacer =
\markup \column { \vspace #1 \draw-hline }

\new Staff \relative f'' {
  \key cis \minor
  c1 d
  \key b \minor
  a1
}

\markup \replace-key-sig-name #1 \txt
\lazySpacer

\new Staff \relative f'' {
  \key gis \minor
  c1 d
  \key d \major
  a1
}

\markup \replace-key-sig-name #2 \txt
\lazySpacer

\new Staff \relative f'' {
  c1 d
  a1
}

\markup \replace-key-sig-name #3 \txt
\lazySpacer

\new Staff \relative f'' {
  \key c \major
  c1 d
  a1
}

\markup \replace-key-sig-name #4 \txt
\lazySpacer

\new Staff \relative f'' {
  \key as \major
  c1 d
  \key d \major
  a1
}

\markup \replace-key-sig-name #5 \txt
\lazySpacer
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Key Signature name in Markup

2018-04-01 Thread Thomas Morley
2018-04-01 22:25 GMT+02:00 brob2684 <bennrobert...@hotmail.com>:
> Thomas Morley-2 wrote
>> 2018-03-31 22:55 GMT+02:00 brob2684 <
>
>> bennrobertson@
>
>> >:
>>>
>>> Is it possible to extract the name of the first key signature in a piece
>>> (single staff) after adjusting for any transposition to use in text
>>> markup?
>>> (e.g. looking to get the phrase "C major" if there is no key signature
>>> before the first note (i.e. default key)).
>>>
>>> I have come across http://lsr.di.unimi.it/LSR/Item?id=856, but have no
>>> idea
>>> where to even begin modifying it (some of the changes are obvious - I can
>>> tell I don't need the rescaling bits, but I don't know enough
>>> scheme/lilypond internals to work out how to change it to give me just
>>> text).
>>>
>>
>> Hi,
>>
>> obviously I don't understand what you want.
>> Could you explain why the lsr-snippet doesn't fit your needs?
>> May be some (not working) pseude-code with the syntax you want to use
>> may be helpful as well.
>
> The snippet works insofar as it gives me the name of each key signature,
> which is very close to what I want. However, I'm only interested in storing
> the name of the first key in the piece in a variable to use in text later,
> rather than displaying the name of each key when the key signature changes.
>
> I can deduce that the last three lines of the snippet (below) are
> responsible for printing the name of the key signature above the stave at
> each key change.
>
> (ly:grob-set-property! grob 'stencil
>   (ly:stencil-combine-at-edge key-sig-stencil 1 1
> key-name-scaled padd))
>
> What I would like to do is change this somehow to set a variable to the "key
> signature name".
>
> I suspect what I need to do is remove the three lines above and replace them
> with some sort of command that first tests whether the "key signature name"
> variable been set; if yes then do nothing (to prevent overriding the
> variable), else set the "key signature name" variable to the name of the key
> signature.
>
> At some later point in markup, I'd like to be able to reference the "key
> signature variable", e.g.
>
> melody = \relative c'' {
>   \time 4/4
>   c1 \key d \major d \key e \major e \key f \major f
> }
>
> \score {
> \new Staff { \melody }
> }
>
> \markup { Some text later that states that the first key in the piece is in
> *\key_signature_name* }
>
> and have the text say "Some text later that states that the first key in the
> piece is in *C major*".



Hi,

thanks for clarification.

I thought a bit about it and I think it might be possible to store the
initial key-signature-name and let TextScript get this name under
certain conditions.
Though, what to do if _no_ KeySignature is present?
Could be c-major or a-minor or e-phrygian or maybe nothing of it but
rather dodecaphonism or ...
How to decide?

Best would be to output something like "no KeySignature present", imho.

What do you think?


Cheers,
  Harm

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


Re: Upline articulation

2018-04-01 Thread Thomas Morley
2018-04-01 18:11 GMT+02:00 Malte Meyn :
>
>
> Am 01.04.2018 um 17:00 schrieb Andrew Bernard:
>>
>> I cannot recall where I obtained this code from. But I want to have the
>> line thicker. I don't know how to modify this. Grepping the lilypond
>> installation I am unable to find the function make-draw-line-markup. Where
>> does that come from? Can I use another function that takes a thickness as an
>> additional parameter?
>
>
> The function make-draw-line-markup is the markup command draw-line

If I understand correctly, that's not entirely correct.

In general, a markup-command is done by the macro `define-markup-command'.
We get two procedures from it, in this case: `draw-line-markup' and
`make-draw-line-markup'.

See:
#(format #t "\ndraw-line-markup:\n~y"
draw-line-markup)
#(format #t "\nmake-draw-line-markup:\n~y"
make-draw-line-markup)

As you can see from the displayed results `draw-line-markup' needs
three arguments. Two of them are the default `layout' and `props'
`make-draw-line-markup' only one. The default ones are already done.

That's the reason why we can do
$(make-draw-line-markup '(0 . 1)) without anything else.

Using `draw-line-markup' would need to have those defaults arguments supplied.
In ly-syntax this automatically happens while doing
\markup \draw-line ...
But it's possible to use 'draw-line-markup' directly:
{
  \override Beam.stencil =
  #(draw-line-markup
$defaultpaper
(list (ly:output-def-lookup $defaultpaper 'text-font-defaults))
'(1 . 1))

c'8[]
}
A little strange and inconvenient, but possible...

So I think it's important to know that while using
`make-draw-line-markup' we use a procedure.
Whereas $(markup #:draw-line '(0 . 1)) will be transformed.
Makes a difference for some involved scheme-coding...

That said, for the most use-cases below is fine and doable:

> that can
> be used as
> #(make-draw-line-markup '(0 . 1))
> or
> \markup \draw-line #'(0 . 1)
> or
> #(markup #:draw-line '(0 . 1)
> Same for all other markup commands.
>
> So you can just replace the line
> (make-draw-line-markup '(0 . 1)))
> in your original code by
> (make-override-markup '(thickness . 3)
>   (make-draw-line-markup '(0 . 1)
> or by
> (markup #:override '(thickness . 3)
>   #:draw-line '(0 . 1
> or by
> #{ \markup \override #'(thickness . 3)
>  \draw-line #'(0 . 1) #}))

Cheers,
  Harm

P.S. I hope I made myself clear, not that easy for me to explain
complex stuff as a non-native speaker.

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


Re: Key Signature name in Markup

2018-04-01 Thread Thomas Morley
2018-03-31 22:55 GMT+02:00 brob2684 :
> Hi,
>
> Just wondering if the following is possible or not, and am happy to be told
> it's way too complex and not to bother.
>
> Is it possible to extract the name of the first key signature in a piece
> (single staff) after adjusting for any transposition to use in text markup?
> (e.g. looking to get the phrase "C major" if there is no key signature
> before the first note (i.e. default key)).
>
> I have come across http://lsr.di.unimi.it/LSR/Item?id=856, but have no idea
> where to even begin modifying it (some of the changes are obvious - I can
> tell I don't need the rescaling bits, but I don't know enough
> scheme/lilypond internals to work out how to change it to give me just
> text).
>
> If anyone has some pointers, they'd be much appreciated. If I'm trying to do
> something a bit too foolish, let me know and I'll give up on that.
>
> Thanks,
> brob



Hi,

obviously I don't understand what you want.
Could you explain why the lsr-snippet doesn't fit your needs?
May be some (not working) pseude-code with the syntax you want to use
may be helpful as well.

Cheers,
  Harm

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


Re: Exited with return code -1073741819

2018-04-01 Thread Thomas Morley
2018-03-31 23:13 GMT+02:00 Bruce Daniel :
> Just a bit more information.
> The problem only occurs when I have two volta sections back to back.
> Cheers, Bruce
>
> On 31 March 2018 at 20:41, Bruce Daniel  wrote:
>>
>> Hi Lilypond users,
>>
>> I've come across a recurring problem with strophic songs I'm working on.
>> It seems that beyond a certain level of complexity I get Exit. In the
>> current example it's return code -1073741819, but it can be other codes.
>>
>> If the engrave fails, I can delete some words from one verse which allows
>> me to add words to another verse. This suggests to me a limiting file size
>> or level of complexity. I've had this problem now with 2 or 3 songs in a
>> 20-song cycle I am working on. The strophic songs are complex in that there
>> are lots of "splits" in the vocal line due to different scanning of the
>> words in different verses.
>>
>> I am currently half a verse from the end of the last song and cannot
>> manage to finish it! I admit to having no clue as to where the fault is
>> coming from. Obviously a tiny example will not simulate it, so unfortunately
>> I can only attach the whole song. You should find (I have tried this on 2
>> computers, both Windows 10) that adding a word or two to the last verse will
>> cause the error. Then delete a word or two from the previous verse and it
>> will work again.
>>
>> Any help you can give would be much appreciated; the project has been a
>> lot of work and the finishing line is in sight!
>>
>> Lilypond version 2.16.0
>>
>> Best regards,
>> Bruce Daniel
>>
>> PS: the effort to learn Lilypond was absolutely worth the effort. The joy
>> of seeing these completed scores of Shubert's music I cannot describe; no
>> other software comes close! Congratulations to all the developers.



Hi Bruce,

your previous mssage was not distributed on the list, it can't be
found in the archives either.
Maybe the attachment was too large, so nobody can test.

That said, 2.16.0 is an ancient version you will not get much support.
According to
https://lists.gnu.org/archive/html/lilypond-user/2016-11/msg00564.html
the problem may be fixed since 2.19.48.
So I recommend to use an up to date version.
Most recent is 2.19.81


Cheers,
  Harm

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


Re: Diatonic accordion score fine-tuning

2018-03-31 Thread Thomas Morley
2018-03-30 18:25 GMT+02:00 Menu Jacques :
> Hello,
>
> I’ve nearly reached my goal. Further attempts lead me to the following, using 
> a GrandStaff and:
>
> \override GrandStaff.SpanBar.glyph-name = "|"
> \override Staff.BarLine.glyph-name = "'"
>
> I can’t obtain a vertical short line at the left and right ends of the 
> spanner yet though, since:
>
> \override AccordionPushSpanner.bound-details.left.text =
> \markup { \draw-line #'(0 . -3) }
> \override AccordionPushSpanner.bound-details.right.text =
> \markup { \draw-line #'(0 . 3) }
>
> don’t make a change. That would be useful it seems.
>
> Also, the thick parts of the repeat barlines don’t go down to the lower 
> stave, but that is maybe less useful. Maybe diatonic accordion players on 
> this list can comment on that. For the others, let’s mention that a thick 
> line means « push » and that its absence means « draw ».
>
> The next important step will be to convert the actual note pitches into the 
> fingerings that should be displayed instead.
>
> JM
>
>
>
>
>
>
>
>
>> Le 27 mars 2018 à 13:16, Menu Jacques  a écrit :
>>
>> Hello folks,
>>
>> I've modified the AccordionPushSpanner example supplied by someone on this 
>> list (can't find who it was, unfortunately), giving the attached file and 
>> the score :
>>
>> 
>> How can I tune the settings to align the bar lines lower tips with the 
>> single staff line, and hide the dots in the repeat bar lines, in a way 
>> similar to:
>>
>> 
>> The small vertical lines would be nice to have too.
>>
>> Thanks for your help!
>>
>> JM
>>
>> 
>>

Hi,

the original coding is by David Nalesnik
https://lists.gnu.org/archive/html/lilypond-user/2016-07/msg00541.html

Attached you'll find a revised version and an example. I recommend to
read the changelog in accordion.ily

To adjust the BarLines I'd simply set bar-extent to '(0 . 0) in the lower Staff.


HTH,
  Harm


accordion.ily
Description: Binary data
\version "2.19.81"

\include "accordion.ily"

%  EXAMPLE 


\header {
  title = "Diatonic accordion score example"
}

\layout {
  indent = 0\cm
  ragged-last = ##t
  \context {
\Global
\grobdescriptions #all-grob-descriptions
  }
  \context {
\Voice
\consists \accordionPushSpannerEngraver
  }
}

\new StaffGroup 
  \with { systemStartDelimiter = #'SystemStartBar }
  <<
  \new Lyrics 
\lyricmode {
  foo1 foo foo foo faa fii fee faa fuu
}

  \new Staff \with {
\remove "Clef_engraver"
\remove "Key_engraver"
  } {
f'1
g'1
e'1
f'1
g'1
e'4 f'2.
f'4 f'2.
f'1
f'4 f'2.
  }

  \new Lyrics
  \with {
associatedVoice = "P_PTwo_Staff_One_Voice_One"
  }
  \lyricmode {
F1 f F f |
C c \markup {
  \raise #1
  \center-column{"f" "F"}
} |
\markup{"B"\raise #1.5 \flat} |
F
  }

  \new Staff \with {
\remove "Clef_engraver"
\remove "Key_engraver"
\remove "Time_signature_engraver"
\override BarLine.bar-extent = #'(0 . 0)
\override StaffSymbol.line-count = 1
% Change vertical position of spanner.
\override AccordionPushSpanner.staff-padding = 0
\override AccordionPushSpanner.outside-staff-priority = #'()
  } {
\clef bass
\grace s1\startPush s1\startPull
s2\startPush s2
s1\startPull s1

\repeat volta 2 {
   s1\startPush
  s4 \startPull s2.
  s4 \startPush s2.
  \break
  s1
  s1 \startPull
}
  }
>>

%% Demonstrating possible overrides
\new Lyrics 
  \with { \consists \accordionPushSpannerEngraver } 
  \lyricmode {
"foo"2\startPush
"foo"\startPull

\once \override AccordionPushSpanner.thickness = 0.2
"foo"\startPush
"foo"\startPull


\once \override AccordionPushSpanner.thickness = 0.2
\once \override AccordionPushSpanner.details.wing-thickness = 1
"foo"\startPush
"foo"\startPull


\once \override AccordionPushSpanner.edge-height = #'(-2 . 2)
"foo"\startPush
"foo"\startPull

\once \override AccordionPushSpanner.direction = #-1
"foo"\startPush
"foo"\startPull

"foo"1
\once \override AccordionPushSpanner.bound-details.left.padding = #-2
\once \override AccordionPushSpanner.bound-details.right.padding = #-2
\once \override AccordionPushSpanner.bound-details.left-broken.padding = #-2
\once \override AccordionPushSpanner.bound-details.right-broken.padding = 2
"foo"2\startPush
\break
"foo"
"foo"\startPull
  }___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: rounded-box vs. box in text markup

2018-03-28 Thread Thomas Morley
2018-03-28 14:23 GMT+02:00 Emilio Millan :
> Hi all. I'm a fairly new user so I may be missing something obvious.
>
> In the following example, is there a way to "snug up" the rounded
> boxes over the second note so that they are vertically spaced like the
> boxes over the first note?
>
> \version "2.19.80"
> {
>   f''2^\markup{\box "1"}^\markup{\box "2"}^\markup{\box "3"}
>   f''2^\markup{\rounded-box "1"}^\markup{\rounded-box
> "2"}^\markup{\rounded-box "3"}
> }
>
> I know I can override box-padding to make the rounded boxes smaller,
> but I don't know how to change the space between them.
>
> Regards,
> Emilio



Your best bet is probably to use a column-markup (or center-column,
dir-column ...) and apply the same box-padding for \box and
\rounded-box (per default it's different).
Then you could override baseline-skip to fit your needs.

{
  f''1
^\markup
  \override #'(baseline-skip . 4)
  \column
\override #'(box-padding . 0.2)
\rounded-box { 1 2 3 }
  f''1
^\markup
  \override #'(baseline-skip . 4)
  \column
\override #'(box-padding . 0.2)
\box { 1 2 3 }
}

Though, I've no clue why the rounded-boxes are further away from Staff.

I just filed a bug-report about it.
http://lilypond.1069038.n5.nabble.com/Possible-regression-with-box-markup-rounded-box-markup-td211212.html

HTH,
  Harm

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


Re: Cross-staff stems

2018-03-28 Thread Thomas Morley
2018-03-28 15:43 GMT+02:00 Andrew Bernard :
> Hi All,
>
> This is surprisingly tricky, because the b flats don't line up with the
> bass. I think the OP is asking how to achieve that, not the mechanism of
> cross staff stemming.
>
> I cant figure it out either!
>
> Andrew



Hi Bernhard.

as Andrew pointed out it is tricky.

One reason is the typesetting in the image you provided is bad
concerning the order in which the last two notes in the RH are set,
imho
LilyPond does it the other way round by default. So you need to move
one note, if you want to mimic the image.
Additionally the AccidentalPlacement at second 8th is different by
default, not sure whether LilyPond does it correct. (This is not
tweaked below)

Another reason are the not aligning notes which should have the
cross-staff-stem. For this purpose I wrote `pushNC' some time ago.
Using it will result in uneven spacing so moving another NoteColumn
via X-offset is applied.

So here you are:

pushNC =
\once \override NoteColumn.X-offset =
  #(lambda (grob)
(let* ((p-c (ly:grob-parent grob X))
   (p-c-elts (ly:grob-object p-c 'elements))
   (stems
 (if (ly:grob-array? p-c-elts)
 (filter
   (lambda (elt)(grob::has-interface elt 'stem-interface))
   (ly:grob-array->list p-c-elts))
 #f))
   (stems-x-exts
 (if stems
 (map
   (lambda (stem)
 (ly:grob-extent
   stem
   (ly:grob-common-refpoint grob stem X)
   X))
   stems)
 '()))
   (sane-ext
 (filter interval-sane? stems-x-exts))
   (cars (map car sane-ext)))
(if (pair? cars)
(abs (- (apply max cars)  (apply min cars)))
0)))

\layout {
  \context {
\PianoStaff
\consists #Span_stem_engraver
  }
}

\new PianoStaff
<<
  \new Staff <<
\new Voice {
  \voiceOne
  d'8 c'? \once \override Score.NoteColumn.X-offset = 2 b a
}
\new Voice {
  \voiceTwo
  s \crossStaff bes s
  \once \override NoteColumn.force-hshift = 1.5
  \crossStaff bes
}
  >>
  \new Staff {
\clef F
\voiceTwo
fis, \pushNC cis fis, \pushNC cis
  }
>>

HTH,
  Harm

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


Re: Adding note names to a language

2018-03-27 Thread Thomas Morley
2018-03-27 4:05 GMT+02:00 Br. Samuel Springuel :
> I would like to add the basic solfege note names to the english language
> module so that I can enter music (mostly chant) using solfege and then use
> `\transpose` to adjust its sounding pitch to create a midi file which can be
> used for practice.  So far, I've done this by editing define-note-names.scm
> to add the appropriate lines.  While this works fine locally, it makes for
> files which are not portable.  Is there a way to add pitch names/aliases in
> a more portable fashion (i.e. within the music file itself).



Mixing solfege and english names sounds a little strange, imho.

Though, examples to define and use an own language can be found in
makam.ly and bagpipe.ly

Leads to below, note: only the method is demonstrated, `myNames' needs
to be extended, ofcourse

myNames = #`(
  (c . ,(ly:make-pitch -1 0 NATURAL))
  (do . ,(ly:make-pitch -1 0 NATURAL))
  (d . ,(ly:make-pitch -1 1 NATURAL))
  (re . ,(ly:make-pitch -1 1 NATURAL))
  (e . ,(ly:make-pitch -1 2 NATURAL))
  (mi . ,(ly:make-pitch -1 2 NATURAL))
)

pitchnames = \myNames
#(ly:parser-set-note-names pitchnames)

music = { do'4 re' r2 }

\score {
\new Staff {
% note the mixing of the solfege names with
% a traditional english note name in the following line
\new Voice {
  \music
  \transpose do d \music
  \transpose do re \music
}
}
\layout {}
\midi {
\tempo 4 = 120
}
}

HTH,
  Harm

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


Re: An old error (race condition?) came up again

2018-03-26 Thread Thomas Morley
2018-03-26 21:19 GMT+02:00 Stefan Husmann :
> Hello,
>
> in 2012 in
> https://lists.gnu.org/archive/html/lilypond-user/2012-03/msg00155.html
> someone brought up an issue with compiling liypond from git.
>
> This was fixed in 2012, but came up again some weeks ago.
>
> cd ./out && /usr/bin/fontforge -script emmentaler-11.genpe
> Copyright (c) 2000-2014 by George Williams. See AUTHORS for Contributors.
>  License GPLv3+: GNU GPL version 3 or later 
>  with many parts BSD . Please read LICENSE.
>  Based on sources from 23:10 UTC  5-Aug-2017-ML-D.
>  Based on source from git with hash:
> Cannot open 
> /home/haawda/paketierung/meine_Pakete/lilypond-git/src/lilypond/build/mf/out/feta11.pfb
>}
> MergeFonts: Can't find font: feta11.pfb
>
> I am also using Arch Linux (64 bit). The build function I use does not do any
> specials, I think.
>
> build() {
>   cd lilypond/
>   export PYTHON="python2"
>   export PYTHON_CONFIG="python2-config"
>   [[ -f config.hh ]] && rm config.hh
>   ./autogen.sh --noconfigure
>   [[ -d build ]] || mkdir build
>   cd build
>   ../configure --prefix=/usr \
>   --disable-documentation \
>   --enable-guile2=no
>   make -j1
> }
>
> I already tried several -j options, without success.
>
> Compiling the sources from the stable or unstable tarballs fails the
> same way.
>
> Ideas?
>
> Best Regards
>
> Stefan Husmann



https://lists.gnu.org/archive/html/lilypond-user/2018-03/msg00569.html

Cheers,
  Harm

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


Re: Vibrato (wavy lines) notation

2018-03-26 Thread Thomas Morley
2018-03-25 21:13 GMT+02:00 Richard Shann :
> I have been using a bit of code written by Mark Witmer to achieve wavy
> lines above a series of notes. It co-opts the trill spanner mechanism
> for this.
> I just found a bug in that code. When there is a line break the
> calculation of
>  (ly:grob-property grob  'X-extent)
>   - with the grob being a # -
> then the value (+inf.0 -inf.0) is returned and in consequence an error
> is thrown later when the value is used.
> Unfortunately, I don't know what the status of the original file is or
> where it came from, but attached is a version which prevents the error
> being thrown by returning 0 instead. This results in the wavy line
> running off the right margin but the typesetting at least succeeds.
> I'm sending this in case anyone else has this problem or needs to
> typeset vibrato marks, and - just in case - someone can suggest a
> correct way to handle line breaks with these vibrato markings.
>
> Richard Shann



Hi,

you may be interested in
http://lilypond.1069038.n5.nabble.com/How-to-make-this-postscript-spanner-to-work-with-L-amp-R-bound-details-td204375.html#a204622

Attached you'll find a complete rewrite of Mark's code.

Cheers,
  Harm

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


Re: get current bar number

2018-03-25 Thread Thomas Morley
2018-03-25 0:04 GMT+01:00 Kevin Barry :
> Hi Jan/Wols,
>
> Thank you for responding. I have tinkered with \applyContext and
> cannot get the property out of it to do anything useful with it. Since
> it always returns music I can't feed it to a markup command or convert
> it to markup or set it as the value for a property (using a callback
> or something like that). I have tried using it to set! another
> property and print that, but it doesn't work.
>
> I tried looking at the code for the rehearsal mark engraver, but it's
> in C++ and I don't understand it (and I suspect context objects are in
> the #included contexts.hh). I also looked at the code for the
> Measure_counter_engraver, which is in scheme, but it takes a context
> object as its parameter, which doesn't seem to get me any closer.
>
> I must be misunderstanding something. My best attempt is below. Any
> further help would be appreciated.
>
> #(define-markup-command (print-bar-number layout props) ()
>   (define barnum 0)
>   (let* ((setbarnum (lambda (context)
>(set! barnum
>  (ly:context-property context 
> 'currentBarNumber)
> (make-apply-context setbarnum)
> (interpret-markup layout props
>   (markup (number->string barnum)
>
> \repeat unfold 3 { b1^\markup \print-bar-number }
>
> Kevin



How about:

foo =
\applyOutput Voice.TextScript
  #(lambda (grob ctx c)
(ly:grob-set-property!
  grob
  'text
  (format #f "\ncurrentBarNumber: ~a"
(ly:context-property ctx 'currentBarNumber

{
  \textLengthOn
  \repeat unfold 3 { \foo c1^"" }
}

HTH,
  Harm

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


Re: Extra space at the beginning of the bar

2018-03-25 Thread Thomas Morley
2018-03-25 17:17 GMT+02:00 Paolo Prete :
> Hello Thomas,
>
> Given that the post events attached to a SkipEvent get parents like
> PaperColumn and VerticalAxisGroup, I expect that overriding some of these
> parents' properties shifts the dynamic placed on a skip  event,
> consequently. But this doesn't happen.
> Better said: I don't know which parent could I choose to override in order
> to shift its children's position properties.
>
> {
>
>  \override VerticalAxisGroup.X-extent = #'(22 . 0)
>  \override PaperColumn.X-extent = #'(22 . 0)
>  \override VerticalAxisGroup.X-offset = #'(22 . 0)
>  \override PaperColumn.X-offset = #'(22 . 0)
>   s\mf c' c' c'
>
> }
>
> More generally: is there a way to shift a vertical axis/column, so that
> associated notes/rests/dynamics/skip-events shift too?
> This would be great...
>
>
>>
>>
>> For spacing wishes for single SkipEvents you may use the SpacingSpanner:
>>
>> {
>>   \override Score.SpacingSpanner.spacing-increment = 10
>>   s4
>>   \revert Score.SpacingSpanner.spacing-increment
>>   \newSpacingSection
>>   c''2.
>> }
>>
>
> Doesn't work if the skip event has a dynamics, or a markup etc. ...
>
>
>>
>>
>> Cheers,
>>   Harm
>
>

As long as you have a SkipEvent without any post-events the
SpacingSpanner-override will affect and move the _following_
NoteColumn.
That looks fine, imho

As soon as something is attached to a SkipEvent a related PaperColumn
is created and can be tweaked like:

{
  \overrideProperty Score.PaperColumn.X-extent #'(-20 . 10)
  s4\f
  c''2.
}

Cheers,
  Harm

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


Re: Extra space at the beginning of the bar

2018-03-25 Thread Thomas Morley
2018-03-25 15:01 GMT+02:00 Paolo Prete :

> Again: I think that these events [SkipEvents] must be managed as graphic 
> objects, with
> the extra-spacing-width and X-offset properties. I don't understand why they
> don't implement these interfaces and I wonder if is there a way to override
> this behaviour (with some _global_ scheme code)

SkipEvents don't cause any grob itself.
This is a feature!

As soon as other (post-)events are attached to a SkipEvent they get
parents like PaperColum and VerticalAxisGroup.
Ofcourse those attached events may cause grobs, which are taken into
account by the spacing-engine.


For spacing wishes for single SkipEvents you may use the SpacingSpanner:

{
  \override Score.SpacingSpanner.spacing-increment = 10
  s4
  \revert Score.SpacingSpanner.spacing-increment
  \newSpacingSection
  c''2.
}


Cheers,
  Harm

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


Re: SustainPedal on shifted notes (possible bug?)

2018-03-24 Thread Thomas Morley
2018-03-24 17:19 GMT+01:00 paolo prete :
> Hello,
>
> as you can see from the below snippet, the bracket of the sustain pedal is
> not properly extended when the last note is shifted.
> Is this a bug? Is there a way to fix it or a work-around ?

Iiuc, the PianoPedalBracket is left/right bound by PaperColumns.
If you move NoteColumn, then you move it relative to it's PaperColumn,
but PaperColumn is _not_ changed.
Thus the PianoPedalBracket doesn't move along.
Not a bug but a consequencee of the current implementation.

Btw, this was changed between 2.14 and 2.16.
Most likely with
https://sourceforge.net/p/testlilyissues/issues/2153/

I did some more research/comparison with Hairpins, which may be
bounded by PaperColumns as well.
Obviously there is some more fine-grained hierarchy coded how to bound Hairpins.
Something like: DynamicText present? -> NoteColumn? ->PaperColumn
Nevertheless this does not explain the behaviour of the Hairpin in the
last Dynamics-context below.
Or probably I don't fully understand what's going.

Make that a 'likely' lol


The code prints a lot of info, visible in pdf/readable in terminal.
You may try to uncomment the commands in the first Dynamics-context,
might be a work-around.
How to do final adjustments Kieren already demonstrated by using 'shorten-pair.

Old syntax is used and some definitions added to make it work even with 2.14.

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

#(define-public (grob::name grob)
  "Return the name of the grob @var{grob} as a symbol."
  (assq-ref (ly:grob-property grob 'meta) 'name))

#(define print-info
  (lambda (grob)
(format #t "\ncurrent default-bounds:\n~y"
  (list
(grob::name grob)
(ly:spanner-bound grob LEFT)
(ly:spanner-bound grob RIGHT)

#(define nc-bounds!
  (lambda (grob)
(let*  ((left-b (ly:spanner-bound grob LEFT))
(left-elts (ly:grob-object left-b 'elements))
(left-elts-ls
  (if (ly:grob-array? left-elts)
  (ly:grob-array->list left-elts)
  '()))
(left-nc
  (filter
(lambda (g)
  (grob::has-interface g 'note-column-interface))
left-elts-ls))
(right-b (ly:spanner-bound grob RIGHT))
(right-elts (ly:grob-object right-b 'elements))
(right-elts-ls
  (if (ly:grob-array? right-elts)
  (ly:grob-array->list right-elts)
  '()))
(right-nc
  (filter
(lambda (g)
  (grob::has-interface g 'note-column-interface))
right-elts-ls)))
;(print-info grob)
(if (pair? left-nc) (ly:spanner-set-bound! grob LEFT (car left-nc)))
(if (pair? right-nc) (ly:spanner-set-bound! grob RIGHT (car
right-nc))

\score {
  <<
\new Staff \with { instrumentName = "Staff 1 " } {

  c'2\sustainOn
  f'
  \once \override Score.NoteColumn #'X-offset = 10
  c''\sustainOff
}
\new Staff \with { instrumentName = "Staff 2 " } {
  c'\<
  f'
  c''\mf
}
\new Staff \with { instrumentName = "Staff 3 " } {
  c'\<
  f'
  c''\!
}
\new Dynamics \with { instrumentName = "Dyn 1 " } {
  %\override Dynamics.PianoPedalBracket #'after-line-breaking = #nc-bounds!
  %\override Dynamics.PianoPedalBracket #'shorten-pair = #'(0 . -1)
  s\sustainOn
  s
  s\sustainOff
}
\new Dynamics \with { instrumentName = "Dyn 2 " } {
  s\<
  s
  s\mf
}
\new Dynamics \with { instrumentName = "Dyn 3 " } {
  s\<
  s
  s\!
}
  >>

  \layout {
  \context {
\Dynamics
\consists "Instrument_name_engraver"
  \override VerticalAxisGroup #'nonstaff-nonstaff-spacing =
#'((padding . 2))
  \override VerticalAxisGroup #'nonstaff-relatedstaff-spacing =
#'((padding . 4))
\override Hairpin #'after-line-breaking = #print-info
\override PianoPedalBracket #'after-line-breaking = #print-info
  }
\context {
  \Voice
  \override Hairpin #'after-line-breaking = #print-info
}
\context {
  \Staff
  \override PianoPedalBracket #'after-line-breaking = #print-info
}
\context {
  \Score
  timing = ##f
  pedalSustainStyle = #'mixed
  \override PaperColumn #'stencil = #ly:paper-column::print
}
  }
}

Cheers,
  Harm

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


Re: Add interval to selection - Frescobaldi snippet

2018-03-22 Thread Thomas Morley
2018-03-22 16:22 GMT+01:00 aeoleandust :
> Hi there!
>
> I am looking for a Frescobaldi snippet/functionality (Pyhthon script I
> assume) that would add an interval to a selected note (or selection of
> notes/chords). Something similar to the transpose function that is
> integrated, but adding the transposition to existing music to form a chord.
>
> For example {c4 d e} with an added octave above would become {4 
> }
> or added major 3rd {4} become {4} etc.
> Other intervals like thirds would be slightly more complex in terms of
> enharmonic spelling, but that shouldn't be a problem, given that various
> transpose functions already exist in Frescobaldi.
>
> My Python skills are extremely limited unfortunately. Does anyone know how
> to achieve this (or does a snippet already exist)?
>
> Cheers
> Huddie



How about these lsr-snippets?

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

Cheers,
  Harm

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


Re: Tie/Accidental Collision

2018-03-22 Thread Thomas Morley
2018-03-22 17:33 GMT+01:00 Stefano Troncaro :
> @Kieren
>>
>> Maybe use the \shape function?
>
>
> I thought that \shape didn't work inside chords?

Hi,
you may be interested in this thread:
http://lilypond.1069038.n5.nabble.com/Lilypond-ignores-some-shape-commands-in-chords-td210858.html

Cheers,
  Harm

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


Re: Constant Hairpin on line break

2018-03-21 Thread Thomas Morley
2018-03-21 3:28 GMT+01:00 Karim Haddad :
> Hi,
>
> Does somebody know how to avoid having the vertical hook on a line break and 
> just to have it on the end of a constant hairpin ?
> Here is a minimal example code :
>
> \relative c'' {
>  \override Hairpin.stencil = #constante-hairpin
>   c1 \p \< |
>   \break
>   c1 | %%here the hook should not appear if possible.
>   c1 \! |
>   }
>
> Best regards
> --
> Karim Haddad



How about:

\version "2.19.65"

#(define breaking-constante-hairpin
  (lambda (grob)
(let* ((orig (ly:grob-original grob))
   (siblings (if (ly:grob? orig)
 (ly:spanner-broken-into orig) '()))
   (grow-dir (ly:grob-property grob 'grow-direction))
 )
  (if (and (pair? siblings)
   (or (and (eqv? grow-dir RIGHT) (equal? grob (last siblings)))
   (and (eqv? grow-dir LEFT) (equal? grob (car siblings)
  constante-hairpin
  (elbowed-hairpin '((0 . 0) (1.0 . 0.0)) #f)


\relative c'' {
 \override Hairpin.stencil = #breaking-constante-hairpin
  c1 \p \< |
  \break
  c1 | %%here the hook should not appear if possible.
  c1 \! |
  }

Cheers,
  Harm

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


Re: MIDI tick resolution

2018-03-20 Thread Thomas Morley
2018-03-20 2:49 GMT+01:00 Ivan Kuznetsov :
> Gilberto Agostinho  wrote:
>>
>> Does anyone know if it possible to change the tick resolution of LilyPond's
>> MIDI output to a value other than the default 384? One reason for wanting
>> this change is due to the fact that 384 cannot be divided by 5 and so
>> quintuplets on a crotchet are not precise.
>
> No, they would not be precise but they would perceptually be
> exact enough.  Without knowing precisely how these midi clock
> values work, I would imagine that the five notes of a quintuplet
> in a MIDI file would have the following clock durations: 77 77 77 77 76.
>
> So what if four notes are of length 77 and one note is length 76?
> No one can hear the difference.

I tested two files

(1)
\score {
  {
\time 2/4
\tuplet 3/2 { c'8 8 8 8 8 8 }
  }
  \layout {}
  \midi {}
}

(2)
\score {
  {
\time 2/4
\tuplet 5/4 { c'8 8 8 8 8 }
  }
  \layout {}
  \midi {}
}

with the sequence

lilypond file.ly
mid2ly file.midi
lilypond file-midi.ly

The resulting file-midi.ly shows (only excerpts)
(1)
trackBchannelB = \relative c {
  c'4*128/384 c c c c c
  | % 2

}

Looks correct.

(2)
trackBchannelB = \relative c {
  c'4*153/384 c r4*1/384 c4*153/384 c r4*1/384 c4*153/384
}

Inserting rests here is surely not that nice.


So I'd say there are use-cases where the midi-tick has direct and
visible impact.

Cheers,
  Harm

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


Re: Bug? getting the stencil of the stem removes the beam

2018-03-18 Thread Thomas Morley
Hi Lucas,

sorry for the late reply

2018-03-16 0:50 GMT+01:00 Lucas Werkmeister :

> Perhaps we can submit this as an update for the snippet repository? (I’d be
> happy to do the paperwork if you’re okay with it.)
>
> Not tested beyond the given examples, though.
>
> FWIW, it seems to work fine in the larger score where I encountered this
> issue (though the situation there isn’t really more complicated than in
> these examples).

In further testings I observed a disadvantage of the approach via
Stem.positioning-done:

If a user has different sized note-heads in a chord, the zero-value is
not a neutral element.

See:

{
  \once \override Stem.positioning-done = #(positioning-done '(0 0))
  <
   \tweak style #'slash
   c'
   g'
  >2
}

To fix it, I think one would need to reimplement (with hooks to
customize the behaviour) the note-head/stem-placing-procedures in
scheme.
Apart from my lazyness ... it feels like overkill.

Thus I implemented a different code in the lsr-snippet.
Replacing the stencil-calls (only needed for getting the extents) by
the grob-extents.

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

WYT?

Best,
 Harm

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


Re: Bug? getting the stencil of the stem removes the beam

2018-03-15 Thread Thomas Morley
Hi Lucas,

all below under the condition 'if I understand correctly' ;)

2018-03-15 18:38 GMT+01:00 Lucas Werkmeister :
> Hi everyone,
>
> I was trying to use the \displaceHeads function from snippet 861 [1] [2] on
> an eight-note chord, but found that it completely removes the beam for some
> reason.

Not exactly true.
The beam _is_ there: this very small line at the very right of the
resulting pdf (you've cut it off in your image)

> I reduced it down to the following code:
>
> \version "2.18.2"
>
> {
>   \tweak before-line-breaking #(lambda (grob)
>  (ly:grob-property (ly:grob-object grob
> 'stem) 'stencil))
>   c'8[ c']
> }

That I call a tiny example. I'd love to see more people doing so ;)

>
> You can find a screenshot of the result at [3]. The function here doesn’t
> mutate anything,

Not exactly. The stem-stencil _is_ evaluated!

> but apparently just accessing the stem is enough to render
> the associated beam invisible

Not just assessing but evaluating the stencil before-line-breaking and
the beam is there (see above)

> (at a guess, I’d say the beam’s stencil is
> being unset somehow – it still influences the layout otherwise). Is that a
> bug in LilyPond?

Not really.
The Beam needs to set it's related stem-stencils, if a user does it
'before-line-breaking as the lsr-snippet does, the procedure setting
the beam is disturbed.

So far the lsr-snippet is bad.
Though, in my humble opinion LilyPond should print a meaningful message...

>
> The \displaceHeads problem was previously reported at [4] (and I’ve added
> the author to CC for this email), but as far as I can see the thread didn’t
> go anywhere. (To answer the question in the reply [5] – changing
> before-line-breaking to after-line-breaking fixes the beam, but also removes
> the displacement effect, so as far as I can tell you might as well just get
> rid of the \displaceHeads completely.) I hope the reduced example above will
> help to get this bug (if it is one) fixed :)


Probably below will help.
I avoided any stencil-call (not sure whether calling 'direction will
turn out to be a problem, though)
The functions `setOtherScriptParent' and `adjustStem' from the
lsr-snippet would work, but are not used in the example.


\version "2.19.65"


#(define ((positioning-done move-values) grob)
;; TODO whole and longer notes are not special cased
;; probably exclude them form the procedure by uncommenting the condition
;;
;  (if (< (ly:grob-property grob 'duration-log) 1)
;  #f
  (let* ((nc (ly:grob-parent grob X))
 (grob-ext
   (ly:grob-extent grob nc X))
 (dir (ly:grob-property grob 'direction))
 (thick (ly:grob-property grob 'thickness))
 (stem-ext
   (if (interval-sane? grob-ext)
   grob-ext
   '(0 . 0)))
 (stem-thick
   (if (zero? (interval-length stem-ext))
   thick
   (* -1 dir (interval-length stem-ext
 (note-heads-array
   (ly:grob-object grob 'note-heads))
 (note-heads-list
   (if (ly:grob-array? note-heads-array)
   (ly:grob-array->list note-heads-array)
   '(

(for-each
  (lambda (note-head v)
(let* ((nh-ext (ly:grob-extent note-head nc X))
   (nh-x-length (- (cdr nh-ext) (car nh-ext

(ly:grob-translate-axis!
  note-head
  (* v (+ nh-x-length (* dir (/ stem-thick 2
  X)))
  note-heads-list
  move-values))
  ;)
  #t)


chrd =
<
  \tweak color #green
  cis'
  \tweak color #red
  dis'
  \tweak color #blue
  eis'
>8

{
  \cadenzaOn
  \override NoteHead.layer = 500
  \accidentalStyle forget

  <>^"DEFAULTS"
  \chrd^[]
  \chrd_[]
  <
\tweak color #green
cis'
\tweak color #red
dis'
\tweak color #blue
eis'
  >1

  \bar "||"

  <>^"TWEAKED"
  \once \override Stem.positioning-done =
#(positioning-done
  '(1 0 1)
  ;'(0 1 0)
  )
  \chrd^[]

  \once \override Stem.positioning-done =
#(positioning-done
  ;'(-1 0 -1)
  ;'(0 -1 0)
  '(-1 0 -1)
  )
  \chrd_[]

  \once \override Stem.positioning-done =
#(positioning-done
  ;'(-1 0 -1)
  ;'(0 -1 0)
  '(0 -0.668 0)
  )
  <
\tweak color #green
cis'
\tweak color #red
dis'
\tweak color #blue
eis'
  >1
}

Not tested beyond the given examples, though.


Best,
  Harm

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


Re: Right aligned text in header

2018-03-13 Thread Thomas Morley
2018-03-13 20:31 GMT+01:00 Br. Samuel Springuel :
> I'm creating a custom bookTitleMarkup for a project I'm working on and have
> some lines which are setup like `meter` and `arranger` in the default
> template (two blocks of text, one flushed left the other right, on the same
> line).
>
> However, on one of those lines the header properties to be used may be very
> long and thus I need to force word wrapping to less than the full line width
> for each field.  On the left side, that is not a problem, I just use
> `\override #'(line-width . 30) \wordwrap-field`.  However, on the right side
> this doesn't work because the wrapping of the text within the field is left
> aligned inside its box (which is right aligned on the line).  What I'd like
> is for the wrapped text to be right aligned inside its box.  I tried
> changing `text-direction` to -1, and this did change the alignment, but also
> reversed the word order on each line.
>
> Is there an equivalent for `\wordwrap-field` that will flush right the text
> (much like `\justify-field` leads to it being justified)?
>
> %%% Begin Snippet %%%
> \paper  {
> % custom title layout
> bookTitleMarkup = \markup { \column {
> \fill-line { \fromproperty #'header:title }
> \fill-line {
> \fromproperty #'header:meter
> \fromproperty #'header:tune
> }
> \fill-line {
> \fromproperty #'header:poet
> \fromproperty #'header:composer
> }
> \fill-line {
> { \override #'(line-width . 30) \wordwrap-field
> #'header:poet_copyright }
> { \override #'(line-width . 30) \wordwrap-field
> #'header:tune_copyright }
> }
> }}
> scoreTitleMarkup = {}
> }
>
> \header {
> title = "Title of song (from lyrics)"
> meter = "8.8.8.8"
> tune = "name of tune"
> poet = "Poet"
> composer = "Composer"
> poet_copyright = "A sometimes long statement indicating at least the
> year of the copyright.  Should be flushed left."
> tune_copyright = "Also may be long and in need of wrapping.  Should be
> flushed right."
> }
>
> \new Staff
> {
>   \new Voice = "mel" { c' }
> }
>
> %%% End Snippet %%



Hi,

do you mean like below?
Based on
http://lsr.di.unimi.it/LSR/Item?u=1=765

#(define (general-column align-dir baseline mols)
  (let* ((aligned-mols
   (map (lambda (x) (ly:stencil-aligned-to x X align-dir)) mols)))
(stack-lines -1 0.0 baseline aligned-mols)))

#(define-markup-command (my-wordwrap-field layout props symbol)
  (symbol?)
  #:category align
  #:properties ((baseline-skip)
(align-dir LEFT))
  (let* ((m (chain-assoc-get symbol props)))
(if (string? m)
(general-column align-dir baseline-skip
  (wordwrap-string-internal-markup-list layout props #f m))
empty-stencil)))


\paper  {
% custom title layout
bookTitleMarkup = \markup { \column {
\fill-line { \fromproperty #'header:title }
\fill-line {
\fromproperty #'header:meter
\fromproperty #'header:tune
}
\fill-line {
\fromproperty #'header:poet
\fromproperty #'header:composer
}
\fill-line {
{
  \override #'(line-width . 30)
  \wordwrap-field #'header:poet_copyright
}
{
  \override #'(line-width . 30)
  \override #'(align-dir . 1)
  \my-wordwrap-field #'header:tune_copyright
}
}
}}
scoreTitleMarkup = {}
}

\header {
title = "Title of song (from lyrics)"
meter = "8.8.8.8"
tune = "name of tune"
poet = "Poet"
composer = "Composer"
poet_copyright = "A sometimes long statement indicating at least the year
of the copyright.  Should be flushed left."
tune_copyright = "Also may be long and in need of wrapping.
Should be flushed right."
}

\new Staff
{
  \new Voice = "mel" { c' }
}


Cheers,
  Harm

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


Re: How to prevent ly:stencil-rotate to modify dimensions

2018-03-11 Thread Thomas Morley
2018-03-11 15:27 GMT+01:00 Torsten Hämmerle :
> Hi Harm,
>
> David is right - it's the bounding box being rotated. As bounding boxes can
> only have heights and widths in vertical and horizontal direction (there
> isn't even such a thing as an italic slant in LilyPond), the resulting new
> bounding box's height and width increases.
>
> I usually solve this problem by calculating the desired X-extent and
> Y-extent and set the stencil dimensions.
> In scheme, I use (ly:stencil-outline stencil point-stencil) to rotate
> stencil using the dimensions of point-stencil so that the bounding box isn't
> distorted .
>
> *Example:* I've created a fake slanted markup command by combining rotate,
> scale, rotate back, scale (because there is no shearing) that keeps the
> original stencil extent.
> Without stencil extent manipulations (using point-stencil dimensions etc.)
> the resulting bounding box would be ridiculously high and totally unusable.
>
> %%%
>
> \version "2.19.81"
>
> #(define-markup-command
>   (slanted layout props arg)
>   (markup?)
>   #:category font
>   #:properties ((slant-angle 12))
>   "Fake a slanted font"
>   (let* ((alpha-rad (* 0.5 (acos (tan (* (/ PI -180) slant-angle)
>   (alpha-deg (* (/ 180 PI) alpha-rad))
>   (stencil (if (markup? arg) (interpret-markup layout props arg)
> empty-stencil))
>   )
> (ly:stencil-outline
>   (ly:stencil-scale
>(ly:stencil-rotate
> (ly:stencil-scale
>  (ly:stencil-rotate (ly:stencil-outline stencil point-stencil) 45 0
> 0)
>  1 (* (tan alpha-rad)))
> (* (- alpha-deg)) 0 0)
>(* (sqrt 2) (cos alpha-rad)) (/ 0.5 (sqrt 0.5) (sin alpha-rad)))
>  stencil)))
>
>
> \markup \override #'(box-padding . 0) \box \slanted "Poor man’s slanted
> Text"
>
> poor-mans-slanted.png
> 
>
> This is a simple case just keeping the original extents, but in the end, the
> desired new bounding box (i.e. stencil extent) has to be calculated
> explicitly depending on the desired output, I couldn't find an automatic
> solution either.
> Simple trigonometric functions are all you need - it could be worse... ;)
>
> All the best,
> Torsten

Hi Torsten,

yep, David's explanation sounds very reasonable.

To give a bit background:
Currently we have several line-styles to print solid, dashed, and
dotted lines, as well as zigzag-, trill- and squiggle-lines.
They are available via setting the style-property for grobs supporting
a line-style or via different markup-commands.
Additionally not long ago David Nalesnik wrote ly:line-interface.

Though, there are two disadvantages:
Some line-styles may visible end too short because there is no room to
add another item like a dot-, dash-, trillelement, without any
possibility to scale the line-elements accordingly. This holds
especially for the lines predefined in C++.
There is no other possibility for a user to create a new line-style
than doing it all from scratch.

So my thought was to write a scheme-line-interface with the
possibility to scale line-elements (if desired) and to provide a
simple method to create a new line-style.
This could be done by a user-provided init stencil (and probably
padding if wished) and let do the procedure all the rest.

Attached you'll find some exmple-images for a trill- and a clef-style-line.
With the clef-style-line the boundindbox-problem is very prominent.

Having a look at your code, I don't like all the trigonometrics. Guile
and LilyPond doesn't work nicely with them in special cases, so I
always try to avoid them in scheme. I was beaten by this before.
We nowadays have ly:angle, ly:directed and ly:length which serve me well.

Using your code with the following example:

\markup
  \override #'(box-padding . 0)
  \box
  \override #'(slant-angle . 40)
  \slanted
  \musicglyph #"clefs.G"

results in a not matching boundingbox as well.

With '(slant-angle . 70) it produces an error:

item-lines.ly:258:10: In procedure ly:stencil-scale in expression
(ly:stencil-scale (ly:stencil-rotate # 45 ...) 1 ...):
item-lines.ly:258:10: Wrong type (expecting real number):
7.00808368402012e-17-1.46441350735015i

Though, thanks a lot for your code!
It made me see that I need to find a method to reset the boundingboxes.

Something at the lines of
(ly:make-stencil
  whatever-stencil
  x-extent
  y-extent)

Where the challenge will be to get accurate values for x/y-extent,
ofcourse this was clear right from the start lol

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


How to prevent ly:stencil-rotate to modify dimensions

2018-03-11 Thread Thomas Morley
Hi all,

let's say I've a stencil, which I want to rotate around it's center.
For the example below I choosed make-circle-stencil, because a circle
center-rotated _should_ always look equal.
Though, applying ly:stencil-rotate modifies the dimensions of said
circle for degrees not equal to (* 90 n).
(Made visible by boxing it)

Why?
How to prevent?

\markup
  \override #'(box-padding . 0)
  \box {
\stencil
#(make-circle-stencil 0.5 0.1 #f)
\stencil
#(ly:stencil-rotate (make-circle-stencil 0.5 0.1 #f) 10 0 0)
  }


Cheers,
  Harm

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


Re: Bug? Mismatched grace notes at beginning of staff cause extra clefs in other staffs

2018-03-10 Thread Thomas Morley
2018-03-11 0:58 GMT+01:00 Lucas Werkmeister :
> Hi everyone,
>
> I found what I suspect is a LilyPond bug, but I’m not sure yet :) minimal
> example:
>
> \version "2.18.2"
>
> <<
>   \new Staff { \grace c' c' }
>   \new Staff { \clef "bass" }
>>>
>
> Instead of beginning with a bass clef, the lower staff begins with a violin
> clef and then has a bass clef right after the time signature. If a different
> key signature is set (omitted in the above example for brevity), the
> accidentals are only printed after that extra clef as well, and the whole
> group (bass clef and accidentals) is shifted to the left so that it overlaps
> the time signature.
>
> This seems to happen when the two staves begin with different amounts of
> grace notes. A workaround is to add a silent grace note to the lower staff
> (\grace s) – just make sure that it’s the same duration as the real grace
> note in the upper staff: if it’s longer (e. g. a simple \grace s without
> explicit duration if the current duration is 4 and the duration of the other
> grace note is 8), then the upper staff will have the same problem instead
> (extra clef – same as the original one in this case – and accidentals only
> after that).
>
> Unfortunately, I’m unable to check if this still happens in the current
> development version of LilyPond since I’m getting an error when building
> from Git, but that’s for a different email :) perhaps someone else can check
> that, so I don’t open a bug report for something that’s already fixed? (Or
> perhaps it’s simply expected that grace notes should be aligned between
> staves? But that would surprise me.)
>
> Oh, and for the sake of people googling for this error – it also affects
> \acciaccatura, \appoggiatura and \slashedGrace.
>
> Cheers,
> Lucas


It's issue 34
https://sourceforge.net/p/testlilyissues/issues/34/
Likely our most infamous bug, not fixed.

The workaround you've found is mentioned in the docs ;)
Search for grace synchronization.

Cheers,
  Harm

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


Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread Thomas Morley
2018-03-08 23:46 GMT+01:00 Stefano Troncaro :

> @David, Harm
> I didn't know 1.8 was not maintained anymore. I imagine we're still using it
> because updating it would take a lot of work (and create instability) and
> dev time is better placed elsewhere, or something among those lines, am I
> right?

Well, guilev2 is deeply different from guilev1 in many ways.
David K may say more about the details or look into the archives.
After guille-2.0 was released we were not able to build LilyPond with
guilev2 for 5(?) years !

I'm now can build LilyPond from the git-repository with guile-2.2.3 in
a local branch.
Though, I need to apply several patches mostly from David K and
Antonio Ospite and I need to disable some functionality, which I don't
know to fix.
My kowledge of C++ is more or less zero...


>From a users point of view the biggest disadvantage is the speed of lilypond.
I think guile-2.0.12 was the first guile-version which could be made
work for us. Lilypond speed was down to a _factor_ of 5-10, iirc
Admittedly things improved during further guile-development.

I'm not sure how the values are nowadays, I should redo testings...

For the programmers David may want to chime in.
I'd like to mention only to major points:
- Encoding problems
- We have no infrastructure for precompiled .go-files.

Both or mostly beyond my knowledge :(

> Also, Harm, is that guilev2-lilypond that you named v2.21.0 a
> personal thing or is it something that is coming after the stable 2.20
> release is done?

I compile lilypond from the repository. Doing it from master will
result in 2.21.0.
The branch stable/2.20 is meant to become the next stable release.
Current devel-versions are compiled from this branch iirc.

Best,
  Harm

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


Re: Für Kurzentschlossene: Plätze im Linuxbus Ruhr nach Chemnitz!

2018-03-08 Thread Thomas Morley
Am 8. März 2018 um 18:13 schrieb David Kastrup :
>
> Hi,
>
> sorry for writing in German: this is about transportation to a German
> Linux conference and while it is the largest one of its kind that has
> been reliable like clockwork, it is not likely to attract a lot of
> international audience.
>
> Der Linuxbus Ruhr hat noch eine Menge Platz frei.  Die Veranstaltung ist
> einfach super.  Ich bin seit Ewigkeiten dabei, und das hat seinen Grund.
> Dieses Jahr habe ich aber nur einen Vortrag über Multitracking mit
> Ardour: LilyPond liefert mir hier nur ein Midifile als Begleitung und
> ist nicht thematisiert.
>
> 
>
> Vom Ruhrgebiet aus fährt morgen ein Bus mit Haltepunkten Düsseldorf,
> Essen, Dortmund, Geseke, Chemnitz am Freitag, Rückfahrt am Sonntag.
>
> Der Bus ist nicht besonders voll: damit die Veranstalterin nicht auf
> Mehrkosten sitzenbleibt, wären weitere Mitfahrer willkommen.
>
> --
> David Kastrup


Hallo David,

ich kann leider nicht mitkommen.
Es ist das Wochenende des Landeswettbewerbs Jugend Musiziert und ich
hab' Schüler dort.
Diese Termine scheinen leider öfters zusammen zu fallen.

Ich wünsch Dir viel Erfolg für Deinen Vortrag.

Gruß,
  Harm

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


Re: Having trouble understanding optional and variable amount of arguments

2018-03-08 Thread Thomas Morley
2018-03-08 17:29 GMT+01:00 David Kastrup :
> Stefano Troncaro  writes:
>
>> @David
>> Thank you. The define-syntax and syntax-rules thing looked easier to
>> understand at first glance so I tried to use that. I'll experiment with
>> macros then.
>
> If we want to get rid of those problems: Guile-1.8 is no longer
> officially maintained.  I think someone forked it for his own purposes.
> We might want to cooperate with him regarding some official place where
> one can fix those bugs.

I've tested with my guilev2-lilypond.:

\version "2.21.0"

#(define-syntax test
   (syntax-rules ()
 ((test conditional true false)
  (if conditional
  true
  false

#(test #t (display "I'm true!\n") (display "I'm false!\n"))

Works out of the box, no need for (use-syntax (ice-9 syncase)).
`use-syntax' gives an error now. Obviously it's dropped from guilev2.

>
> Thi-something?  I am bad with names.

You likely refer to
https://lists.gnu.org/archive/html/guile-user/2017-03/msg00087.html
from Thien-Thi Nguyen

Cheers,
  Harm

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


Re: bookparts

2018-03-05 Thread Thomas Morley
2018-03-05 22:19 GMT+01:00 Kieren MacMillan :
> Hi Harm,
>
>> Nobody ever complained about not working:
>> \score {
>>  mus = { R1 }
>>  \new Staff \mus
>> }
>
> Actually, I've complained several times about not being able to create 
> variables "inline" — the most recent time being 
> , 
> which you responded to.  ;)


I stand corrected lol

Did you ever use that code from the german forum? If so, how did it
work for you?

Cheers,
  Harm

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


Re: bookparts

2018-03-05 Thread Thomas Morley
2018-03-05 21:33 GMT+01:00 Wols Lists :
> On 05/03/18 17:55, Kieren MacMillan wrote:
>> Hi Knut,
>>
>>> Because the definition of testing is invalid at that point of the main
>>> source file. If tempTest.ly would contain e.g. a score or a \paper block
>>> no error would occur.
>>
>> No, it still throws an error because you can't define a variable inside a 
>> \bookpart (which is what \include-ing it at that point does).
>>
> And as a programmer, I think "scope". You are defining the variable
> where you want to use it. It's widely accepted that that is good
> practice, global variables lead to errors, mistakes and confusion. But
> here you are forced to declare your variables at the global level :-(
>
> Cheers,
> Wol



Can't agree.
Nobody ever complained about not working:
\score {
  mus = { R1 }
  \new Staff \mus
}
>From the users point of view I see no real difference.

Ofcourse a structure like:

{ cis'1 } stored as music.ly
\score { \new Staff \include "music.ly" } stored as score.ly
\bookpart { \include "score.ly" } stored as bookpart.ly

will work.


Cheers,
  Harm

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


Re: bookparts

2018-03-04 Thread Thomas Morley
2018-03-04 18:09 GMT+01:00 Noeck :
> Hi,
>
> I need some further insights in what a bookpart is.
> I've read the doc but it is very short on the issue:
> http://lilypond.org/doc/v2.19/Documentation/notation/multiple-scores-in-a-book
> My understanding from try and error is this (and I would be happy if you
> could correct me or confirm the statements):
>
>
> \paper blocks inside a \bookpart only affect this bookpart, while \paper
> blocks outside affect everything. So it seems to be a scoping for paper
> blocks.
>
> Q: Is it correct that the bookpart is a scope for paper blocks?

Hi,

you may be interested in this
http://lilypond.1069038.n5.nabble.com/Setting-paper-for-bookpart-td204803.html
discussion, not that it'll help a lot...

Cheers,
  Harm

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


Re: old examples

2018-03-04 Thread Thomas Morley
2018-03-04 16:15 GMT+01:00 Vincent Douce Mathoscope
:
> thanks, yes it works
> i had forgotten to change the .tx extension to .ly

>> Coding ChordNames as RehearsalMark is a bit strange, but all's working for 
>> me.

Please always reply to all, so that others may follow.
Resending to list.

Thanks,
  Harm

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


Re: old examples

2018-03-04 Thread Thomas Morley
2018-03-04 15:42 GMT+01:00 Vincent Douce Mathoscope
:
> hi
> i come back to lilypond that i used sometimes in the past
> i am under mac os 10.10.5
> the example file given at the installation works fine
> but this old file does not work : lilypond seems to try and i have to
> interrupt it without any result
> if you have any idea...
> Vincent
>
> \header {
>   title = "Boboss"
>   composer = "Vinz"
> instrument = "Ligne de basse"
> }
>
> \markup "couplet"
> \relative c' {\key f \major
> bes2. \mark"Sib 9∆" f'8 e
> c2 \mark"fa ∆" f4 g8 f
> e8 d \mark"mi m7b5" cis bes a4 \mark"la 7" cis
> d2 \mark "ré m7" c}
>
> \markup "refrain"
> \relative c' {\key f \major \time 2/4
> d8. \mark"ré m7" a' d,8
> cis8. \mark"mi°" bes' a8
> d,8.^"ré m7" a d8
> f^"la m7b5" dis c dis
> d8^"mi m7b5" g bes d,
> cis^"do 9b" e bes' e,
> f8^"fa∆" a f4
> d4^"fa6" c
> }
>
>
> ––
>   Vincent Douce
>:=: Mathoscope :=:
>  http://mathoscope.xyz
>  06°13°11°07°26
>   Bagnères de Bigorre 65200



Coding ChordNames as RehearsalMark is a bit strange, but all's working for me.

Cheers,
 Harm

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


Re: A slur across a line break with change of clef in another staff generates bad output

2018-03-04 Thread Thomas Morley
Hi Lucas,

2018-03-04 0:03 GMT+01:00 Lucas Werkmeister :
> Hi everyone,
>
> I stumbled across a bug where Lilypond generates a bad slur if the slur
> crosses a line break and there is a simultaneous clef change in a different
> staff. I found a previous report for this bug in the mailing list archives
> (2015-05-30, same subject), but with Google Code being archived and
> SourceForge currently in Disaster Recovery mode, I’m not sure if the bug is
> currently tracked anywhere (or even fixed in the development version), so I
> thought I could still post my tiny(ish) example along with a workaround, and
> perhaps it would be helpful to someone :)

It's
https://sourceforge.net/p/testlilyissues/issues/3287/
not fixed yet

>
> Example (you can replace the 7 with other numbers), with workaround
> commented out:
>
> \version "2.18.2"
> <<
>   \new Staff {
> s1*7 |
> % \temporary \alterBroken control-points #'(((0.3 . 1.5) (1.3 . 2.3)
> (2.5 . 2.3) (3.5 . 1.5)) ((3.3 . 1.5) (4.3 . 2.3) (5.5 . 2.3) (6.5 . 1.5)))
> Slur
> r2.. d''8( | \break
> % \revert Slur control-points
> c'')
>   }
>   \new Staff {
> \clef "violin"
> s1*7 s1 \clef "bass"
>   }
>>>
>
> The control points aren’t perfect,
> since I couldn’t figure out how to get the automatically chosen control
> points (for the second half of the broken slur, we could just reuse these,
> since only the first half is bad, and the first half could be based on them
> as well), so I had to try to match them by eyeballing.

For this purpose the shape-command was developed, thanks David Nalesnik.
Though, you may try to set minimum-length instead, directly or via \alterBroken.
In my eyes it looks already nice then.

All three possibilities demonstrated below (comment in/out to test):

\version "2.18.2"

<<
  \new Staff {
s1*7 |
r2..

%% (1) the \shape command
\shape
  #'(
 ;; change cps of first part
 ((1.8 . 0)(1.8 . 0.8)(1 . 0.8)(1 . 0))
 ;; don't change cps of second part, thus provide an empty list
 ()
 )
  Slur

%% (2) override 'minimum-length
%\once \override Slur.minimum-length = 6

%% (3) \alterBroken with 'minimum-length
%\alterBroken minimum-length #'(6 0) Slur
d''8( | \break
c'')
  }
  \new Staff {
\clef "violin"
s1*7 s1 \clef "bass"
  }
>>

> Also, this
> unfortunately doesn’t work if you want double slurs, since AFAIK it’s not
> possible to set the control points in that case. But still, it’s better
> than nothing IMHO.


For shaping double-slurs the following may help (I used some extreme
values for the show-effect):

\version "2.18.2"

%% c/p from shape-function in music-functions-init.ly
#(define (shape-curve offsets grob coords)
  (let* ((orig (ly:grob-original grob))
 (siblings (if (ly:spanner? grob)
   (ly:spanner-broken-into orig) '()))
 (total-found (length siblings)))
(define (offset-control-points offsets)
  (if (null? offsets)
  coords
  (map coord-translate coords offsets)))

(define (helper sibs offs)
  (if (pair? offs)
  (if (eq? (car sibs) grob)
  (offset-control-points (car offs))
  (helper (cdr sibs) (cdr offs)))
  coords))

;; we work with lists of lists
(if (or (null? offsets)
(not (list? (car offsets
(set! offsets (list offsets)))

(if (>= total-found 2)
(helper siblings offsets)
(offset-control-points (car offsets)

#(define (shape-double-slurs offsets)
  (lambda (grob)
(let* ((dir (ly:grob-property grob 'direction)))
  (ly:grob-set-property! grob 'control-points '())
  (ly:grob-set-property! grob 'after-line-breaking
(lambda (grob)
  (let ((cps (ly:slur::calc-control-points grob)))
(ly:grob-set-property! grob 'control-points
  (if (> dir 0)
  (shape-curve (car offsets) grob cps)
  (shape-curve (cdr offsets) grob cps)

shapeDoubleSlurs =
#(define-music-function (parser location offsets)(pair?)
#{
  \once \override Slur.before-line-breaking = #(shape-double-slurs offsets)
#})


\score {
  \new Staff {
\set doubleSlurs = ##t
\shapeDoubleSlurs
  #'(
 ;; upside Slur
 (
   ((0 . 0) (14 . 10)(-14 . 10)(0 . 0))
 )

 . ;; n.b it's a pair

 ;; downside Slur
 (
   ((0 . 0) (0 . -6)(-20 . -6)(0 . 0))
 )
 )
c'1( c''2 c'')
\shapeDoubleSlurs
  #'(
 ;; upside Slur
 (
   ;; first part
   ((0 . 0) (-8 . 2)(8 . 2)(-2 . 0))
   ;; second part
   ((6 . 0) (0 . 0)(0 . 0)(-6 . 0))
 )

 . ;; n.b it's a pair

 ;; downside Slur
 (
   ;; first part
   ((0 . 0) (20 . -4)(-20 . -4)(0 . 0))
   ;; second part
   ((0 . 0) (13 . -3)(-10 . -4)(0 . 0))
 

Re: Having trouble understanding optional and variable amount of arguments

2018-03-03 Thread Thomas Morley
2018-03-01 18:31 GMT+01:00 Stefano Troncaro :
> I didn't know about \default or the dot/comma separated number/symbol lists!
> I can see those being useful in some circumstances. I was thinking about
> cases where an undefined amount of things different than symbols or numbers
> are required, and the closest I can imagine is chaining functions to create
> the illusion of a variable amount of arguments, like this:
>>
>> \version "2.19.80"
>>
>> #(define (end-list? obj)
>>(and (list? obj)
>> (let ((item (last obj)))
>>   (and (symbol? item)
>>(equal? "end" (symbol->string item))
>>
>> end = #(list 'end)
>>
>> #(define (el->curated-el el)
>>(delete 'end el))
>>
>> untilEnd =
>> #(define-void-function (proc el) (procedure? end-list?)
>>(let ((curated-el (el->curated-el el)))
>>  (for-each
>>   (lambda (elem)
>> (proc elem))
>>   curated-el)))
>>
>> selfAppending =
>> #(define-scheme-function (e-l) (end-list?)
>>(let ((self-input (list (cons 1 2) (cons 3 4
>>  (append self-input e-l)))
>>
>> selfAppendingInput =
>> #(define-scheme-function (input e-l) (scheme? end-list?)
>>(append (list input) e-l))
>>
>> \relative c'' {
>>   c d e f
>>   \untilEnd #pretty-print
>> \selfAppending
>> \selfAppendingInput #'(some useful input?)
>> \selfAppendingInput #selfAppending
>> \selfAppending
>> \end
>>   g a b c
>> }
>
> This structure just happens to work for something I'm trying now but I can
> see it being too narrow in general.
>
> @Urs, I not familiar with \with blocks, I'll take a look at the oll-core
> code and experiment a bit with it. Maybe I'll be able to help.
>
> 2018-03-01 4:55 GMT-03:00 David Kastrup :
>>
>> Stefano Troncaro  writes:
>>
>> > Thank you! I see that this is not an option then. Also, I now understand
>> > why I couldn't make the optional arguments work, since I always left
>> > them
>> > for last.
>> >
>> > Do you know if it is possible to have a flexible amount of optional
>> > arguments that appear before the last mandatory one? Say, for example
>> > (define-music-function (arg1 args music) (number? ??? ly:music?) where
>> > arg1
>> > and music are mandatory, and basically everything between arg1 and the
>> > next
>> > music expression is compacted into a list and accessed as args in the
>> > body
>> > of the function. Not with that syntax necessarily, but something that
>> > allows for that kind of usage?
>>
>> You know that a number or symbol list can be entered as a
>> comma-separated list?
>>
>> --
>> David Kastrup

Hi Stefano,

I was always fine with one optional list?-predicate (this may ofcourse
be an alist) and sorting/processing this list in the body of the
music-function.
Or things like (lambda (arg . rest) ...) in some cases or the
comma-separated list (as already mentioned).

If you really want to go for a music-function with arbitrary arguments
here some thoughts.

Beside the result has still limitations:
- the amount of possible arguments has to be specified (ofcourse you
can go for something like 20, which should really be enough (currently
5 are defined)
- all those arguments have to be of kind (not (ly:music ...)), which
makes it impossible to enter a second music-argument.
- maybe more, it's not tested beyond the given examples
I expect David K will point out more weaknesses ... lol

I deleted the not matching doc-strings from define-syntax-function and
define-music-function.
Look into music-functions.scm to read them.

\version "2.19.65"

#(defmacro-public define-my-syntax-function
  (args-amount type args signature . body)
  (define (has-parser/location? arg where)
(let loop ((arg arg))
  (if (list? arg)
  (any loop arg)
  (memq arg where
  (define (currying-lambda args doc-string? body)
(if (and (pair? args)
 (pair? (car args)))
(currying-lambda (car args) doc-string?
 `((lambda ,(cdr args) ,@body)))
(let* ((compatibility? (if (list? args)
   (= (length args) (+ 2 (length signature)))
   (and (pair? args) (pair? (cdr args))
(eq? (car args) 'parser
   (realargs (if compatibility? (cddr args) args)))
  `(lambda ,realargs
 ,(format #f "~a\n~a" realargs (or doc-string? ""))
 ,@(if (and compatibility?
(has-parser/location? body (take args 2)))
   `((let ((,(car args) (*parser*)) (,(cadr args) (*location*)))
   ,@body))
   body)

  (let ((docstring
 (and (pair? body) (pair? (cdr body))
  (if (string? (car body))
  (car body)
  (and (pair? (car body))
   (eq? '_i (caar body))
   (pair? (cdar 

Re: Missing messages [was: Stem forced to be at the right (or left) of the notehead]

2018-03-02 Thread Thomas Morley
2018-03-02 22:26 GMT+01:00 Brian Barker <b.m.bar...@btinternet.com>:
> At 13:25 02/03/2018 -0700, Thomas Morley wrote:
>>
>> Paolo Prete wrote
>>>
>>> ...
>>
>>
>> For unknown reasons I don't see your posts on the mailing-list, ...
>
>
> Neither do I. But I can help there: it's all down to Domain-based Message
> Authentication, Reporting and Conformance (DMARC). This is a comparatively
> new system whereby mail domains can publish information to confirm or
> otherwise that messages are genuinely sent from a mail server maintained by
> that domain. Paolo Prete's mail domain appears to be yahoo.it, and Yahoo is
> one of the sending domains that uses this system. If he sent to you
> directly, everything would work OK and Gmail would accept the message.
>
> The problem arises with mailing lists. The server forwarding the message -
> in this case Lilypond's - is not a proper source for @yahoo.it messages, of
> course, so Gmail quite properly rejects list messages claiming to be from
> Yahoo addresses as spoofed. (As it happens, so does my mail provider.) If it
> is configured properly, mailing list software can arrange headers so that
> the receiving system - Gmail's in your case - sees his Yahoo server as the
> originator instead of the mailing list's. The problem is that most list
> software available when this protection was introduced was incapable of
> being properly configured. To avoid this effect, Lilypond may need to update
> the list software (apparently Mailman 2.1.21) or maybe just configure it
> differently.
>
> See
> https://en.wikipedia.org/wiki/DMARC - which includes "In April 2014, Yahoo
> changed its DMARC policy to p=reject, thereby causing misbehavior in several
> mailing lists."
> and
> https://wiki.list.org/DEV/DMARC for details of Mailman's behaviour.
>
> Brian Barker

Hi Brian,

thanks for the info.

Though, in the past, mails from Yahoo, distributed by the
mailing-list, were put into my spam-folder by gmail.
Obviously this changed 2 or 3 days ago. Now I receive nothing...

Reading the first link you provided, the workarounds are not without problems.

Thanks,
  Harm

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


Re: Obtain the number of notes and rests from "ly:music?" parameter passed to a function

2018-03-02 Thread Thomas Morley-2
Paolo Prete wrote
> Hello,
> in the snippet below how can I replace "4" (in the denominator of
> "\times") with the number of notes+rests (including "s") in $notes ?
> Thanks
> 
> 
> createTuplet = #(define-music-function (parser location notes)
> (ly:music?)#{  \times 2/4 $notes#})
> {  \createTuplet {c' e' r g'}}

Well, you could do like below, but I can't believe the output is what you
want.

\version "2.18.2"

createTuplet = #(define-music-function (parser location notes) (ly:music?)
#{
  \times 
#(cons 
  2 
  (length (extract-named-music notes '(RestEvent SkipEvent NoteEvent
  $notes
#})

{
  \createTuplet { c'4 e' r g' }
  \createTuplet { c'4 e' r  }
  \createTuplet { c'4 e' r s4 }
  \createTuplet { c'4 e' r s16 s16 s16 s16 }
}

Cheers,
  Harm




--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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


Re: Stem forced to be at the right (or left) of the notehead

2018-03-02 Thread Thomas Morley-2
Paolo Prete wrote
> From what I see, the result of the snippet is that the notehead is moved,
> but the stem remains fixed. Instead, I need that the notehead remains in
> its position and the stem is placed on the right...
> thanks for your help 

For unknown reasons I don't see your posts on the mailing-list, thus
answering through the nabble-interface...

Probably below may do what you want, although I've no clue what you're
trying to achieve.
See the last example, strange, to say the least.

\version "2.19.65"

{
  \override NoteHead.stem-attachment =
#(lambda (grob)
   (let* ((stem-attach (ly:note-head::calc-stem-attachment grob))
  (stem (ly:grob-object grob 'stem))
  (stem-thick (ly:grob-property stem 'thickness))
  (layout (ly:grob-layout grob))
  (line-thick (ly:output-def-lookup layout 'line-thickness))
  (blot (ly:output-def-lookup layout 'blot-diameter))
  (stem-dir (ly:grob-property stem 'direction)))
 (if (and (ly:grob? stem) (< stem-dir 0))
 (cons 
   (- (+ blot (* stem-thick line-thick)) (car stem-attach))
   (- (cdr stem-attach)))
 stem-attach)))
  
  d'2
  g''2
  
  
}


HTH,
  Harm



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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


Re: transpose to a set of pitches

2018-02-27 Thread Thomas Morley
2018-02-27 19:12 GMT+01:00 Sirius Barras :
> I would like to transpose a motif (using \modalTranspose) to a _set_ of
> different pitches. At the moment this is what I do:
>
> scale = {c d e f g a b}
> motif = {c' e' g' c'}
> {
>   \modalTranspose c e \scale \motif
>   \modalTranspose c g \scale \motif
>   \modalTranspose c a \scale \motif
> }
>
> How can I do something similar to this:
>
> toPitchSet = {e g a}
> scale = {c d e f g a b}
> motif = {c' e' g' c'}
> {
>   \modalTranspose c \toPitchSet \scale \motif
> }
>
> Many thanks, S.


How about:

\version "2.19.65"

%% Based on a function by David K
multipleModalTransposes =
#(define-music-function (parser location m scale music)
  (ly:music? ly:music? ly:music?)
  ;; If `music' is simple `SequentialMusic', we need to go for 'elements instead
  ;; of 'element. In this case we also need to "unfold" the resulting
  ;; `possible-elts' one level
  (let* ((seq-mus? (music-is-of-type? music 'sequential-music))
 (possible-elts
   (map
 (lambda (pitch)
 (ly:music-property
   #{ \modalTranspose c $pitch $scale $music #}
 (if seq-mus?
'elements
'element)))
(event-chord-pitches m

(music-clone m
  'elements
  (if seq-mus?
  (apply append '() possible-elts)
  possible-elts

toPitchSet = { e g a e b }
scale = { c d e f g a b }
motif =
  %\absolute { c' e' g' c' }
  %\relative { c' e g c, }
  %\relative c' { c e g c, }
  %\fixed c' { c e g c }
  %\context Voice { c'4 e' g' c' }
  { c'4 e' g' c' }

\multipleModalTransposes \toPitchSet \scale \motif


Cheers,
  Harm

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


Re: Lyric centre-on-word / ignore-punctuation bug

2018-02-24 Thread Thomas Morley
2018-02-24 3:45 GMT+01:00 Kieren MacMillan :
> Hi all,
>
> When a lyric syllable begins with a typographer’s single quote (e.g., ’cause, 
> ’ll, etc.), the "ignore-punctuation" hack doesn't work. Any hints on how to 
> fix this would be appreciated.
>
> Thanks,
> Kieren.
>
> %%%  SNIPPET BEGINS
> \version "2.19"
>

Only characters from `space-set' are respected by `center-on-word'.
Extend the given string with "’"

> #(define space-set
>   (list->char-set
> (string->list "—.?-;,:“†‘’–— */()[]{}|<>!`~&…")))

#(define space-set
  (list->char-set
(string->list "’—.?-;,:“†‘’–— */()[]{}|<>!`~&…")))

works for me.

Cheers,
  Harm

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


Re: fingering

2018-02-22 Thread Thomas Morley
2018-02-22 11:03 GMT+01:00 Thomas Morley <thomasmorle...@gmail.com>:
> 2018-02-22 10:58 GMT+01:00 Gianmaria Lari <gianmarial...@gmail.com>:
>> Dear Harm,
>>
>> thank you for your really nice help. Your fix worked well and now your
>> example is perfect!
>>
>> I hope others will take advantage of it.
>>
>> I copy here the final working code with a screenshot.
>
> Glad you like it :)
>
> This morning I observed a certain weakness in the code, a missing
> safety net to be more precise.
> I'll have a deeper look this evening. Now I have to run for my regular job ...
>
> Cheers,
>   Harm

Likely safer to check whether a stencil is present before trying to
change it. At least it calms down my paranoia ...

adjustFC =
  \override Staff.FingeringColumn.before-line-breaking =
#(lambda (grob)
   "Sets @code{snap-radius} of @code{FingeringColumn} to @code{3} and
applies @code{centered-stencil} to every fingering-stencil"
   (let*  ((fingerings (ly:grob-object grob 'fingerings))
   (fingering-ls
 (if (ly:grob-array? fingerings)
 (ly:grob-array->list fingerings)
 '(
 (ly:grob-set-property! grob 'snap-radius 3)
 (for-each
   (lambda (f)
 (let ((f-stil (ly:grob-property f 'stencil)))
   (if (ly:stencil? f-stil)
   (ly:grob-set-property! f 'stencil
 (centered-stencil f-stil)
   fingering-ls)))

Cheers,
  Harm

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


Re: fingering

2018-02-22 Thread Thomas Morley
2018-02-22 10:58 GMT+01:00 Gianmaria Lari :
> Dear Harm,
>
> thank you for your really nice help. Your fix worked well and now your
> example is perfect!
>
> I hope others will take advantage of it.
>
> I copy here the final working code with a screenshot.

Glad you like it :)

This morning I observed a certain weakness in the code, a missing
safety net to be more precise.
I'll have a deeper look this evening. Now I have to run for my regular job ...

Cheers,
  Harm

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


<    7   8   9   10   11   12   13   14   15   16   >