Re: text block as spanner

2019-02-02 Thread David Nalesnik
Hi,

On Sat, Feb 2, 2019 at 2:13 PM Thomas Morley  wrote:
>
> Am Sa., 2. Feb. 2019 um 21:09 Uhr schrieb Thomas Morley
> :
>
> > A bold workaround is to define the whole infrastructure for
> > TextSpanners with new/renamed events (class and type), grobs,
> > engravers and
> > start/stop-commands.
>
> I forgot to point to a limitation
> The provided 'text-spanner->text' doesn't care for line-breaks.
>
> Cheers,
>   Harm

There is this: https://www.mail-archive.com/lilypond-user@gnu.org/msg105826.html

Not sure if anything needs to be updated.

Best,
David

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


Re: Lutoslawski-style box notation

2018-11-04 Thread David Nalesnik
On Sun, Nov 4, 2018 at 6:09 AM Thomas Morley  wrote:
>
> Am So., 4. Nov. 2018 um 01:30 Uhr schrieb David Nalesnik
> :
> >
> > On Sat, Nov 3, 2018 at 7:24 PM David Nalesnik  
> > wrote:
> > >
> > > On Sat, Nov 3, 2018 at 7:23 PM Andrew Bernard  
> > > wrote:
> > > >
> > > > Hi David,
> > > >
> > > > Isn't Lilypond open source? Cant you make your code open source? I am 
> > > > not following your idea.
> > > >
> > > > Andrew
> > > >
> > > >
> > > >> >
> > > >> And, no :(  I removed it from GitHub, because I simply do not
> > > >> understand how I would license such a thing, give proper
> > > >> acknowledgement to LilyPond.  It quotes code from LilyPond internals,
> > > >> and before I put something up on GitHub I would need to make sure I'm
> > > >> not violating the terms of LilyPond's license.
> > > >>
> >
> > Oops, sorry about the empty response.
> >
> > Sure, yes, I just want to make sure that I release it under the right
> > license (I suppose it must be GPLed) and include whatever I must
> > relative to LilyPond coverage by the GPL .  I just jumped the gun,
> > that's all.
> >
> > David
>
> Hi David,
>
> is it really an issue I have to think about licenses as soon as I use
> some lily-internals?
> For example, whenever I propose a callback with some condition using
> 'ly:grob-set-property!' and the like...
>
> In a worst scenario that would drop any user support other than:
> "RTFM" (or more polite: it's in the docs, look "here".)
> Or
> "It's not in the docs, please file a bug report."
> Or
> "You could do like below [...]. Please accept my licence: "
>
> Really?
>

Hi Harm,


But I think we're talking about different things.  You're talking
about communications on an official channel connected with the
project.  I'm talking about posting code which modifies LilyPond on a
third-party forum -- GitHub.


Best,
David

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


Re: Lutoslawski-style box notation

2018-11-03 Thread David Nalesnik
On Sat, Nov 3, 2018 at 7:24 PM David Nalesnik  wrote:
>
> On Sat, Nov 3, 2018 at 7:23 PM Andrew Bernard  
> wrote:
> >
> > Hi David,
> >
> > Isn't Lilypond open source? Cant you make your code open source? I am not 
> > following your idea.
> >
> > Andrew
> >
> >
> >> >
> >> And, no :(  I removed it from GitHub, because I simply do not
> >> understand how I would license such a thing, give proper
> >> acknowledgement to LilyPond.  It quotes code from LilyPond internals,
> >> and before I put something up on GitHub I would need to make sure I'm
> >> not violating the terms of LilyPond's license.
> >>

Oops, sorry about the empty response.

Sure, yes, I just want to make sure that I release it under the right
license (I suppose it must be GPLed) and include whatever I must
relative to LilyPond coverage by the GPL .  I just jumped the gun,
that's all.

David

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


Re: Lutoslawski-style box notation

2018-11-03 Thread David Nalesnik
On Sat, Nov 3, 2018 at 7:23 PM Andrew Bernard  wrote:
>
> Hi David,
>
> Isn't Lilypond open source? Cant you make your code open source? I am not 
> following your idea.
>
> Andrew
>
>
>> >
>> And, no :(  I removed it from GitHub, because I simply do not
>> understand how I would license such a thing, give proper
>> acknowledgement to LilyPond.  It quotes code from LilyPond internals,
>> and before I put something up on GitHub I would need to make sure I'm
>> not violating the terms of LilyPond's license.
>>

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


Re: Lutoslawski-style box notation

2018-11-03 Thread David Nalesnik
On Sat, Nov 3, 2018 at 4:28 PM David Nalesnik  wrote:
>
> On Sat, Nov 3, 2018 at 4:11 PM Thomas Morley  wrote:
> >
> > Am Sa., 3. Nov. 2018 um 21:36 Uhr schrieb Ben :
> > >
> > > On 11/3/2018 4:25 PM, David Nalesnik wrote:
> > >
> > > On Sat, Nov 3, 2018 at 3:21 PM Ben  wrote:
> > >
> > > On 11/3/2018 4:16 PM, David Nalesnik wrote:
> > >
> > > On Sat, Nov 3, 2018 at 2:57 PM Ben  wrote:
> > >
> > > On 11/3/2018 2:54 PM, m...@opus11.net wrote:
> > >
> > > Just wondered if anyone has a working solution to creating 
> > > Lutoslawski-style box repeats such as this one: 
> > > https://goo.gl/images/TYKdWt
> > >
> > > I couldn't find a complete solution in either the LSR or mailing list 
> > > archives. If not, I'll start putting together something probably based on 
> > > the frame module from https://github.com/openlilylib/analysis, but any 
> > > tips would be appreciated.
> > >
> > > Thanks,
> > >
> > > Mark
> > >
> > >
> > > Hi Mark,
> > >
> > > For a long while I was using the frameengraver21 but I remember 
> > > encountering a bug and never being able to move past it since. I'm not 
> > > sure what is available recently, but I am curious as well :) I would use 
> > > it quite often if there was a boxed notation module.
> > >
> > > The solution to this error has come up several times on the list.
> > > Searching "must be type `list'" returns
> > >
> > > https://www.mail-archive.com/lilypond-user@gnu.org/msg117642.html
> > >
> > > You can also find the FrameEngraver code in that thread.
> > >
> > > Best,
> > > David
> > >
> > >
> > > Thank you David! Not sure how I missed that...
> > >
> > > Easy enough--the archives are not a good place to version-control
> > > code!  I think I finally need to put this stuff up on GitHub so
> > > there's an easy place to find the "latest" version (which I will need
> > > search the list archives to discover...)
> > >
> > > David
> > >
> > >
> > > David,
> > >
> > > Sorry to bother but I'm afraid I can't get it to work (and I didn't find 
> > > it on GitHub btw)
> > >
> > > I found the section of the file to modify
> > >
> > > #(define my-grob-descriptions '())
> > >
> > > #(define (add-grob-definition grob-name grob-entry)
> > >(let* ((meta-entry   (assoc-get 'meta grob-entry))
> > >   (class(assoc-get 'class meta-entry))
> > >   (ifaces-entry (assoc-get 'interfaces meta-entry)))
> > >  (set-object-property! grob-name 'translation-type? list?)
> > >
> > > ...but replacing with the code from the archive still isn't working :(
> > >
> > > % ADD NEW GROB DEFINITIONS 
> > > %
> > >
> > > #(define (add-grob-definition grob-name grob-entry)
> > >(let* ((meta-entry   (assoc-get 'meta grob-entry))
> > >   (class(assoc-get 'class meta-entry))
> > >   (ifaces-entry (assoc-get 'interfaces meta-entry)))
> > >  (set-object-property! grob-name 'translation-type? 
> > > ly:grob-properties?) ;;
> > > NB!!
> >
> > Additionally, at CREATE NEW EVENT CLASSES replace with:
> >
> > #(define-event-class 'frame-event 'span-event)
> > #(define-event-class 'frame-extender-event 'span-event)
> >
> > The modified file's attached. Works for me.
> >
>
> And a working file + example is now on GitHub:
> https://github.com/davidnalesnik/frame-engraver
>
> No warranties or guarantees :)
>

And, no :(  I removed it from GitHub, because I simply do not
understand how I would license such a thing, give proper
acknowledgement to LilyPond.  It quotes code from LilyPond internals,
and before I put something up on GitHub I would need to make sure I'm
not violating the terms of LilyPond's license.

Sorry, I apologize about that.

David

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


Re: Lutoslawski-style box notation

2018-11-03 Thread David Nalesnik
On Sat, Nov 3, 2018 at 4:11 PM Thomas Morley  wrote:
>
> Am Sa., 3. Nov. 2018 um 21:36 Uhr schrieb Ben :
> >
> > On 11/3/2018 4:25 PM, David Nalesnik wrote:
> >
> > On Sat, Nov 3, 2018 at 3:21 PM Ben  wrote:
> >
> > On 11/3/2018 4:16 PM, David Nalesnik wrote:
> >
> > On Sat, Nov 3, 2018 at 2:57 PM Ben  wrote:
> >
> > On 11/3/2018 2:54 PM, m...@opus11.net wrote:
> >
> > Just wondered if anyone has a working solution to creating 
> > Lutoslawski-style box repeats such as this one: https://goo.gl/images/TYKdWt
> >
> > I couldn't find a complete solution in either the LSR or mailing list 
> > archives. If not, I'll start putting together something probably based on 
> > the frame module from https://github.com/openlilylib/analysis, but any tips 
> > would be appreciated.
> >
> > Thanks,
> >
> > Mark
> >
> >
> > Hi Mark,
> >
> > For a long while I was using the frameengraver21 but I remember 
> > encountering a bug and never being able to move past it since. I'm not sure 
> > what is available recently, but I am curious as well :) I would use it 
> > quite often if there was a boxed notation module.
> >
> > The solution to this error has come up several times on the list.
> > Searching "must be type `list'" returns
> >
> > https://www.mail-archive.com/lilypond-user@gnu.org/msg117642.html
> >
> > You can also find the FrameEngraver code in that thread.
> >
> > Best,
> > David
> >
> >
> > Thank you David! Not sure how I missed that...
> >
> > Easy enough--the archives are not a good place to version-control
> > code!  I think I finally need to put this stuff up on GitHub so
> > there's an easy place to find the "latest" version (which I will need
> > search the list archives to discover...)
> >
> > David
> >
> >
> > David,
> >
> > Sorry to bother but I'm afraid I can't get it to work (and I didn't find it 
> > on GitHub btw)
> >
> > I found the section of the file to modify
> >
> > #(define my-grob-descriptions '())
> >
> > #(define (add-grob-definition grob-name grob-entry)
> >(let* ((meta-entry   (assoc-get 'meta grob-entry))
> >   (class(assoc-get 'class meta-entry))
> >   (ifaces-entry (assoc-get 'interfaces meta-entry)))
> >  (set-object-property! grob-name 'translation-type? list?)
> >
> > ...but replacing with the code from the archive still isn't working :(
> >
> > % ADD NEW GROB DEFINITIONS 
> > %
> >
> > #(define (add-grob-definition grob-name grob-entry)
> >(let* ((meta-entry   (assoc-get 'meta grob-entry))
> >   (class(assoc-get 'class meta-entry))
> >   (ifaces-entry (assoc-get 'interfaces meta-entry)))
> >  (set-object-property! grob-name 'translation-type? 
> > ly:grob-properties?) ;;
> > NB!!
>
> Additionally, at CREATE NEW EVENT CLASSES replace with:
>
> #(define-event-class 'frame-event 'span-event)
> #(define-event-class 'frame-extender-event 'span-event)
>
> The modified file's attached. Works for me.
>

And a working file + example is now on GitHub:
https://github.com/davidnalesnik/frame-engraver

No warranties or guarantees :)

Best,
David

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


Re: Lutoslawski-style box notation

2018-11-03 Thread David Nalesnik
On Sat, Nov 3, 2018 at 3:21 PM Ben  wrote:
>
> On 11/3/2018 4:16 PM, David Nalesnik wrote:
>
> On Sat, Nov 3, 2018 at 2:57 PM Ben  wrote:
>
> On 11/3/2018 2:54 PM, m...@opus11.net wrote:
>
> Just wondered if anyone has a working solution to creating Lutoslawski-style 
> box repeats such as this one: https://goo.gl/images/TYKdWt
>
> I couldn't find a complete solution in either the LSR or mailing list 
> archives. If not, I'll start putting together something probably based on the 
> frame module from https://github.com/openlilylib/analysis, but any tips would 
> be appreciated.
>
> Thanks,
>
> Mark
>
>
> Hi Mark,
>
> For a long while I was using the frameengraver21 but I remember encountering 
> a bug and never being able to move past it since. I'm not sure what is 
> available recently, but I am curious as well :) I would use it quite often if 
> there was a boxed notation module.
>
> The solution to this error has come up several times on the list.
> Searching "must be type `list'" returns
>
> https://www.mail-archive.com/lilypond-user@gnu.org/msg117642.html
>
> You can also find the FrameEngraver code in that thread.
>
> Best,
> David
>
>
> Thank you David! Not sure how I missed that...

Easy enough--the archives are not a good place to version-control
code!  I think I finally need to put this stuff up on GitHub so
there's an easy place to find the "latest" version (which I will need
search the list archives to discover...)

David

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


Re: Lutoslawski-style box notation

2018-11-03 Thread David Nalesnik
On Sat, Nov 3, 2018 at 2:57 PM Ben  wrote:
>
> On 11/3/2018 2:54 PM, m...@opus11.net wrote:
>
> Just wondered if anyone has a working solution to creating Lutoslawski-style 
> box repeats such as this one: https://goo.gl/images/TYKdWt
>
> I couldn't find a complete solution in either the LSR or mailing list 
> archives. If not, I'll start putting together something probably based on the 
> frame module from https://github.com/openlilylib/analysis, but any tips would 
> be appreciated.
>
> Thanks,
>
> Mark
>
>
> Hi Mark,
>
> For a long while I was using the frameengraver21 but I remember encountering 
> a bug and never being able to move past it since. I'm not sure what is 
> available recently, but I am curious as well :) I would use it quite often if 
> there was a boxed notation module.

The solution to this error has come up several times on the list.
Searching "must be type `list'" returns

https://www.mail-archive.com/lilypond-user@gnu.org/msg117642.html

You can also find the FrameEngraver code in that thread.

Best,
David

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


Re: Roman Numeral rehearsal marks?

2018-10-24 Thread David Nalesnik
On Wed, Oct 24, 2018 at 8:41 AM N. Andrew Walsh
 wrote:
>
> Hi List,
>
> is there any other available format for rehearsal marks? My client wants 
> Roman numerals, and the workaround I've been using:
>
> <>^\markup { \raise #4 \right-align \abs-fontsize #16 \bold { "IV" } }
>
> doesn't work if the voice containing it is resting at that point (or, 
> conversely, I don't know how to ensure that the \markup is always placed on 
> the topmost stave of a system and no others).
>
> Is there a better way to do this? MWE:
>

Based on my reading of scm/translation.functions.scm, I have no idea
why the following should not work:

\version "2.19.82"

\relative c'' {
  \set Score.markFormatter = #(format-mark-generic '(roman box bold mixedcase))
  c1 \mark \default
  c1 \mark \default
}

-David

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


Re: Changing clef automatically when pitch falls between a user-defined range of pitches

2018-10-18 Thread David Nalesnik
On Thu, Oct 18, 2018 at 9:27 AM elmeri  wrote:
>
> Hey ML,
>
> I asked a similar question on the Music Practice & Theory Stack Exchange 
> site, and I was told that the idea of changing clef automatically is - in 
> most cases - a bad idea, at least musically/practically speaking. 
> Nevertheless, I would like to ask for pointers as to how to accomplish this 
> with pre-existing LilyPond capabilities or just try to implement it myself -- 
> I am not at all familiar with the codebase.
>
> The ideal situation would be that there's some kind of \clefAutoChange or 
> similar command, and a mechanism to override the changing points would also 
> be provided. This also needs to work for \transpose'd music. For example, a 
> cellist told me that when there's a passage that lingers long enough above E1 
> (but not too much above A1 or so), the music is usually written with the 
> tenor clef. A similar rule (of thumb) applies to viola music and its use of 
> the treble clef, bassoon music etc.
>
> Any pointers or thoughts on this?

You might get some inspiration from http://lsr.di.unimi.it/LSR/Item?id=773.

-David

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


Re: Making slurs more visible

2018-08-10 Thread David Nalesnik
On Fri, Aug 10, 2018 at 6:05 PM Galen Menzel  wrote:

> However, I’m a bit baffled as to how I could have found this setting. The tie 
> internals page doesn’t list min-length as one of the members of tie’s details 
> alist.
>
> Where is this setting documented?
>
> Thanks again!
>
> Galen
>

You need to click on the various interface links at the bottom of the
page to see all of the properties theoretically supported.  Clicking
on "tie-interface" takes you to
http://lilypond.org/doc/v2.19/Documentation/internals/tie_002dinterface
where the property is listed.

Best,
David

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


Re: Lilypond & Halfdiminished/Diminished symbols.

2018-08-09 Thread David Nalesnik
This is a public forum.
On Thu, Aug 9, 2018 at 5:43 PM  wrote:
>
> Narcissism  unfortunately never shows anything else in tbe mirror. This
> post proves it. Go read all posts in chronological order and then tell
> me who started the vitriol. Your little stabs and bites for no reason
> just to get a reaction. Who do you think you are. Well now you get the
> reaction.
>
> Everyone on this particular post acted civil except you, so dont give me
> the yet again red lmeat lure. I had zero issues with any of the posters
> on this thread..go read.
>
> Do me a favor, if i post a new thread dont post in it. Neither will i
> post in yours. I promise that would go a long way at keeping things
> civil. Since you asked to keep things civil, i cannot agree more. Just
> stay away from me. I  dont need your code and your attached vitriol.
>
> On 2018-08-09 17:48, David Nalesnik wrote:
> > On Thu, Aug 9, 2018 at 4:19 PM  wrote:
> >>
> >> Congratulations,
> >> Whatever.
> >> Good luck.
> >
> > So much venom about drawing circles with slashes through them.
> >
> > You have made this the most unpleasant exchange I have ever taken part
> > in on this list.   I would invite you to be more civil in your future
> > interactions with this community.
> >
> > Thanks,
> > David Nalesnik
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user

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


Re: Lilypond & Halfdiminished/Diminished symbols.

2018-08-09 Thread David Nalesnik
On Thu, Aug 9, 2018 at 4:19 PM  wrote:
>
> Congratulations,
> Whatever.
> Good luck.

So much venom about drawing circles with slashes through them.

You have made this the most unpleasant exchange I have ever taken part
in on this list.   I would invite you to be more civil in your future
interactions with this community.

Thanks,
David Nalesnik

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


Re: Lilypond & Halfdiminished/Diminished symbols.

2018-08-09 Thread David Nalesnik
On Thu, Aug 9, 2018 at 2:14 PM  wrote:
>
> On 2018-08-09 14:32, ma...@masonhock.com wrote:
>
> > Neither of the snippets in this thread are under the GPL. Lilypond
> > itself is GPLv3, but LSR snippets are public domain and David's code
> > is MIT. If you are worried that you might be using the latter in an
> > objectional way, David N is the one you should talk to, although as
> > David K pointed out you are unlikely to be sued over copyright here.
> >
> > Also, not that it matters in this context, I don't think that the GPL
> > requires you to return your modifications to the original author. I
> > suggest reading more[2][3][4] about this license.
> >
>
> As mentioned I dont care about David's code, I will start from scratch
> from the snippet.
> I appreciate the link it is very helpful thank you.
> I have to taylor it my way and extend it as needed.
> You are right, the snippet is public domain and I rather follow that
> path than getting involved in mysterious MIT licenses.

The snippet, incidentally, is by me.

All the best,
David

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


Re: question about large-scale use of Pitch objects

2018-08-08 Thread David Nalesnik
On Wed, Aug 8, 2018 at 10:15 AM David Kastrup  wrote:
>
> David Nalesnik  writes:
>
> > Hi all,
> >
> > I'm working with very large Scheme lists of pitches in an ly file,
> > transforming them, and passing them about from function to function.
> > Right now, I'm using actual Pitch objects (such as you would produce
> > with ly:make-pitch).  Would it be a better idea to work with pitches
> > simply as number lists--for example, (0 0 0) for middle C--and
> > instantiate the pitches only at the end when I'm ready for
> > typesetting?
>
> No?
>
> > This would of course require writing Scheme versions of
> > ly:pitch-transpose, ly:pitch-diff, and the like.
> >
> > This may be a "try it and see" type of question, but I thought I would
> > ask before I embark on such a major revision of my work.
>
> Pitches as a data structure contain one allocation.  In contrast, a list
> contains one allocation for each element (short of immediate SCM data
> types which small integers are) and one allocation for its containing
> cons cell each.  Those allocations are of a "more standard" size but I
> doubt that will make all that much of a difference.
>
> So I suspect that you are likely to end up worse than what you started
> with.
>

Thank you, David, for your explanation.  This will save me quite a bit
of wasted effort.

David N.

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


question about large-scale use of Pitch objects

2018-08-08 Thread David Nalesnik
Hi all,

I'm working with very large Scheme lists of pitches in an ly file,
transforming them, and passing them about from function to function.
Right now, I'm using actual Pitch objects (such as you would produce
with ly:make-pitch).  Would it be a better idea to work with pitches
simply as number lists--for example, (0 0 0) for middle C--and
instantiate the pitches only at the end when I'm ready for
typesetting?  This would of course require writing Scheme versions of
ly:pitch-transpose, ly:pitch-diff, and the like.

This may be a "try it and see" type of question, but I thought I would
ask before I embark on such a major revision of my work.

Best,
David

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


Re: Lilypond & Halfdiminished/Diminished symbols.

2018-08-07 Thread David Nalesnik
On Tue, Aug 7, 2018 at 12:12 PM David Nalesnik  wrote:

> Good grief :(   I selected the MIT license because it's very common,
> and in the spirit of, as you write, "feel
> free to use it, I don't care."
>
> Seems I'm not the only one--I read this in the openlilylib repo
> (https://github.com/openlilylib/snippets/blob/master/LICENSE):
>
> "Since most of the snippets are separate entities,
> they can be licensed individially.
> There are no official rules on licensing (yet);
> We suggest that unless otherwise specified
> everything should be licensed under the MIT license
> as found at http://opensource.org/licenses/MIT.
> Any content of this repository that isn't explicitly
> licensed is implicitly licensed under the rules of
> this MIT license."
>
> Best,
> David N

And LilyBin: https://github.com/LilyBin/LilyBin/blob/master/LICENSE

DN

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


Re: Lilypond & Halfdiminished/Diminished symbols.

2018-08-07 Thread David Nalesnik
> On 2018-08-07 04:03, David Kastrup wrote:
> > ma...@masonhock.com writes:
> >
> >> Then it's a good thing that David shared his code as free (as in
> >> freedom[1]) software, so that it can be modified for your unique use
> >> case.
> >
> > What's relevant for this is mostly "in source of an interpreted
> > language", since modifying and using code given to you for your own
> > private use tends to be allowed by most copyright jurisdiction.  The
> > freedom of the GPL kicks in when you want to _share_ your modifications
> > with others, for discussion, for integration into LilyPond, or for
> > other
> > purposes.
> >
> >> The modified file is attached, and example usage is below.
> >
> > Well, that kind of thing (_you_ modifying the copy and reposting on the
> > list) definitely requires the actual freedom of the code.
> >
> > So what are the original terms?  Looking at David's original GitHub
> > page, I see "MIT license".  The terms of the MIT license are quite
> > permissive but contain
> >
> > The above copyright notice and this permission notice shall be
> > included in all copies or substantial portions of the Software.
> >
> > which hasn't happened here.  So you are in breach of the license and
> > the
> > reference to "freedom" is a red herring.  What's really involved here
> > is
> > that David is a nice guy unlikely to sue people reusing his code and
> > you
> > are relying on that.  Now of course the _spirit_ of the license is
> > "feel
> > free to use it, I don't care" so that assumption is likely pretty good
> > but that does not save you against David having a really bad day.
> >
> > And when talking about licenses, really bad days are what they are good
> > for.  A really bad day may involve bankruptcy and all your private
> > assets being acquired by Microsoft.  That kind of thing often involves
> > a
> > substantial change of mind of the new copyright owner.
> >
> > A license, as opposed to relying on people to stay nice, also protects
> > you against such worst case scenarios.
> >
> > Also many (but not necessarily all) code pieces from David may be
> > substantially derived from LilyPond code code licensed under the GPL.
> > In that case, the derived code cannot be licensed under different
> > conditions without being, in turn, in violation of the code it made use
> > of.

Good grief :(   I selected the MIT license because it's very common,
and in the spirit of, as you write, "feel
free to use it, I don't care."

Seems I'm not the only one--I read this in the openlilylib repo
(https://github.com/openlilylib/snippets/blob/master/LICENSE):

"Since most of the snippets are separate entities,
they can be licensed individially.
There are no official rules on licensing (yet);
We suggest that unless otherwise specified
everything should be licensed under the MIT license
as found at http://opensource.org/licenses/MIT.
Any content of this repository that isn't explicitly
licensed is implicitly licensed under the rules of
this MIT license."

Best,
David N

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


Re: Lilypond & Halfdiminished/Diminished symbols.

2018-08-06 Thread David Nalesnik
On Mon, Aug 6, 2018 at 10:42 PM  wrote:
>
> Righteo..that is the way Unix work.
>
> If you complain, then fix it yourself.

Not going there.

>
> However, I did not complain, just pointed out that programming the
> "general case" is always preferable and the prudent way.
>

I think you are misunderstanding what the code is designed for.  It's
not meant to give you LaTex-like control, rather to eliminate the
tedious complexities of creating symbols in wide use in a narrow
context.

Your intentions as they have become clearer over the thread don't
match.  (I did tell you how you can easily enlarge the symbols, but
that could quickly become tiresome.)  But perhaps there's something in
the code that you can use towards your own goals.  Like, for example,
the routines for drawing the diminished and half-diminished circles.
Like parsing input.  Whatever.

If you provide a code sample, more than likely there is someone who
will help you further.

Best,
David

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


Re: Lilypond & Halfdiminished/Diminished symbols.

2018-08-06 Thread David Nalesnik
On Mon, Aug 6, 2018 at 9:01 PM  wrote:
>
> Sure, but from a programming point of view it is better to have all
> characters the same size, then if in the exponent or subscript then
> shrink them. That way you treat all characters equally and this question
> as an example cannot arise. Just good principle.

>
> It is my personal choice to use it like that regardless of what the
> Conservatoire requires.
> I sometime need the half diminished and diminished as the only
> character, and it is not nice to squint to see them.
>

The tool is designed to produce what the "Conservatoire requires" with
a minimum of fuss, and it has saved me countless hours over the years.
You mention programming--perhaps you can tailor it to your own use.

David

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


Re: Lilypond & Halfdiminished/Diminished symbols.

2018-08-06 Thread David Nalesnik
On Mon, Aug 6, 2018 at 6:40 PM  wrote:
>
> One last question,
>
> On Mason's insistence I used the other option
> "roman_numeral_analysis_tool". I got it to work, but there were clashes
> with some of my other includes, so I have to make some changes to avoid
> clashes. Anyway that is my problem.
>
> Is there any way to make the half-diminished symbol larger using
> \markup \rN {h}
> I know I can scale it probably with lilypond tricks, but is there any
> built in scaling for the roman_numeral_analysis_tool in the unit ?
>
> Sort of along the LaTeX \large \Large commands that can precede any
> symbol.
> When using the half-diminished symbol diatonically it is not necessary
> to add the Roman Numeral scale-degree and only use the half-diminished
> symbol and reduce clutter. In this case, it is microscopic small and is
> seemingly by default scaled for exponent use.
>
> It would be better to have the symbol standard size like the capitalized
> Roman numerals and have a lower case function and then as in LaTeX once
> you use it for an exponent it is scaled to the smaller exponent size.
>
> As is, it is microscopic to use on its own.
> So how do I get it to Standard capital Roman Numeral and lower case
> numeral size and not by default exponent size as the case is now ?
>

Hi,

In the annotation style this tool attempts to emulate (any number of
US undergrad theory texts: Kostka & Payne, Clendinning, etc.), the
half-diminished symbol never appears without some sort of
bass-position symbol: "7," "65," etc.  I've also never seen it (or the
diminished symbol) as anything but small, whether accompanied by a
Roman numeral or not.  Hence its superscript sizing.

In any case, you can magnify it like so (from the README):

"Another way to scale a single numeral would be within the actual
markup command invocation:

\markup \override #'(font-size . 2) \rN { ... }
"

It may be that the tool can be customized to your use, if you provide
a comprehensive example of what you want it to do.

Best,
David

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


Re: Lilypond & Halfdiminished/Diminished symbols.

2018-08-06 Thread David Nalesnik
On Mon, Aug 6, 2018 at 3:39 PM Karlin High  wrote:
>
> On 8/6/2018 3:20 PM, liebre...@grossmann-venter.com wrote:
> > You dont have pdf versions of the examples available ?
> > I dont want to go through the process of installing a package and then
> > find it is not what I need.
> > Might be a good idea to include pdf versions with the source at this
> > address so others can quickly decide whether it is what they want.
>
> In that case, pasting the example into lilybin.com might be helpful. The
> include-files do complicate this a little, though. Here's what I got:
>
> 
>

It would be nice if there were a way to minify/uglify LilyPond files
so they wouldn't take up so much room at lilybin!  Does anyone have
something like that?

David

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


Re: Lilypond & Halfdiminished/Diminished symbols.

2018-08-06 Thread David Nalesnik
On Mon, Aug 6, 2018 at 3:33 PM  wrote:
>
> Oh well yours look really great, I hope David's  covers all the Analysis
> symbols, but there is no way to know unless I install it.
>
>
>
> On 2018-08-06 15:56, ma...@masonhock.com wrote:
> > On 08/06, liebre...@grossmann-venter.com wrote:
> >> Where can I find the complete Symbol list?
> >> Your post basically solved my problem, but I could not find a complete
> >> list
> >> in the Lilypond Manual for Analysis.
> >
> > The snippet is not part of Lilypond itself, so it might not be
> > documented in the manual, but the symbols are listed in the comments
> > at the top of the snippet. However, David's version looks better. It's
> > what I'll be using from now on.
> >

While a PDF would be a good idea (this was brought up to me by a user
of another package), it's really simple to get this running.  Easiest
way: cut and paste the contents of an example file, save it as
something.  Copy and paste "lilypond-roman-numeral-tool.ily" in that
file where the \include line is.  No need for cloning the repo or
installing anything.

David

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


Re: Lilypond & Halfdiminished/Diminished symbols.

2018-08-06 Thread David Nalesnik
On Mon, Aug 6, 2018 at 11:50 AM  wrote:
>
> On 08/06, liebre...@grossmann-venter.com wrote:
> > What I need is how to place  the Diminished symbol as text (the \emptyset
> > symbol in LaTeX) above the staff for progressions. Similar problem would be
> > how to indicate the Classical Inversion symbols above the staff.
>
> Is this snippet similar to what you're going for?
>
> http://lsr.di.unimi.it/LSR/Item?id=710
>

Speaking of this snippet, I'll point you to the vastly reworked version here:
https://github.com/davidnalesnik/lilypond-roman-numeral-tool

(The diminished and half-diminished symbols are drawn from scratch,
which may not be what you want.)

Best,
David

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


Re: layout of markup text

2018-07-23 Thread David Nalesnik
Hi Peter,

You might find this helpful:
https://github.com/davidnalesnik/lilypond-text-spanner-inner-texts

Best,
David
On Mon, Jul 23, 2018 at 5:29 AM Peter Gentry
 wrote:
>
> Thanks
>
> “text centered in spanners” is the search text I was missing…
>
>
>
> From: Andrew Bernard 
> Sent: 23 July 2018 11:23
> To: Peter Gentry 
> Cc: lilypond-user Mailinglist 
> Subject: Re: layout of markup text
>
>
>
> Hi Peter,
>
>
>
> There's a large discussion of text centered in spanners in the archives of 
> this list, and lots of code contributions by the learned colleagues herein. 
> Have a search. I have a Scheme solution but I think others have better than 
> mine.
>
>
>
> Andrew
>
>
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user

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


Re: Tweaking Hairpin shape

2018-02-11 Thread David Nalesnik
Hi Stefano,

On Sun, Feb 11, 2018 at 3:44 PM, Stefano Troncaro
 wrote:
> I managed to fix it. The problem was not with the calculation of the angle,
> it was with the translation of the angle to the offset that the function
> applies to the vertical placement of the end-points of the hairpins. It is
> correct now.
>
> I also got rid of the rotation of the stencil for the case where the
> straight end-points are not needed, the coordinates of the end-points for
> the different cases are all calculated now.
>
> As far as I can tell this is done. Finally!
>
> I got the alists working now. I can't reproduce the problems I had earlier,
> and the error message was weird and I don't remember it. But I guess that's
> not important anymore.
>
> I'm not sure I understood the following:
>>
>> But the spanner is cloned for each broken segment, so you aren't
>> actually comparing
>> with the initial bit.  Each new segment is simply drawn with a stencil
>> reflecting its
>> position within the whole.
>
>
> By reading the code that creates the hairpin stencils I got the idea that
> after line breaks are calculated, hairpins get broken into smaller hairpins
> that are related to each other. And when drawing the stencils, if these
> relationships are found, then they are drawn differently (they can start and
> end in 1/3rd or 2/3rds of the height depending on the situation). If what
> I'm saying is redundant with what you are saying, as I think it is, then I
> probably did a poor job of explaining myself in my last message.

When lines are broken the original Hairpin is copied to create a
Hairpin for each line.  The stencil function is applied separately to
each of these new Hairpin grobs.  It draws them with various openings
(or closings) based on the position of the spanner bounds it finds for
each: mid-line, start of line, end of line.  The spanner bound will
be, for example, a NonMusicalPaperColumn at a line break; the function
ly:item-break-dir applied to that bounding grob returns -1, 0, or
1--directions which have always left me confused.  The print function
simply looks at the bounds (and whether we have a crescendo or
decrescendo) to determine the shape, not at whether part of the
hairpin is the first piece, a middle piece, or the ending piece.

All this is super interesting, of course, but has no bearing on the
subject and I should have read what you wrote more carefully!

> English is
> not my native language and I struggle to be clear and concise with technical
> topics such as these. I apologize for the difficulties in communication that
> surely arise because of this.
>

No, your English is fine!  As I say, it's my reading comprehension
that leaves something to be desired :)

>
> I can now very comfortably get the hairpins I wanted, and I learned a lot of
> useful things in the process. I know I said it many times already but I'm
> truly grateful for your help! I never would have been able to reach a
> satisfying solution without it.
>

My pleasure!

David

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


Re: Tweaking Hairpin shape

2018-02-10 Thread David Nalesnik
Hi Stefano,

On Sat, Feb 10, 2018 at 11:14 AM, Stefano Troncaro
 wrote:
> Hi David, thank you for your suggestions, this is almost done!
>
> I decided to pass an alist to the function instead of changing the amount of
> arguments based on the procedure name, mainly because if I write more angle
> functions in the future I want to be able to do so without having to temper
> with the stencil definition. That is however a useful idea that I would have
> never thought about, and I may find it useful in the future.
>
> I have a few doubts if you don't mind.
>
> 1) At first I couldn't make the alist approach work because for some reason
> I can't define one in a let or let* block. Do you know why? I googled and I
> couldn't find an explanation.
>
> 2) Is there a way to define an alist different than a succession of acons? I
> thought I would be able to create it with a syntax like '((k1 . v1) (k2 .
> v2) ... etc) but in the end I had to settle for (acons k1 v1 (acons k2 v2
> ... (acons kn vn '(.

Not sure what you could have been doing wrong, but there are two ways you could
define the alist

(list (cons 'grob grob) (cons 'width width) (cons 'starth starth)
(cons 'endh endh))

or through quasi-quoting:

 `((grob . ,grob) (width . ,width) (starth . ,starth) (endh . ,endh))


> 3) I made the following function to make it so that the upper line of the
> hairpin runs parallel with the staff lines. It does so by finding the angle
> that is formed between the "zero-point" of the hairpin (the point where it
> begins to open) and the ending point of the higher hairpin line, that is in
> (width, height). The function takes into account that the lines of hairpins
> that go through a system break have different starting and ending heights,
> this is called "adjusted height" here.

But the spanner is cloned for each broken segment, so you aren't
actually comparing
with the initial bit.  Each new segment is simply drawn with a stencil
reflecting its
position within the whole.

With all this in mind, the function
> finds the angle of the upper line of the hairpin, and returns the negative
> of that angle, which ideally would result in that angle being 0 degrees,
> making it so that the upper line is parallel to the staff. But the end
> result is slightly off (see image). I don't know if the math is wrong or if
> this problem arises from rounding differences. If it is the later I may need
> to formulate another approach entirely. Any insight on this?

I noticed this.  I'm not great with trig, so I'm not seeing right away
how to approach this
by rotating the hairpin.  But why rotate it in the first place?  You
simply want the top or
bottom line--you also need to consider if the hairpin is above the
staff--to be horizontal.  So
create a property 'follow-staff or something and, when set, draw a
straight line for one of the two lines
which are joined to create the hairpin, instead of two lines which
split the opening width.

>
> Thank you for all the help!!

You're very welcome!

David

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


Re: Left align first note of every system with its lyric

2018-02-09 Thread David Nalesnik
Hi Benjamin,

On Fri, Feb 9, 2018 at 7:43 PM, Benjamin Bloomfield  wrote:
> I've been trying to figure out a way to force left-alignment
> (LyricText.self-alignment-X = -1) on just the lyrics associated with the
> first notes of every system, but I haven't been able to get it working.
> What I was trying was overriding LyricText.after-line-breaking with a
> callback function to set self-alignment-X if it came immediately after a
> line break.
>
> However, this isn't working.  Does anyone have some idea of a way to achieve
> this?
>
> Thanks,
>
> Benjamin Bloomfield
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>

Maybe the following thread will help:
https://lists.gnu.org/archive/html/lilypond-user/2013-05/msg00609.html

-David

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


Re: Tweaking Hairpin shape

2018-02-08 Thread David Nalesnik
Hi Stefano,

On Thu, Feb 8, 2018 at 4:43 PM, Stefano Troncaro
 wrote:
> Hello again!
>
> I managed to modify David's translation of ly:hairpin::print to have it use
> two properties, Hairpin.rotate and Hairpin.straight-end, to achieve almost
> all the results I wanted.

Glad you got some use out of this!  I like the look of the
straight-edged hairpins.

>
> The idea is that Hairpin.rotate can be either a numerical value,
> representing the angle of rotation, or a procedure that returns the angle of
> rotation. In one of the examples I used the function discussed earlier in
> this thread to have it automatically detect the angle of a beam. However, I
> can't manage to make this idea work when the procedure given to
> Hairpin.rotate requires more than one variable. This is very inconvenient
> because for some cases the procedure would need to calculate again a lot of
> things that are already calculated in the process of making the stencil.

First of all, calling ly:grob-property calls any procedure the
property is set to.  The function ly:grob-property-data won't.

I don't know of any way in Scheme to overload functions or to count
arguments.  If you name your function, however, you can use
procedure-name.  (See the attached.)

HTH,
David
\version "2.19.80"

#(define (proc-number-or-false? obj)
   (or (procedure? obj)
   (number? obj)
   (eq? obj #f)))

#(define (define-grob-property symbol type? description)
   (if (not (equal? (object-property symbol 'backend-doc) #f))
   (ly:error (_ "symbol ~S redefined") symbol))

   (set-object-property! symbol 'backend-type? type?)
   (set-object-property! symbol 'backend-doc description)
   symbol)

#(map
  (lambda (x)
(apply define-grob-property x))

  `(
 (circled-tip-radius ,number? "Radius for hairpin circled tip")
 (rotate ,proc-number-or-false? "Custom rotation: a number specifies angle in degrees, a procedure will receive the grob and return an angle, #f deactivates rotation")
 (straight-end ,boolean? "Straighten the end of the hairpin when it's rotated?")
 ))


#(define broken-neighbor
   (lambda (grob)
 (let* ((pieces (ly:spanner-broken-into (ly:grob-original grob)))
(me-list (member grob pieces)))
   (if (> (length me-list) 1)
   (cadr me-list)
   '()

#(define (interval-dir-set i val dir)
   (cond ((= dir LEFT) (set-car! i val))
 ((= dir RIGHT) (set-cdr! i val))
 (else (ly:error "dir must be LEFT or RIGHT"

#(define (other-dir dir) (- dir))

#(define hairpin::print-scheme
   (lambda (grob)
 (let ((grow-dir (ly:grob-property grob 'grow-direction)))
   (if (not (ly:dir? grow-dir))
   (begin
(ly:grob-suicide! grob)
'()))

   (let* ((padding (ly:grob-property grob 'bound-padding 0.5))
  (bounds (cons (ly:spanner-bound grob LEFT)
(ly:spanner-bound grob RIGHT)))
  (broken (cons
   (not (= (ly:item-break-dir (car bounds)) CENTER))
   (not (= (ly:item-break-dir (cdr bounds)) CENTER)

 (if (cdr broken)
 (let ((next (broken-neighbor grob)))
   (if (ly:spanner? next)
   (begin
(ly:grob-property next 'after-line-breaking)
(set-cdr! broken (grob::is-live? next)))
   (set-cdr! broken #f

 (let* ((common
 (ly:grob-common-refpoint (car bounds) (cdr bounds) X))
(x-points (cons 0 0))
(circled-tip (ly:grob-property grob 'circled-tip))
(height (* (ly:grob-property grob 'height 0.2)
  (ly:staff-symbol-staff-space grob)))
(rad (ly:grob-property grob 'circled-tip-radius (* 0.525 height)))
(thick (* (ly:grob-property grob 'thickness 1.0)
 (ly:staff-symbol-line-thickness grob

   (define (inner dir)
 (let* ((b (interval-bound bounds dir))
(e (ly:generic-bound-extent b common)))
   (interval-dir-set
x-points (ly:grob-relative-coordinate b common X) dir)

   (if (interval-bound broken dir)
   (if (= dir LEFT)
   (interval-dir-set
x-points (interval-bound e (other-dir dir)) dir)
   (let* ((broken-bound-padding
   (ly:grob-property grob 'broken-bound-padding 0.0))
  (chp (ly:grob-object grob 'concurrent-hairpins)))
 (let loop ((i 0))
   (if (and (ly:grob-array? chp)
(< i (ly:grob-array-length chp)))
   (let ((span-elt (ly:grob-array-ref chp i)))
 (if (= (ly:item-break-dir (ly:spanner-bound span-elt RIGHT))
LEFT)

Re: Tweaking Hairpin shape

2018-02-06 Thread David Nalesnik
Hi Stefano,


On Mon, Feb 5, 2018 at 11:53 PM, Stefano Troncaro
 wrote:
> David and Harm, I'm really impressed by the level of expertise you both have
> showed in this thread. The function works wonderfully, and I'm really
> grateful for your help!
>
> I feel kind of bad for asking, but I'm stuck after trying to do what I
> thought would be a minor tweak. I wanted to make it so that the two lines
> that form the hairpin would end in the same vertical line, since when the
> hairpin is rotated the end-points of the two lines are displaced. I tried
> achieve this by drawing a white box that overlaps with the line that
> overextends, therefore "deleting" the excess.
>
> While I could not always place the box correctly, due to how
> ly:stencil-stack works (I don't explain this further because of the
> following), the real problem I found is that even when the box is properly
> placed, the shortened line looks off. This is because Lilypond naturally
> makes line endings smooth, so the "cut the excess with a box" approach
> creates a hairpin with one line ending smoothly and the other ending
> harshly. This is less evident for thinner lines but is easy to see with
> thicker ones. Another flaw of this approach is that the white box reserves
> unused space.
>
> So, with that in mind, I wonder: is there a way to smoothen the line after
> "cutting" it (which I doubt) or, lacking that, is there a way to access only
> one line of the hairpin to shorten it by the necessary amount? The later I
> imagine like a Hairpin.shorten-pair that affects only one of the two lines.
> Alternatively, is it more sensible to just draw the two lines and stack them
> into a stencil? I have not yet tried this but the more I think about it the
> more it looks like the most viable option. I tried to search the definition
> of ly:hairpin::print to see how Lilypond does this, but I couldn't find it.

At this point I think you would get the best results by rewriting
ly:hairpin::print from scratch so that it has the existing
functionality with your enhancements worked in.

At some point I translated the function from C++ into Scheme for some
experimentation.  It's fairly direct.  I found a version of this where
I left the original C++ code inlined as comments
(add-shorten-pair.ly).

I used this as a preliminary to adding 'shorten-pair directly into the
C++ code, and I don't remember if I made improvements to the codebase
along the way...

Hopefully, you can make use of it!

I also located a file which shows what you can do from scratch: here
adjusting the size of the circle in the circled tip (not with
shorten-pair here...)  FWIW.

Hope this helps...

David
\version "2.19.23"

#(define broken-right-neighbor
   (lambda (grob)
 (let* ((pieces (ly:spanner-broken-into (ly:grob-original grob)))
(me-list (member grob pieces)))
   (if (> (length me-list) 1)
   (cadr me-list)
   '()

#(define (interval-dir-set i val dir)
   (cond ((= dir LEFT) (set-car! i val))
 ((= dir RIGHT) (set-cdr! i val))
 (else (ly:error "dir must be LEFT or RIGHT"

#(define (other-dir dir) (- dir))

%{
;; C++ is from lily/hairpin.cc
;;
;; MAKE_SCHEME_CALLBACK (Hairpin, print, 1);
;; SCM
;; Hairpin::print (SCM smob)
;; {
;;   Spanner *me = unsmob (smob);
%}

#(define hairpin::print-scheme
   (lambda (grob)

;;   SCM s = me->get_property ("grow-direction");

 (let ((grow-dir (ly:grob-property grob 'grow-direction)))

;;   if (!is_direction (s))
;; {
;;   me->suicide ();
;;   return SCM_EOL;
;; }

   (if (not (ly:dir? grow-dir))
   (begin
(ly:grob-suicide! grob)
'())

;;   Direction grow_dir = to_dir (s);
;;   Real padding = robust_scm2double (me->get_property ("bound-padding"), 0.5);
;;
;;   Drul_array broken;
;;   Drul_array bounds;
;;   for (LEFT_and_RIGHT (d))
;; {
;;   bounds[d] = me->get_bound (d);
;;   broken[d] = bounds[d]->break_status_dir () != CENTER;
;; }

   (let* ((padding (ly:grob-property grob 'bound-padding 0.5))
  (bounds (cons (ly:spanner-bound grob LEFT)
(ly:spanner-bound grob RIGHT)))
  (broken (cons
   (not (= (ly:item-break-dir (car bounds)) CENTER))
   (not (= (ly:item-break-dir (cdr bounds)) CENTER)

;;   if (broken[RIGHT])
;; {
;;   Spanner *next = me->broken_neighbor (RIGHT);
;;   // Hairpin-parts suicide in after-line-breaking if they need not be drawn
;;   if (next)
;; {
;;   (void) next->get_property ("after-line-breaking");
;;   broken[RIGHT] = next->is_live ();
;; }
;;   else
;; broken[RIGHT] = false;
;; }

 (if (cdr broken)
 (let ((next (broken-right-neighbor grob)))
   (if (ly:spanner? next)
   (begin
(ly:grob-property next 'after-line-breaking)
  

Re: Tweaking Hairpin shape

2018-02-04 Thread David Nalesnik
Hi Harm,

On Sun, Feb 4, 2018 at 6:23 PM, Thomas Morley  wrote:
> Hi David,
>
> I was going to post something similiar.
> You're code is much more elegant with respect to linebreaks, great stuff.
> Though, it will not work as desired if the beam/hairpin is distributed
> over _three_ lines.
> I've no clue how to make it work, admittedly it's a real rare case.

Yeah, that thought occurred to me after I sent it, though I figured no
one would notice :)

Thanks so much for the improvements!  I'm sure I will find another
opportunity to use ly:angle.

Here is a possibility for multiple line spanners incorporating your changes:

\version "2.19.65"

#(define test
   (lambda (grob)
 (let* ((lb (ly:spanner-bound grob LEFT))
(rb (ly:spanner-bound grob RIGHT))
(stil (ly:hairpin::print grob))
(bound
 (find (lambda (b)
 (grob::has-interface b 'note-column-interface))
   (list lb rb)))
(beam
 (if bound
 (ly:grob-object (ly:grob-object bound 'stem) 'beam)
 (let* ((col (ly:item-get-column lb))
(elts (ly:grob-array->list
   (ly:grob-object col 'bounded-by-me
   (find (lambda (e) (grob::has-interface e 'beam-interface))
 elts)
   (if (ly:grob? beam)
   (let* ((X-pos (ly:grob-property beam 'X-positions))
  (Y-pos (ly:grob-property beam 'positions))
  (ang (ly:angle (- (cdr X-pos) (car X-pos))
 (- (cdr Y-pos) (car Y-pos)
 (ly:stencil-rotate
  stil ang CENTER CENTER))
   stil

{
  \time 1/4 \override Hairpin.stencil = #test
  c'16\< e' g' b'\!
  b'16\< g' e' c'\!
  \once \offset positions #'(0 . 3) Beam
  c'16^\< e' g' b'\!

  \override Beam.breakable = ##t
  c'16[\< e' g' b'
  \break c' e' g' b'
  \break b' g' e' c'
  \break b' g' e' c']\!
}

-David

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


Re: Tweaking Hairpin shape

2018-02-04 Thread David Nalesnik
Hi Stefano,

On Sun, Feb 4, 2018 at 4:09 PM, Stefano Troncaro
 wrote:
> Harm, I've been thinking about this, and perhaps you have an idea of how the
> following can be achieved.
>
> A consequence of explicitly stating the degree in which the stencil has to
> be rotated is that if anything changes the spacing of that system it's very
> likely that the degree of rotation will have to be manually tweaked. I was
> thinking on how to achieve an "automatic" solution. I imagine that this
> could be done by establishing two points of reference. In this example any
> two points running along the Beam would serve, although the ending points of
> two of the Stems would work just as well.
>
> But all this assumes that every object has a distinct name/ID/whatever, like
> a pointer to it which allows to recover information on it, or at least that
> one can be given. Do you know if this is possible?
>

Within a callback for Hairpin.stencil, you can get to the Beam grob by
following pointers from the spanner bounds of the Hairpin.  You can
then calculate the Beam's slope and use that information to rotate the
Hairpin stencil.

\version "2.19.65"

#(define test
   (lambda (grob)
 (let* ((lb (ly:spanner-bound grob LEFT))
(rb (ly:spanner-bound grob RIGHT))
(stil (ly:hairpin::print grob))
(bound
 (find (lambda (b)
 (grob::has-interface b 'note-column-interface))
   (list lb rb
   (if (ly:grob? bound)
   (let* ((stem (ly:grob-object bound 'stem))
  (beam (ly:grob-object stem 'beam)))
 (if (ly:grob? beam)
 (let* ((X-pos (ly:grob-property beam 'X-positions))
(Y-pos (ly:grob-property beam 'positions))
(ang (atan (- (cdr Y-pos) (car Y-pos))
   (- (cdr X-pos) (car X-pos)
   (ly:stencil-rotate
stil (* ang (/ 180 PI)) CENTER CENTER))
 stil))
   stil

{
  \override Hairpin.stencil = #test
  c'16\< e' g' b'\!
  b'16\< g' e' c'\!
  \once \offset positions #'(0 . 3) Beam
  c'16^\< e' g' b'\!
  \override Beam.breakable = ##t
  c'8[\< e' \break g' b']\!
}

Hope this gets you started...

David

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


Re: Shape slurs from inside chords

2018-01-31 Thread David Nalesnik
On Wed, Jan 31, 2018 at 8:58 AM, Knute Snortum  wrote:
> Is it possible to shape a slur that goes from one note in a chord to another
> note in another chord, or do I have to create the slur from "scratch" with
> tweak control-points?  For instance:
>
> \version "2.19.80"
> \language "english"
>
> {
>   \key g \minor
>   4 
> }
>
> I would like to shape the slur from the f-sharp to the g.  I have to shape a
> lot of these kinds of slurs, so I'd like to do it the most efficient way.
>

Sure:

{
  \key g \minor
  4 
}

-David

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


Re: A capo in a subtitle and in the names of instruments

2018-01-24 Thread David Nalesnik
On Wed, Jan 24, 2018 at 4:27 PM, Simon Albrecht  wrote:
> On 24.01.2018 23:15, Son_V wrote:
>>
>> But still I want to know how to put an "a capo" in a subtitle.
>
>
> I have no idea what you mean, sorry. Do you mean a segno?
> \markup \musicglyph #"scripts.coda"
>
>>   The trick for
>> the instruments don't work, the second line do not appear.
>
>
> Then you mistyped something. Tiny examples help.
>
> Best, Simon
>

Possibly you want to use this line in the \with block?

shortInstrumentName = "A capo"

Though I confess I have never seen such a usage

What about "Sop. o Ten"? or some other abbreviation?

David

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


Re: A capo in a subtitle and in the names of instruments

2018-01-24 Thread David Nalesnik
Hi Vincenzo,

On Wed, Jan 24, 2018 at 3:06 PM, Son_V  wrote:
> Hi all,
> I would like to know what is in the subject.
> The subtitle is very long and I would like to put an A capo somewhere.
>
> For the names of instruments, the original score have for the voices
> "Soprani o Tenori" and "Contralti o Bassi".
>
> They are written in a long line.
>
> I would like to obtain something appearing like below:
>
> Soprani
> o Tenori
>
> and
>
> Contralti
> o Bassi
>
> centered with their pentagram.
>
> How can I obtain this?

Try this:

\new ChoirStaff <<
  \new Staff \with {
instrumentName = \markup \column { "Soprani" "o Tenori" }
  } {
s1
  }
  \new Staff \with {
instrumentName = \markup \column { "Contralti" "o Bassi" }
  } {
s1
  }
>>

Best,
David

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


Re: SVG output - Group multiple grobs together

2018-01-10 Thread David Nalesnik
Hi James,

On Wed, Jan 10, 2018 at 5:51 AM, James Opstad  wrote:
> Hello,
>
>
> I have been experimenting with the new output-attributes grob property for
> SVG output. For example, the following code creates a group with id="noteC"
> around the C notehead.
>
>
> \version "2.19.80"
> \pointAndClickOff
> \relative c' {
>   \once \override NoteHead.output-attributes = #'((id . noteC))
>   c4 d e f |
> }
>
> How would I include multiple grobs within the same group e.g. all the grobs
> associated with a single note (NoteHead, Stem, Accidental etc.)?
>

All grobs have pointers to other single grobs or arrays of other
grobs.  You gain access to these through such functions as
ly:grob-parent, ly:grob-object, ly:grob-array, ly:item-get-column.
The idea of "multiple grobs within the same group e.g. all the grobs
associated with a single note" can prove to be complex since your idea
of a grouping is not necesarily LilyPond's.  You may have to follow
chains of pointers--as I did below to arrive at the Stem grob from
NoteHead: i.e, through NoteColumn, the Y-parent of the NoteHead.

So here is something quickly hacked together from your code example:

\version "2.19.65"

\pointAndClickOff
\relative c' {
  \once \override NoteHead.output-attributes =
  #(lambda (grob)
 (let* ((acc (ly:grob-object grob 'accidental-grob))
(acc-name (if (ly:grob? acc) (grob::name acc) "none"))
; we need a NoteColumn object for access to other grobs
(nc (ly:grob-parent grob Y))
(stem (ly:grob-object nc 'stem))
(stem-name (if (ly:grob? stem) (grob::name stem) "none"))
(pc (ly:item-get-column grob))
(pc-name (if (ly:grob? pc) (grob::name pc) "none"))
(elts (ly:grob-object pc 'elements)))
   (display elts) ; just so you see a grob array
   (list
(cons 'id 'noteC)
(cons 'accidental acc-name)
(cons 'stem stem-name)
(cons 'column pc-name

  c4 d e f |
}

%%%

Here is a link to something you might find useful.  It stores data
about every grob encountered.

https://www.mail-archive.com/lilypond-user@gnu.org/msg117645.html

HTH,

David

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


Re: Two conflicting text spanners

2018-01-09 Thread David Nalesnik
Hi,

On Tue, Jan 9, 2018 at 10:31 AM, Kieren MacMillan
 wrote:
> Hi Neo,
>
>> I was afraid that without any instructions the code in that thread would 
>> fail,
>> but to my surprise it worked beautifully! Thank you!
>
> You're welcome. From what I understand, the code has some issues, but it 
> seemed like it would solve your use case.
>
>> I wonder why this isn't coded into LP itself or provided as a snippet
>> with the software or in some repository (or am I mistaken?)
>
> As far as I know, you're not mistaken: it's not in the codebase, nor provided 
> as a snippet. I would imagine the limitations (see the email thread) are a 
> sufficient obstacle to the functionality being considered for the main 
> codebase…

I'm sure there is a bug somewhere, but the problem reported in the
thread was solved later in the thread :)

and even if not, the path to getting a patch created, submitted,
reviewed, and accepted can be long and steep, and perhaps David N has
higher-priority ways he is applying his Lilypond-based time at the
moment.
>
> I believe there is general agreement that all spanners should support ids, 
> but there are evidently technical hurdles to making this happen.
>

My goal for the semester break is to get my measure-attached spanner
patch submitted.  I've been sitting on it for far too long.  With the
simultaneous spanners I'm not sure how I ought to proceed.  I thought
there was some GSoC work on spanner-ids, so I hesitate to work this
into the C++ code (as Thomas Morley proposed) and interfere somehow or
contribute something with very limited shelf life.  Really, I don't
know.  Does anyone know more about this subject?

David

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


Re: Generate Random Pitches and Accidentals?

2018-01-08 Thread David Nalesnik
On Mon, Jan 8, 2018 at 5:19 PM, David Nalesnik  wrote:
> Hi Josh,
>
> On Mon, Jan 8, 2018 at 4:34 PM, Joshua Nichols  
> wrote:
>> Hi! This is for education!
>>
>> On Jan 8, 2018 3:08 PM, "Karlin High"  wrote:
>>>
>>> On 1/8/2018 11:44 AM, Joshua Nichols wrote:
>>>>
>>>> I'm looking for a resource that can generate pitches at different
>>>> octaves, using different spellings, including accidentals.
>>>
>>>
>>> How will this be used? As an educational tool, perhaps? Describing the use
>>> case might get better help.
>>> --
>>> Karlin High
>>> Missouri, USA
>
> Here is a worksheet I created with answers and different pitch content
> every time you run it.  Perhaps you will find something useful in it.
>
> (Note: if you're running a development version, you can cut out the
> definition of the table command.  I included it so I could run
> this--and many other "auto" worksheets--using lilybin.
>

BTW,

I turned on the accidentals b/c you asked about them.  The point of
the exercise is better served by using the line

test = \questions 30 #(list 0)

instead of the definition of test in the file

(i.e, just white notes)

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


Re: Generate Random Pitches and Accidentals?

2018-01-08 Thread David Nalesnik
Hi Josh,

On Mon, Jan 8, 2018 at 4:34 PM, Joshua Nichols  wrote:
> Hi! This is for education!
>
> On Jan 8, 2018 3:08 PM, "Karlin High"  wrote:
>>
>> On 1/8/2018 11:44 AM, Joshua Nichols wrote:
>>>
>>> I'm looking for a resource that can generate pitches at different
>>> octaves, using different spellings, including accidentals.
>>
>>
>> How will this be used? As an educational tool, perhaps? Describing the use
>> case might get better help.
>> --
>> Karlin High
>> Missouri, USA

Here is a worksheet I created with answers and different pitch content
every time you run it.  Perhaps you will find something useful in it.

(Note: if you're running a development version, you can cut out the
definition of the table command.  I included it so I could run
this--and many other "auto" worksheets--using lilybin.

Hope this helps,
David
\version "2.18.2"

% This file generates a customizable number of random white note pitches
% for identification.  Answers can be displayed.

% The following function is copied from scm/define-markup-commands.scm.
% Not needed in newer versions of LilyPond.
#(define-markup-list-command (table layout props column-align lst)
   (number-list? markup-list?)
   #:properties ((padding 0)
 (baseline-skip))

   (define (split-lst initial-lst lngth result-lst)
 ;; split a list into a list of sublists of length lngth
 ;; eg. (split-lst '(1 2 3 4 5 6) 2 '())
 ;; -> ((1 2) (3 4) (5 6))
 (cond ((not (integer? (/ (length initial-lst) lngth)))
(ly:warning
 "Can't split list of length ~a into ~a parts, returning empty list"
 (length initial-lst) lngth)
'())
   ((null? initial-lst)
(reverse result-lst))
   (else
(split-lst
 (drop initial-lst lngth)
 lngth
 (cons (take initial-lst lngth) result-lst)

   (define (dists-list init padding lst)
 ;; Returns a list, where each element of `lst' is
 ;; added to the sum of the previous elements of `lst' plus padding.
 ;; `init' will be the first element of the resulting list. The addition
 ;; starts with the values of `init', `padding' and `(car lst)'.
 ;; eg. (dists-list 0.01 0.1 '(1 2 3 4)))
 ;; -> (0.01 1.11 3.21 6.31 10.41)
 (if (or (not (number? init))
 (not (number? padding))
 (not (number-list? lst)))
 (begin
  (ly:warning
   "not fitting argument for `dists-list', return empty lst ")
  '())
 (reverse
  (fold (lambda (elem rl) (cons (+ elem padding (car rl)) rl))
(list init)
lst

   (let* (;; get the number of columns
   (columns (length column-align))
   (init-stils (interpret-markup-list layout props lst))
   ;; If the given markup-list is the result of a markup-list call, their
   ;; length may not be easily predictable, thus we add point-stencils
   ;; to fill last row of the table.
   (rem (remainder (length init-stils) columns))
   (filled-stils
(if (zero? rem)
init-stils
(append init-stils (make-list (- columns rem) point-stencil
   ;; get the stencils in sublists of length `columns'
   (stils
(split-lst filled-stils columns '()))
   ;; procedure to return stencil-length
   ;; If it is nan, return 0
   (lengths-proc
(lambda (m)
  (let ((lngth (interval-length (ly:stencil-extent m X
(if (nan? lngth) 0 lngth
   ;; get the max width of each column in a list
   (columns-max-x-lengths
(map
 (lambda (x)
   (apply max 0
 (map
  lengths-proc
  (map (lambda (l) (list-ref l x)) stils
 (iota columns)))
   ;; create a list of (basic) distances, which each column should
   ;; moved, using `dists-list'. Some padding may be added.
   (dist-sequence
(dists-list 0 padding columns-max-x-lengths))
   ;; Get all stencils of a row, moved accurately to build columns.
   ;; If the items of a column are aligned other than left, we need to
   ;; move them to avoid collisions:
   ;; center aligned: move all items half the width of the widest item
   ;; right aligned: move all items the full width of the widest item.
   ;; Added to the default-offset calculated in `dist-sequence'.
   ;; `stencils-for-row-proc' needs four arguments:
   ;;stil- a stencil
   ;;dist- a numerical value as basic offset in X direction
   ;;column  - a numerical value for the column we're in
   ;;x-align - a numerical value how current column should be
   ;;  aligned, where (-1, 0, 1) means (LEFT, CENTER, RIGHT)
   (stencils-for-row-proc
(lambda 

Re: Change the text within a volta

2017-12-29 Thread David Nalesnik
Hi,

On Fri, Dec 29, 2017 at 12:16 PM, nokel81  wrote:
> I currently have the following:
>

I see nothing here.  Could you include a short code example?

Thanks,
David

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


Re: Function to add articulation to all notes

2017-12-28 Thread David Nalesnik
Hi,

On Thu, Dec 28, 2017 at 1:37 PM, Caagr98  wrote:
> That function seems rather destructive: removes all properties on existing 
> articulations (including tweaks, direction, and midi stuff), and doesn't seem 
> to handle anything other than ArticulationEvents at all. Dynamics, slurs, 
> ties, etc are removed. Also, this version has no way to exclude a note from 
> being articulated, unlike the earlier versions (where you can set 
> 'articulations to an empty list to exclude it).
>

OK, this will preserve what's already there:
addArticulation =
#(define-music-function (scripts music) (list? ly:music?)
   (define (add mus)
 (let* ((art (ly:music-property mus 'articulations))
(types (map (lambda (a) (ly:music-property a 'articulation-type))
 art)))
   (for-each
(lambda (x)
  (if (not (member x types))
  (ly:music-set-property! mus 'articulations
   (append! (ly:music-property mus 'articulations)
 (list (make-articulation x))
scripts)))
   (for-some-music
(lambda (mus)
  (cond
   ((music-is-of-type? mus 'event-chord) (add mus))
   ((music-is-of-type? mus 'note-event) (add mus))
   (else #f)))
music)
   music)

{
  \addArticulation #'("staccato" "accent") { c~ c ->\f d d' c'^! }
}

You'll note the wrong behavior at ties.  This could be fixed with a
bunch more code.  I should note in this connection that the original
definition of addArticulation which you inherited is flawed in regard
to ties::

{
  \addArticulation \accent { c~ c } % use original definition from top of thread
  \addArticulation \staccato { c~ c }
}

It would be helpful if you would provide a test example so we could
get an idea of what you want to work.

Thanks,
David

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


Re: Function to add articulation to all notes

2017-12-28 Thread David Nalesnik
On Thu, Dec 28, 2017 at 12:25 PM, David Nalesnik
 wrote:
> Hi Kieren,
>
> On Thu, Dec 28, 2017 at 11:29 AM, Kieren MacMillan
>  wrote:
>> Hi David,
>>
>>>> This works, but I'm guessing there's a better way:
>>
>> This is nice! Any way that it could take two (or more) articulations like
>>
>>   \addArticulation \tenuto \staccato { c  d c' }
>>
>> to avoid nesting or chaining like
>>
>>   \addArticulation \tenuto \addArticulation \staccato { c  d c' }
>>
>> which doesn't even work (of course, since the function won't add 
>> articulations if they already exist)?
>>
>
> Something like this?
>
> \version "2.19.65"
>
> addArticulation =
> #(define-music-function (scripts music) (list? ly:music?)
>(define (add mus)
>  (let* ((art (ly:music-property mus 'articulations))
> (types
>  (if (pair? art)
>  (map (lambda (a) (ly:music-property a 'articulation-type))
>art)
>  '()))
> (types (lset-union string=? types scripts)))
>(ly:music-set-property!
> mus 'articulations (map make-articulation types
>(for-some-music
> (lambda (mus)
>   (cond
>((music-is-of-type? mus 'event-chord) (add mus))
>((music-is-of-type? mus 'note-event) (add mus))
>(else #f)))
> music)
>music)
>
> {
>   \addArticulation #'("staccato" "accent") { c-. -> d c'-! }
> }
>
> it doesn't maintain direction of the specified articulations if they
> are already there, but I suppose something could be done about that.
>
> David

Replying to the list with removal of some redundant code:

\version "2.19.65"

addArticulation =
#(define-music-function (scripts music) (list? ly:music?)
   (define (add mus)
 (let* ((art (ly:music-property mus 'articulations))
(types (map (lambda (a) (ly:music-property a 'articulation-type))
 art))
(types (lset-union string=? types scripts)))
   (ly:music-set-property!
mus 'articulations (map make-articulation types
   (for-some-music
(lambda (mus)
  (cond
   ((music-is-of-type? mus 'event-chord) (add mus))
   ((music-is-of-type? mus 'note-event) (add mus))
   (else #f)))
music)
   music)

{
  \addArticulation #'("staccato" "accent") { c -> d c'-! }
}

HTH,
David

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


Re: Function to add articulation to all notes

2017-12-28 Thread David Nalesnik
On Thu, Dec 28, 2017 at 11:11 AM, David Nalesnik
 wrote:

>
> This works, but I'm guessing there's a better way:
>
> \version "2.19.65"
>
> addArticulation =
> #(define-music-function (event music) (ly:event? ly:music?)
>(define (add mus)
>  (if (not (memq 'articulations ; Don't add staccato if there
> already exist an articulation

(Make sure the above comment is on one line or add a semicolon to broken line.)

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


Re: Function to add articulation to all notes

2017-12-28 Thread David Nalesnik
Hi,

On Thu, Dec 28, 2017 at 10:23 AM, Caagr98  wrote:
> Sometimes when having a long section of staccato, it's a bit tedious to add 
> -. to all notes, so then it's useful to have a function which automatically 
> adds an articulation to all notes. I have one such function here:
>
> addArticulation =
> #(define-music-function (event music) (ly:event? ly:music?)
>(music-map
> (lambda (mus)
>  (if (music-is-of-type? mus 'note-event)
>   (if (not (memq 'articulations ; Don't add staccato if there already 
> exist an articulation
>  (map car (ly:music-mutable-properties mus
> (ly:music-set-property! mus 'articulations (list event
>  mus)
> music))
>
> However, this function adds the articulation to all notes in chords (leading 
> to multiple staccato dots), which is not what I want. Is there any better way 
> to do this?
>

This works, but I'm guessing there's a better way:

\version "2.19.65"

addArticulation =
#(define-music-function (event music) (ly:event? ly:music?)
   (define (add mus)
 (if (not (memq 'articulations ; Don't add staccato if there
already exist an articulation
(map car (ly:music-mutable-properties mus
 (ly:music-set-property! mus 'articulations (list event
   (for-some-music
(lambda (mus)
  (cond
   ((music-is-of-type? mus 'event-chord) (add mus))
   ((music-is-of-type? mus 'note-event) (add mus))
   (else #f)))
music)
   music)

{
  \addArticulation \staccato { c  d c' }
}

HTH,
David

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


Re: Rhythmic Excerpts with Breath Marks Above the Staff

2017-12-20 Thread David Nalesnik
Hi Reilly,

On Wed, Dec 20, 2017 at 11:56 AM, Reilly Farrell
 wrote:
> I'm seeking a way to create rhythmic examples, as in the sample code below,
> while positioning breath marks above the rhythmic staff rather than along
> the line. I thought ^\breathe might do the trick at first, but no dice. Any
> advice on how to properly accomplish this is deeply appreciated. Thank you!
>
>
> \version "2.18.2" \include "../../../lily-settings.ily" stuff = { \time 4/4
> } \new RhythmicStaff { c4 c4 c4 c4\breathe | c2 c2\breathe | c1 | } \include
> \compileRhythmSyllablesPath \end{lilypond}
>

Adjust to your liking:

\new RhythmicStaff {
  \override BreathingSign.Y-offset = 3
  c4 c4 c4 c4\breathe |
  c2 c2\breathe |
  c1 |
}

HTH,
David

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


Re: How to get the hairpin to the barline?

2017-11-03 Thread David Nalesnik
On Fri, Nov 3, 2017 at 12:27 PM, Pieter Terpstra
 wrote:
> Ben wrote:
>
>> *  \override Hairpin.shorten-pair = #'(0 . -5)*
>
> Thank you kindly Ben, this line is not accepted by version 2.18.2.

It was introduced at some point in the 2.19 cycle.

-DN

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


Re: spanner and epsfile

2017-11-02 Thread David Nalesnik
Harm,

On Wed, Nov 1, 2017 at 5:22 PM, Thomas Morley  wrote:
> 2017-11-01 23:11 GMT+01:00 David Nalesnik :
>> On Wed, Nov 1, 2017 at 2:27 PM, Thomas Morley  
>> wrote:
>>> 2017-11-01 4:21 GMT+01:00 Bernardo Barros :
>>>
>>>> I'm still trying to figure out my other question, how to have
>>>> inter-penetrating spanners, or rather, how to have one spanner parallel to
>>>> another without conflict?
>>>>
>>>> I can imagine two solutions:
>>>>
>>>> 1) Two or more voices, one with all notes hidden. Ugly solution.
>>>
>>> There's only one TextSpanner per Voice possible, so above is certainly
>>> a possibility
>>
>> Attached to the following is some code which will allow you to have
>> multiple TextSpanners per voice.  I haven't tried to apply it to your
>> use case, though.
>>
>> http://lists.gnu.org/archive/html/lilypond-user/2015-10/msg00551.html
>
> Hi David,
>
> nice one and cheaper than my own (no grob-creation).
> I must have missed it back in 2015.
>
> Would be nice to have it in the .cc-file.
> Any chance?

I could add it, yes.  My concern is that work was been done to make
'spanner-id work generally with spanners -- David Kastrup?  But if
that's a distant possibility, I would be happy to work it into a .cc
patch.

-David

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


Re: spanner and epsfile

2017-11-02 Thread David Nalesnik
On Wed, Nov 1, 2017 at 6:28 PM, Thomas Morley  wrote:
> 2017-11-01 23:30 GMT+01:00 Bernardo Barros :
>> On 11/1/17 18:11, David Nalesnik wrote:
>>>
>>> Attached to the following is some code which will allow you to have
>>> multiple TextSpanners per voice.  I haven't tried to apply it to your
>>> use case, though.
>>>
>>> http://lists.gnu.org/archive/html/lilypond-user/2015-10/msg00551.html
>>
>>
>> I see only one Spanner in the output [see image]
>>
>>
>
> There was a change in type-predicate for spanner-id. It's now 'key?'.
>

Thank you for the fix, Harm!

David

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


Re: spanner and epsfile

2017-11-01 Thread David Nalesnik
On Wed, Nov 1, 2017 at 2:27 PM, Thomas Morley  wrote:
> 2017-11-01 4:21 GMT+01:00 Bernardo Barros :
>
>> I'm still trying to figure out my other question, how to have
>> inter-penetrating spanners, or rather, how to have one spanner parallel to
>> another without conflict?
>>
>> I can imagine two solutions:
>>
>> 1) Two or more voices, one with all notes hidden. Ugly solution.
>
> There's only one TextSpanner per Voice possible, so above is certainly
> a possibility

Attached to the following is some code which will allow you to have
multiple TextSpanners per voice.  I haven't tried to apply it to your
use case, though.

http://lists.gnu.org/archive/html/lilypond-user/2015-10/msg00551.html

Best,
David

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


Re: "Text spanner"-ish thing with text in the middle

2017-10-28 Thread David Nalesnik
Hi,

On Sat, Oct 28, 2017 at 2:23 AM, James Harkins  wrote:
>  On Sat, 28 Oct 2017 13:55:49 +0800 Nathan Ho  wrote 
> 
>> On 2017-10-27 21:37, James Harkins wrote:
>> > I couldn't find this quickly: for an unmetered section, I'd like to
>> > indicate duration by tuplet-style brackets, only not a tuplet (no
>> > change to note durations) and with arbitrary text markup in the
>> > middle...
>>
>> you can hijack an ordinary tuplet by setting the duration ratio to 1/1
>> and modifying the text:
>
> That's a neat trick, to use a tuplet like that -- I'll give it a try. 
> Otherwise, Andrew's approach looks good too.

I'm a little late to the party, but attached is a very generalized
solution which offers a fully functional TextSpanner -- well, minus
arrows at this point -- with as many inner texts as you want.  A
single text will be centered.

The code is copied from the repository at
https://github.com/davidnalesnik/lilypond-text-spanner-inner-texts,
which contains instructions and a file of examples.

Best,
David
\version "2.19.46"

#(define (offset-subtract a b)
   (cons (- (car b) (car a))
 (- (cdr b) (cdr a

% Rewrite of Offset::direction in LilyPond source file 'flower/offset.cc'
#(define (offset-direction o)
   (cond
((and (inf? (car o)) (not (inf? (cdr o
 (cons (if (> (car o) 0.0) 1.0 -1.0)
   0.0))
((inf? (cdr o))
 (cons 0.0
   (if (> (cdr o) 0.0) 1.0 -1.0)))
((and (= (car o) 0.0) (= (cdr o) 0.0))
 o)
(else
 (let ((len (sqrt (+ (* (car o)(car o)) (* (cdr o)(cdr o))
   (cons (/ (car o) len) (/ (cdr o) len))

%% CUSTOM GROB PROPERTIES

% Taken from http://www.mail-archive.com/lilypond-user%40gnu.org/msg97663.html
% (Paul Morris)

% function from "scm/define-grob-properties.scm" (modified)
#(define (cn-define-grob-property symbol type?)
   (set-object-property! symbol 'backend-type? type?)
   (set-object-property! symbol 'backend-doc "custom grob property")
   symbol)

% Count of _inner_ texts per line; does not include bound-details.left.text
% and bound-details.right.text.  This is set automatically but may be
% overridden.
#(cn-define-grob-property 'inner-text-count-by-line number-list?)

% How much space between line and object to left and right?
% Default is '(0.0 . 0.0).
#(cn-define-grob-property 'line-X-offset number-pair?)

% Vertical shift of connector line, independenf of texts.
#(cn-define-grob-property 'line-Y-offset number?)

% Turn a list of lengths into contiguous extents
% '(10 20 5) -> '((0 . 10) (10 . 30) (30 . 35))
% Used with line lengths to decide where to place an inner text
#(define (lengths->cumulative-extent-list ls)
   (let inner ((ls ls) (prev 0) (result '()))
 (if (null? ls)
 (reverse result)
 (inner
  (cdr ls)
  (+ prev (car ls))
  (cons (cons prev (+ (car ls) prev))
result)

% Place a text by x coordinate within a list of contiguous extents
% representing lines
#(define (assign-line my-X line-exts)
   (let inner ((line-exts line-exts) (idx 0))
 (cond
  ((null? line-exts) #f)
  ((and (<= (caar line-exts) my-X)
(<= my-X (cdar line-exts)))
   idx)
  (else (inner (cdr line-exts) (1+ idx))

% count adjacent duplicates.  Used to determine count of the inner texts assigned to
% each line of our spanner.
#(define (text-count-per-line ls line-count)
   (define (inner ls counter lines result)
 (cond
  ((null? lines) (reverse result))
  ((null? ls) (inner ls 0 (cdr lines) (cons counter result)))
  ((eq? (car ls) (car lines))
   (inner (cdr ls) (1+ counter) lines result))
  (else
   (inner ls 0 (cdr lines) (cons counter result)
   (if (null? ls)
   '()
   (inner ls 0 (iota line-count) '(

% Spread texts evenly over available lines taking into account line lengths.  Return
% a list showing number of texts per line.
% TODO: take into account the extent of texts, rather than assuming them to be
% dimensionless
#(define (get-text-distribution text-list line-extents)
   (let ((line-count (length line-extents))
 (text-count (length text-list)))
 (if (= 0 text-count)
 (make-list line-count 0)
 (let* ((line-lengths
 (map (lambda (line) (interval-length line))
   line-extents))
(total-line-length (apply + line-lengths))
(space-between (/ total-line-length (1+ text-count)))
(positions
 (map (lambda (e) (* e space-between))
   (iota text-count 1)))
(segment-exts (lengths->cumulative-extent-list line-lengths))
(line-assignments
 (map (lambda (x) (assign-line x segment-exts))
   positions))
(count-per-line (text-count-per-line line-assignments line-count)))
   count-per-line

%% Adapted from 'justify-line-helper' in scm/define-markup-commands.scm.
#(define (inner-te

Re: automatic partwriter

2017-10-07 Thread David Nalesnik
Hi all,

> I've attached the beginning of an automatic partwriter.

Here's an improved version of the partwriter which adds a few
constraints to get smoother results.

The four voices may not all move in the same direction, and upper
parts must move to the closest available chord member (in the
direction of movement).  Bass leaps are handled more sensibly, and
bass and tenor are kept within a 10th of each other.

The partwriter still only works with root-position triads.  Baby steps.

David
\version "2.18.2"

%%% Pitch Utility

#(define (pitch>=? a b)
   (not (ly:pitchinterval-class interval)
   (let ((iv (calc-base-interval interval)))
 (if (< iv 6)
 iv
 (- 12 iv

#(define (interval=? iv1 iv2)
   (eqv? (interval (car iv1) (cadr iv1))
 (interval (car iv2) (cadr iv2

#(define (semitone? p1 p2)
   (eqv? 1 (interval p1 p2)))

#(define half-step? semitone?)

#(define (whole-tone? p1 p2)
   (eqv? 2 (interval p1 p2)))

#(define whole-step? whole-tone?)

#(define (step? p1 p2)
   (or (half-step? p1 p2)
   (whole-step? p1 p2)))

%% Intervals specified as a pitch (relative to middle C)
#(define disallowed-intervals
   `(
  ,#{ dis' #} ; A2
  ,#{ fis' #} ; A4
  ,#{ ges' #} ; d5
  ,#{ bes' #} ; m7
  ,#{ b' #} ; M7
  ))

%%% List utility

% permute, for example, (1 3 5)
% Procedure:
% Put one to end: (3 5 1), put 5 to end (3 1 5)
% Put three to end: (5 1 3), put 1 to end: (5 3 1)
% Put five to end: (1 3 5), put 3 to end: (1 5 3)

% '(1 2 3) => '(2 3 1)
#(define (rotate-list ls)
   (append (cdr ls) (list (car ls

% '(1 2 3) => '((1 2 3) (2 3 1) (3 1 2))
#(define (all-rotations ls)
   (define (helper cp ls)
 (if (null? cp)
 '()
 (cons ls
   (helper (cdr cp) (rotate-list ls)
   (helper ls ls))

% All possible orderings of a list
% '(1 2 3) => '((1 2 3) (2 3 1) (3 1 2) (1 3 2) (3 2 1) (2 1 3))
#(define (permute-list ls)
   (define (helper head tail)
 (map (lambda (t) (append head t))
   (all-rotations tail)))

   (let loop ((idx (1- (length ls))) (res (list ls)))
 (if (< idx 0)
 res
 (loop
  (1- idx)
  (append-map
   (lambda (r) (helper (list-head r idx) (list-tail r idx)))
   res)

% return list of lists of every ordered combination of single elements
% from a list of lists
% '((1 2) (a b) (100) (x)) ==> '((1 a 100 x) (1 b 100 x) (2 a 100 x) (2 b 100 x))
#(define (every-one-of-each ls)
   (define (helper ls1 ls2)
 (append-map
  (lambda (x)
(map (lambda (y) (cons y x))
  ls2))
  ls1))
   (let loop ((ls ls) (seed '((
 (if (null? ls)
 (map reverse seed)
 (loop (cdr ls) (helper seed (car ls))

%%% Ranges

#(define full-ranges
   `(
  ("bass" . (,#{ e, #} . ,#{ d' #}))
  ("tenor" . (,#{ c #} . ,#{ g' #}))
  ("alto" . (,#{ g #} . ,#{ d'' #}))
  ("soprano" . (,#{ c' #} . ,#{ g'' #}))
  ))

#(define moderate-ranges
   `(
  ("bass" . (,#{ g, #} . ,#{ b #}))
  ("tenor" . (,#{ e #} . ,#{ e' #}))
  ("alto" . (,#{ b #}. ,#{ b' #}))
  ("soprano" . (,#{ e' #} . ,#{ e'' #}))
  ))

% Locate every pitch expression of a chord member within a voice's range

% `mem' is a pitch derived from a \chordmode expression.
% (The octave of this input pitch is discarded.)

#(define (voice-member-possibilities mem range)
   (filter-map
(lambda (p)
  (and (pitch>=? p (car range))
   (pitch>=? (cdr range) p)
   p))
(map
 (lambda (o)
   (ly:make-pitch o
 (ly:pitch-notename mem)
 (ly:pitch-alteration mem)))
 (iota (1+ (- (ly:pitch-octave (cdr range))
 (ly:pitch-octave (car range
   (ly:pitch-octave (car range))

% Find every pitch expression of a chord's members for a voice type.

% `voice-str' identifies the voice type: "bass" "tenor" "alto" "soprano"
% `chord' is an alist of (member . pitch) pairs.  For example,
% ((root . #) (third . #) (fifth . #))
% The octave representations are straight from Lily's chordmode processing
% Return is a list of lists structured as (member (list-of-all-possible-octave-expressions))
% for the particular voice type.  For example,
% ((root (# #)) (third (# #)) (fifth (#)))

% TODO: range should be a parameter!

#(define (voice-all-member-possibilities voice-str chord)
   (let ((range (ly:assoc-get voice-str full-ranges)))
 (map (lambda (mem)
(cons (car mem)
  (list
   (voice-member-possibilities
(cdr mem)
range
   chord)))

%%% Voicing utility

% Check that each voice is in unison with or higher than next lower voice
% `ls' is a chord voicing, from bass up.  For example,
%  (# # # #)
#(define (ascending? ls)
   (let loop ((l ls) (good #f))
 (cond
  ((null? (cdr l)) good)
  ((ly:pitch # # #)
%  (# # # #)
%  [...] )

% Remove bad arrangements.
#(define (filter-pitch-lists p-lists)
   (filter T-A-S-

Re: OttavaBracket right endpoint?

2017-10-07 Thread David Nalesnik
On Wed, Oct 4, 2017 at 6:54 PM, Trevor Bača  wrote:
> Hi,
>
> I’m interested in making the right endpoints of ottava brackets and trill
> spanners coincide.
>
> QUESTION: in ottava-1.png (attached) I like where the trill spanner ends; is
> there a way to tell the ottava bracket to end at the same point?

No nice way.

The problem you see is due to different spanner bounds for
TrillSpanner and OttavaBracket.
TrillSpanner extends to the NoteColumn of the following note,
OttavaBracket only to the final note of the ottavation.

You can see this by running the following (stem color shows the
difference in endpoints):

\version "2.19.65"

\new Staff {
  \override Staff.OttavaBracket.after-line-breaking =
  #(lambda (grob)
 (set! (ly:grob-property
(ly:grob-object (ly:spanner-bound grob RIGHT) 'stem)
'color)
   green))
  \ottava #1
  \override TrillSpanner.after-line-breaking =
  #(lambda (grob)
 (set! (ly:grob-property
(ly:grob-object (ly:spanner-bound grob RIGHT) 'stem)
'color)
   red))
  c''4 \startTrillSpan
  d''
  e''
  f''
  \ottava #0
  %\break
  c'4 \stopTrillSpan
  d'
  e'
  f'
}

A proper solution would lie in the OttavaBracket engraver. (And who
knows what other changes you would need elsewhere to accommodate the
new right-bound.)

>
> OttavaBracket seems not to implement the to-barline property (in the
> spanner-interface):

In my understanding, 'to-barline is used to stop a spanner before it
would ordinarily stop, not lengthen it.  This could be implemented if
the OttavaBracket 'columns array included the following, non-ottavated
NoteColumn.

> There’s also a (promising-sounding) connect-to-neighbor property in the
> horizontal-bracket-interface. But I can’t figure out how to override
> property, or whether OttavaBracket implements the property at all:

This is not what you think. It's used to determine whether to draw an
end-piece of a bracket (that is, with a terminal hatch mark) or an
interior piece (just a line).  Perhaps the property should be more
clearly named.

Sorry I can't give you good news...

David

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


Re: automatic partwriter

2017-09-28 Thread David Nalesnik
On Thu, Sep 28, 2017 at 12:07 PM, Karlin High  wrote:
> On 9/28/2017 8:34 AM, David Nalesnik wrote:
>
> I appreciate this.  The positive feedback I've gotten is encouraging
> me to keep going with this.
>
>
> Fully understanding this piece is going to stretch my understanding of both
> music theory and LilyPond code. But yesterday, a MIDI file from these chord
> progressions worked great for putting my four-year-old son down for his nap.
> --

Love this :)

It also makes a great template for semi-improvised interlude music in
church services.

David

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


Re: automatic partwriter

2017-09-28 Thread David Nalesnik
Hi Sam,

On Thu, Sep 28, 2017 at 8:20 AM, Sam Bivens  wrote:
> Hi David,
>
> I agree, this is *really* impressive work!

I appreciate this.  The positive feedback I've gotten is encouraging
me to keep going with this.

>
> Have you experimented with including intentional errors as a type of
> error-detection exercise for students?
>

Actually, that hit me on my ride home yesterday.  Thinking about how
to filter out the ugly, it occurred to me--why not encourage it?  An
"anti-partwriter" that only shows realizations with parallels, for
example.

I ought to provide some interface to turn off/on this/that rule easily.

David

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


Re: automatic partwriter

2017-09-28 Thread David Nalesnik
Hi Kieren,

On Wed, Sep 27, 2017 at 8:16 AM, Kieren MacMillan
 wrote:
> Hi David,
>
>> I wanted to share something which I think illustrates the power that
>> Lily has over other popular notation software.
>
> o_O
>
> Amazing.
>
> 1. You are a force of nature.

Well, diligent/obsessive in fits and starts :)

>
> 2. The timing on this share couldn't have been better: in the next few 
> months, I'll be giving presentations/lectures at several universities and 
> colleges, and will be featuring Lilypond prominently in parts of those 
> presentations. I want to include truly "mindset-altering" applications, and 
> this definitely counts as such.

Sure, go ahead!  Just be aware that the partwriter is only decent at
the moment with progressions of root-position triads.  I need to clean
up the code before I can enhance it.  (At the top of the list is
giving it an "understanding" of harmonic function and allowing
variable doublings.)  I'll keep you up to date.

>
> Thanks for all you do!

You're very welcome!

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

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


Re: Creating a table in Lilypond?

2017-09-27 Thread David Nalesnik
Hi Ryan,

On Wed, Sep 27, 2017 at 8:38 AM, Ryan McClure
 wrote:
> Hi everyone,
>
> It's been years since I've last used the mailing list...too long!
>
> I'm in the process of organizing my folk song collection for teaching, and I
> want to use Lilypond to do it digitally. I need to create a table at the
> bottom of my pages...like, an actual text table. I don't want to cut and
> paste my Lilypond score into a document... Is there a way to create a text
> table look-alike using \markup?
>


Yes, this great feature was introduced sometime in the 2.19 cycle.
See 
http://lilypond.org/doc/v2.19/Documentation/notation/text-markup-list-commands

As far as I know, you can't use it in an actual \header block if
that's what you're meaning to do (\header blocks don't seem to allow
\markuplist commands, but I did manage to hack a way to do it.
Perhaps someone will chime in with something I'm overlooking!)

David

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


automatic partwriter

2017-09-26 Thread David Nalesnik
Hi all,

I wanted to share something which I think illustrates the power that
Lily has over other popular notation software.

I spend a lot of time teaching partwriting to undergraduate music
majors, and recently, suddenly, it occurred to me that anything as
rule-bound as correct partwriting (I stress "correct" as opposed to
"artistic" or even "interesting") would naturally be the province of
computers.  A computer should be able to instantly provide all
possible solutions to a problem with so many constraints.

I've attached the beginning of an automatic partwriter.  The highlight
is the output of every possible realization of a simple
progression--given the restrictions I've chosen to apply.  Feel free
to add more.  These restrictions are:

(1) a rather constrained range for the voice parts (a central octave
for upper parts, slightly more for the bass--perhaps suitable to a
beginning or an ending);
(2) all parallel perfect intervals are disallowed;
(3) consecutive fifths/octaves by contrary motion are disallowed;
(3) approach to perfect fifths and octaves in outer voices by similar
motion is disallowed unless the soprano moves by step ("direct fifths
and octaves");  I'm aware that other practices may be more
severe--easy to incorporate stricter requirements.  (See how I deal
with parallels.)
(4) voice parts may not cross or overlap.
(5) adjacent upper voices may never be more than an octave apart;
(6) certain intervals are disallowed (I do allow the diminished 5th
for the sake of the lovely fa-ti-do in the example progression);
(7) the bass is prevented from leaping over an octave (never thought
of this until I saw preliminary output);
(8) all chords are complete;
(9) the root is doubled.
(10) the leading tone must resolve to tonic unless it is in an inner
voice, when it may drop to the dominant pitch.

You will notice that among the great number of possibilities spewed
forth are a number which aren't great.  Further processing could weed
out variants which (for example): (1) move all parts in similar
motion; (2) are excessively "leapy"; (3) don't follow leaps with
stepwise motion in the opposite direction; (4) arpeggiate quartal
harmony (!); etc.  A ranking could be assigned to lines based on their
"arch-like" contour, their ratio of stepwise motion to skips and leaps
(as Lily gives scores to possible slur shapes to arrive at the best
realization); whatever.

What this does not do yet:
(1) accommodate variable doublings (as usual with first-inversion
triads; also, the "Pachelbel canon progression"--Heaven forfend--won't
return any results as there is no possible realization with the
parameters I've specified);
(2) handle leading tones outside of dominant harmony;
(3) resolve chord sevenths properly;
(4) have a necessary sense of _chord function_
(5) A whole host of things.

As far as applications, It strikes me that this could be useful as a
generator of examples for ear training exercises (as well as a
generator of possibilities for evaluation, and a generator of
everything which may be done given certain constraints--among positive
applications :) )

The attached file demonstrates
(1) every possible realization of the progression vi-ii-V-I (B major)
and i-iv-V-i (c minor) with certain constraints (change the range
variable to see a _huge_ increase of possibilities);
(2) a random realization (we dispense with the "all-possibilities"
approach here--there is the danger of a dead end);
(3) all possible voicings of a seventh chord (with constraints attached).

One possible flaw is the way that I generate possible realizations.
Basically, I look for all possible rule-obeying two-chord pairings
between chords 1 and 2, then find all possible connections between
chords 2 and 3 which dovetail with the found connections between 1 and
2, and so forth.  It's easy to see that this could lead to an overflow
with a long progression or if there aren't plenty of rules to weed out
as many branches of the tree as possible before they have the chance
to propagate,  A truly artful solution would mimic the thought process
of a intelligent human being, but I'm aware that this is quite quite a
bit more difficult than the sledge-hammer approach I've taken.

Anyway, sorry to go on so long.  FWIW...

Comments welcome!

Best,

David
\version "2.18.2"

%%% Pitch Utility

#(define (pitch>=? a b)
   (not (ly:pitchinterval-class interval)
   (let ((iv (calc-base-interval interval)))
 (if (< iv 6)
 iv
 (- 12 iv

#(define (interval=? iv1 iv2)
   (eqv? (interval (car iv1) (cadr iv1))
 (interval (car iv2) (cadr iv2

#(define (semitone? p1 p2)
   (eqv? 1 (interval p1 p2)))

#(define half-step? semitone?)

#(define (whole-tone? p1 p2)
   (eqv? 2 (interval p1 p2)))

#(define whole-step? whole-tone?)

#(define (step? p1 p2)
   (or (half-step? p1 p2)
   (whole-step? p1 p2)))

%% Intervals specified as a pitch (relative to middle C)
#(define disallowed-intervals
   `(
  ,#{ dis' #}
  ,#{ fis' #}

Re: Text Spanner Leading Directly Into Another Text Spanner

2017-09-18 Thread David Nalesnik
Hi Robert,

On Mon, Sep 18, 2017 at 12:03 PM, Robert Murdoch  wrote:
> Hi,
>
> Is there a way to create a text spanner that leads directly into another
> text spanner, for example an accelerando into a ritardando? I've tried using
> \stopTextSpan and \startTextSpan on the same note, but the second text
> spanner is above the end of the first one which is not what I want.
>

You can connect two text spanners by fiddling with values in
bound-details.  Something like this:

{
  c1~ -\tweak bound-details.left.text "ritardando"
  -\tweak bound-details.right.padding #0
  \startTextSpan
  c1
  c1\stopTextSpan
  -\tweak bound-details.left.padding #1.5
  -\tweak bound-details.left.text "accelerando"
  \startTextSpan
  c1\stopTextSpan
}

If you're looking to create a single text spanner with "inner texts"
(instead of fiddling two separate spanners together), you might try
https://github.com/davidnalesnik/lilypond-text-spanner-inner-texts
though this might be overkill!

Hope this helps--

David

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


Re: finger placement brackets for hap

2017-09-15 Thread David Nalesnik
Hi Gianmaria,

On Fri, Sep 15, 2017 at 7:16 AM, Gianmaria Lari  wrote:
> Harp scores sometimes specify a bracket below or above the notes to indicate
> how to place your hand. In the attachment you can see an example.
>
> I have found online this code that works pretty well:
> [https://music.stackexchange.com/questions/48731/lilypond-finger-placement-brackets]
>
> \version "2.19.52"
> variable = {
>  \once \override TextSpanner.style = #'line
>  \once \override TextSpanner.to-barline = ##f
>  \once \override TextSpanner.bound-details =
>   #`(
>(left
> (text . ,#{ \markup { \draw-line #'( 0 . -.5) } #})
> (Y . 0)
> (padding . 0.25)
> (attach-dir . -3)
>)
>(right
> (text . ,#{ \markup { \draw-line #'( 0 . -.5) } #})
> (Y . 0)
> (padding . 0.25)
> (attach-dir . 3)
> )
>)
> }
>
> \relative c' {
>  \key c \major
>  \time 3/4
>  \partial 4
>  \override Fingering.staff-padding = #'()
>  \variable
>  \once \override TextSpanner.rotation = #'(4 1.9 0)
>  a'8_3\startTextSpan b_2 \variable \once \override TextSpanner.rotation =
> #'(-4.5 -4.5 0)
>  c4-1\stopTextSpan\startTextSpan b-2 a_3 \variable \once \override
> TextSpanner.rotation = #'(3 -0.2 0)
>  g_4\stopTextSpan\startTextSpan a_3 b-2 \variable \once \override
> TextSpanner.rotation = #'(-7 -2.5 0)
>  c-1\stopTextSpan\startTextSpan g_2 f_3
>  e2_4\stopTextSpan
> }
>
> ... but it's very not very friendly to use. Does exist anything better?
> Thank you, g.
>

I don't know if anything better exists, but I'm sure this could be
automated to some degree.  The spanner is aware of the note columns it
passes over, and this information could be used to calculate the Y
subproperty of the spanner's left and right bounds.  I couldn't say if
you'd still need to tweak the results with the rotation property,
however!

Best,

David

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


Re: Show Key name and first note of song?

2017-09-03 Thread David Nalesnik
Hi David,

On Sun, Sep 3, 2017 at 12:51 AM, David F.  wrote:
> That is great! Just what I was looking for.
>
> Your patch isn’t extracting the tonic—it always returns ‘C’.  But I always 
> explicitly define the key, so your original code works like a charm.

Oops.

In any case, all you'd have to do is modify the function like so:

#(define-markup-command (firstNoteAndKey layout props mus)
   (ly:music?)
   (let* ((keey (extract-named-music mus 'KeyChangeEvent))
  (tonic
   (if (pair? keey)

[...snip...]


>
> Thanks!
>
> David
>
> On Sep 2, 2017, at 7:25 AM, David Nalesnik  wrote:
>
>> On Sat, Sep 2, 2017 at 8:09 AM, David Nalesnik  
>> wrote:
>>> Hi David,
>>>
>>> On Sat, Sep 2, 2017 at 12:25 AM, David F.  wrote:
>>>> I have a hymnal that prints the name of the key and the first note the 
>>>> song above the treble clef sign of the first staff.  So, for example, if 
>>>> you have Amazing Grace in the key of G major, the first note of the 
>>>> soprano (melody) part is a D.  That is printed as “G/D”.
>>>>
>>>> Can lilypond do that?  I thought I had seen an example of that somewhere, 
>>>> but I can’t find it now.
>>>>
>>>
>>> I don't know where you saw this on the lists, but attached you'll find
>>> a solution.
>>>
>>
>> The original code will break if there's no explicit key set.
>>
>> Patch:
>>
>> #(define-markup-command (firstNoteAndKey layout props mus)
>>   (ly:music?)
>>   (let* ((keey (extract-named-music mus 'KeyChangeEvent))
>>  (tonic
>>   (if (ly:music? keey)
>>   (ly:music-property (car keey) 'tonic)
>>   (ly:make-pitch 0 0)))
>>  (notes (extract-named-music mus 'NoteEvent))
>>  (first-ne (car notes))
>>  (first-pitch (ly:music-property first-ne 'pitch)))
>> (interpret-markup layout props
>>   (make-concat-markup
>>(list
>> (format-key first-pitch)
>> "/"
>> (format-key tonic))
>

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


Re: Show Key name and first note of song?

2017-09-02 Thread David Nalesnik
On Sat, Sep 2, 2017 at 8:09 AM, David Nalesnik  wrote:
> Hi David,
>
> On Sat, Sep 2, 2017 at 12:25 AM, David F.  wrote:
>> I have a hymnal that prints the name of the key and the first note the song 
>> above the treble clef sign of the first staff.  So, for example, if you have 
>> Amazing Grace in the key of G major, the first note of the soprano (melody) 
>> part is a D.  That is printed as “G/D”.
>>
>> Can lilypond do that?  I thought I had seen an example of that somewhere, 
>> but I can’t find it now.
>>
>
> I don't know where you saw this on the lists, but attached you'll find
> a solution.
>

The original code will break if there's no explicit key set.

Patch:

#(define-markup-command (firstNoteAndKey layout props mus)
   (ly:music?)
   (let* ((keey (extract-named-music mus 'KeyChangeEvent))
  (tonic
   (if (ly:music? keey)
   (ly:music-property (car keey) 'tonic)
   (ly:make-pitch 0 0)))
  (notes (extract-named-music mus 'NoteEvent))
  (first-ne (car notes))
  (first-pitch (ly:music-property first-ne 'pitch)))
 (interpret-markup layout props
   (make-concat-markup
(list
 (format-key first-pitch)
 "/"
 (format-key tonic))

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


Re: Show Key name and first note of song?

2017-09-02 Thread David Nalesnik
Hi David,

On Sat, Sep 2, 2017 at 12:25 AM, David F.  wrote:
> I have a hymnal that prints the name of the key and the first note the song 
> above the treble clef sign of the first staff.  So, for example, if you have 
> Amazing Grace in the key of G major, the first note of the soprano (melody) 
> part is a D.  That is printed as “G/D”.
>
> Can lilypond do that?  I thought I had seen an example of that somewhere, but 
> I can’t find it now.
>

I don't know where you saw this on the lists, but attached you'll find
a solution.

I wrote a markup command which takes a music expression and finds the
relevant information.  In the example, I show two ways of using it, as
a top-level-markup and as a mark.  (The mark will have better
alignment possibilities.  It's not hard to get it over the treble
clef, for example.)

Hope this helps!

David N.

P. S. It's probably possible to write an engraver for this.
P. P. S.  I avoided the function note-name->markup because I don't
like the gap it creates between note name and accidental.  My code
could use some height adjustment for accidentals, though.
\version "2.18.2"

% Probably better as a vector lookup
#(define letter-names '("C" "D" "E" "F" "G" "A" "B"))

#(define alteration-symbols
   `(
  (-1/2 . ,(make-flat-markup))
  (0 . ,(make-null-markup))
  (1/2 . ,(make-sharp-markup))
  ))

#(define (format-key p)
   (let* (;(p (ly:music-property ne 'pitch))
   (nn (ly:pitch-notename p))
   (alt (ly:pitch-alteration p))
   (letter (list-ref letter-names nn))
   (alteration (ly:assoc-get alt alteration-symbols)))
 #{
   \markup \concat {
 #letter #alteration
   }
 #}))

#(define-markup-command (firstNoteAndKey layout props mus)
   (ly:music?)
   (let* ((keey (extract-named-music mus 'KeyChangeEvent))
  (tonic (ly:music-property (car keey) 'tonic))
  (notes (extract-named-music mus 'NoteEvent))
  (first-ne (car notes))
  (first-pitch (ly:music-property first-ne 'pitch)))
 (interpret-markup layout props
   (make-concat-markup
(list
 (format-key first-pitch)
 "/"
 (format-key tonic))

amazingGrace = \relative c' {
  \key g \major
  \time 3/4
  \partial 4 d4
  g2 b8 g
  b2 a4
  g2 e4
  d2
}

\markup \bold \firstNoteAndKey #amazingGrace

{
  \amazingGrace
}

{
  \override Score.RehearsalMark.break-align-symbols =
  #'(clef staff-bar key-signature)
  % CENTER doesn't center over clef?!
  \once \override Score.RehearsalMark.self-alignment-X = #0.5
  \mark \markup \firstNoteAndKey #amazingGrace
  \amazingGrace
}

\paper {
  indent = 0
}___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Syntax for multiple slurs per Voice?

2017-07-27 Thread David Nalesnik
Hi Trevor,

On Thu, Jul 27, 2017 at 8:38 AM, Trevor Bača  wrote:
> Hi David (Nalesnik),
>
> On Tue, Oct 20, 2015 at 11:49 AM, David Nalesnik 
> wrote:
>>
>> Hi Trevor,
>>
>> On Tue, Oct 20, 2015 at 11:31 AM, Trevor Bača 
>> wrote:
>>>
>>> Hi,
>>>
>>> I'm coming late to this discussion, but potentially *very* excited about
>>> what this might mean. Will the available of spanner IDs mean that a single
>>> voice will (eventually) be able to carry multiple *text spanners*???
>>>
>>> This would be incredibly useful in my own scores (and probably also in
>>> the scores of very many other composers who work with simultaneous
>>> continuous transitions). I've attached a PNG of an example from a recent
>>> cello piece. The score is in LilyPond, but the engraving required multiple
>>> (redundant) invisible markup voices. Would be so elegant to be need only a
>>> single voice.
>>>
>>>
>>
>> I recently rewrote Text_spanner_engraver, incorporating 'spanner-id to
>> allow an unlimited number of TextSpanners per voice.  The entry method isn't
>> particularly pretty (basically it's equivalent to what you had to do with
>> slurs before David Kastrup came up with the current solution).
>>
>> I'd like to get this into the codebase, but I'm unsure if I need to port
>> it to C++.  Also, there's a chance another engraver to bind the simultaneous
>> spanners might be needed (as piano pedal lines are bound by an alignment
>> engraver).
>>
>> Attached is a more recent version than the one found here:
>> http://www.mail-archive.com/lilypond-user%40gnu.org/msg105470.html
>>
>> Hope this helps!
>
>
>
> I'm (finally!) working at integrating your alternateTextSpannerEngraver. My
> testing so far shows that it allows for very much of what I'm looking for
> (ie, multiple text spanners overlapping each other in a single voice).
>
> Two questions:
>
> 1. Is the version you attached as "text-spanner-id.ly" (way back in October
> 2015!) still the most recent version of your work?

Ugh -- I was going to say that a (perhaps) more current version is on
GitHub, but I seem to have never created a repository for it...  Old
age.

So I guess your version is the newest :(

Let me know if you run into any difficulties, and I'll be happy to
create that newer version.

>
> 2. Was there ever any movement towards integrating the functionality of your
> rewritten engraver into the Lily's primary codebase? (Back in October 2015
> David Kastrup wrote that he was also thinking through how multiple spanners
> might be integrated, too, if I remember correctly.)
>

I'm not aware of anything new in the codebase.  I thought that a
recent GSoC project touched on this topic, but I don't know what if
anything made it into LilyPond.

DN

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


Re: Fwd: Re: Is the lyric-syllable-magnetic-snap snippet obsolete?

2017-07-14 Thread David Nalesnik
On Jul 13, 2017 3:36 PM, "Urs Liska"  wrote:

Also forwarding to the list.

However, despite my hope at the end of the below message I did *not* find
the culprit why it doesn't work with current LilyPond anymore. It would be
cool if you (David) could have a look at the code and help me get this to
work again.

Best
Urs

I'll have a look when I'm at my computer.  I think I gave you the wrong
predicate--should be ly:grob-properties?  I think.  In any case, I'll work
it out.


 Weitergeleitete Nachricht 
Subject: Re: Is the lyric-syllable-magnetic-snap snippet obsolete?
To: David Nalesnik  
References: <008f2f4c-d343-d552-bc10-fc60833df...@openlilylib.org>
<008f2f4c-d343-d552-bc10-fc60833df...@openlilylib.org> 

From: Urs Liska  
Message-ID: <9c4ff181-0930-114d-62c0-acf334bfa...@openlilylib.org>
<9c4ff181-0930-114d-62c0-acf334bfa...@openlilylib.org>
Date: Thu, 13 Jul 2017 22:16:01 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: 

Content-Type: multipart/mixed; boundary="
B95AA6B5C40877D1B4CC3F43"


Hi David,

thanks for the reply.

Am 13.07.2017 um 22:06 schrieb David Nalesnik:



On Jul 13, 2017 2:53 PM, "Urs Liska"  wrote:

There is the snippet notation-snippets/lyric-syllable-magnetic-snap
which doesn't work with 2.19.60 (2.18 works).


I believe it can be fixed by changing a predicate (sorry i can't view the
source now to say which one) to ly:grob-property?  This would make it fail
with 2.18, so a version predicate would be needed.


OK, maybe I'll find it myself then.
I'm right now working on a new openLilyLib package. This means I won't keep
2.18 support. We decided to drop that with the oll-core based
infrastructure, just because there are so fundamental improvements around
2.19.22 (mostly these, but of course all the other general improvements as
well) that we just won't keep it working on the different versions.
So in *this* case I can ignore that.


Is this something that has been integrated into LilyPond by now? I seem
to recall that words in lyrics are joined now if there's no space for
hyphensl


This would be news to me.


Oh, what I pity. I thought this would work by now.
Obviously I mistook it for the feature that the hyphen is automatically
removed (see attachment).

Do you recall any reason why you didn't add this to LilyPond then?


Probably because introducing a new LyricWord grob seemed like a big change,
so I was hoping for some feedback before going forward.  Also, I seem to
remember some issues reported on the user list or on GitHub.  I haven't
looked into these.

I'm happy to push forward with this, but it would be best when 2.20 has
been locked down.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Fwd: Re: Is the lyric-syllable-magnetic-snap snippet obsolete?

2017-07-13 Thread David Nalesnik
Forwarding to the list...

-- Forwarded message --
From: "David Nalesnik" 
Date: Jul 13, 2017 3:06 PM
Subject: Re: Is the lyric-syllable-magnetic-snap snippet obsolete?
To: "Urs Liska" 
Cc:



On Jul 13, 2017 2:53 PM, "Urs Liska"  wrote:

There is the snippet notation-snippets/lyric-syllable-magnetic-snap
which doesn't work with 2.19.60 (2.18 works).


I believe it can be fixed by changing a predicate (sorry i can't view the
source now to say which one) to ly:grob-property?  This would make it fail
with 2.18, so a version predicate would be needed.


Is this something that has been integrated into LilyPond by now? I seem
to recall that words in lyrics are joined now if there's no space for
hyphensl


This would be news to me.


Snippet:
https://github.com/openlilylib/snippets/tree/master/notation-snippets/lyric-
syllable-magnetic-snap

There's a reference to
http://lists.gnu.org/archive/html/lilypond-user/2014-03/msg00489.html in
the snippet, David Nalesnik and Mike Solomon are listed as the authors.

Any comments?

Thanks
Urs

--
u...@openlilylib.org
https://openlilylib.org
http://lilypondblog.org


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


RE: : Re: transpose range

2017-06-26 Thread David Nalesnik
Hi,

On Jun 26, 2017 4:57 PM, "Peter Gentry" 
wrote:



-Original Message-
From: David Kastrup [mailto:d...@gnu.org]
Sent: 26 June 2017 15:31
To: Peter Gentry 
Cc: Lilypond 
Subject: Re: : Re: transpose range

"Peter Gentry"  writes:

> From: David Kastrup [mailto:d...@gnu.org]
>
> "Peter Gentry"  writes:
>>
>> The numeric pitch (op) is calculated by (define op (+ (* 14 o) (* n
>> 2) (/ a 2))) “op is a unique number representing the pitch of the
>> note”
>
>> Uh, that's pretty bad since it sees eis as equal to fes.  Anything
>> wrong with just using (ly:pitch-tones p) instead?
>
> a. I had not heard of ly:pitch-tones p) b. for most folks eis is the
> same sound as fes. Neither my battered old ears or my tuner could
> detect the difference.  😊

Well, I am glad that you don't sing in my hearing range then and you should
throw away that tuner.

A semitone difference is quite noticeable.

dak@lola:/usr/local/tmp/lilypond$ lilypond scheme-sandbox GNU LilyPond
2.19.59 Processing `/usr/local/share/lilypond/2.19.59/ly/scheme-sandbox.ly'
Parsing...
guile> (apply - (map ly:pitch-tones (list #{ eis #} #{ fes #})))
1/2
guile>


--
David Kastrup

A semi tone difference is indeed noticeable but surely there is no semitone
between e sharp and f flat?
It’s the same key on the piano! Where is the semitone?


E sharp/F or F flat/E are the same key on the piano.  E sharp and F flat
are a semitone apart.

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


Re: lyrics hyphens question

2017-06-13 Thread David Nalesnik
On Jun 13, 2017 9:55 PM, "Kieren MacMillan" 
wrote:

Hi David (et al.),

> It's not suitable as is, but easily remedied.  The grob LyricWord is
> defined in a hackish way so that it can fit in an LY file.

So in C++, it would be non-hackish…?


No, just parceling out the chunks to various .scm files.  Not hard at all.


> it's potentially useful to have a grob which organizes whole Lyric words,
> so lyrics are not simply a collection of isolated syllables.

Agreed.

> I can't say what problems there are with the compression routine.
> I know there have been complaints, but I haven't looked into them.

I’ve just discovered that using lyric-word-compressor makes the last line
of my score unexpectedly (and unpredictably) shorter, as if I had set
ragged-last = ##t. I'll see if I can make an MWE that demonstrates this
issue; in the meantime, I'll have to crank out this score without it…

Thanks,
Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: lyrics hyphens question

2017-06-13 Thread David Nalesnik
Hi Kieren,

On Tue, Jun 13, 2017 at 3:21 PM, Kieren MacMillan
 wrote:
> Hi David (et al.),
>
> These are questions regarding the "lyric-word-reconstituter" in the thread 
> which includes the post 
> .
>
> I'd love to use it (or something like it) in my engravings going forward.
>
> 1. It doesn't seem to work with 2.19.61 (at least), and convert-ly doesn't 
> seem to help. The error is
>
> warning: type check for `LyricWord' failed; value `#' 
> must be of type `list'
>
> My instinct (and a quick search on -user) led me to believe that changing
>
> (set-object-property! grob-name 'translation-type? list?)
>
> to
>
> (set-object-property! grob-name 'translation-type? ly:grob-properties?)
>
> might fix the problem. The file/example now compiles without error. Did I fix 
> it correctly?

Yes, that's right.

>
> 2. This is a workaround/hack/fix from 2014. At the time, there was some 
> question as to whether Janek might roll this (or similar) into the GSoC Lyric 
> project… but that is, I believe, dead in the water. Is there any hope of 
> getting this into the codebase? I'm happy to take this "stub" (much more than 
> a stub, of course!) and shepherd it through the dev process to the goal line 
> — but I don't want to start down a track that will ultimately lead to 
> frustration or nowhere at all.
>

>

It's not suitable as is, but easily remedied.  The grob LyricWord is
defined in a hackish way so that it can fit in an LY file.

In my opinion, it's potentially useful to have a grob which organizes
whole Lyric words, so lyrics are not simply a collection of isolated
syllables.  (Makes short work of the compression in this instance.)

I can't say what problems there are with the compression routine.  I
know there have been complaints, but I haven't looked into them.  (See
openlilylib, I believe.)

DN

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


Re: NR 1.7.2 - snippet "Analysis brackets with labels"

2017-06-07 Thread David Nalesnik
On Wed, Jun 7, 2017 at 10:42 AM, Federico Bruni  wrote:
> Can you please clarify the last sentence of this snippet:
>
> http://lilypond.org/doc/v2.19/Documentation/notation/outside-the-staff.html#analysis-brackets
>
>
> \layout {
>  \context {
>\Voice
>\consists "Horizontal_bracket_engraver"
>\override HorizontalBracket.direction = #UP
>  }
> }
>
> {
>  \once\override HorizontalBracketText.text = "a"
>  c''\startGroup d''\stopGroup
>  \once\override HorizontalBracketText.text = "a'"
>  e''\startGroup d''\stopGroup
>  c''
>  -\tweak text \markup \bold \huge "b" \startGroup
>  -\tweak text "a" \startGroup
>  d''\stopGroup
>  e''-\tweak text "a'" \startGroup
>  d''\stopGroup\stopGroup
>  c''-\tweak text foo \startGroup d'' e'' f''
>  \break
>  g'' a'' b'' c'''\stopGroup
> }
>
>
> """
> Analysis brackets with labels
>
> Text may be added to analysis brackets through the text property of the
> HorizontalBracketText grob. Adding different texts to brackets beginning at
> the same time requires the \tweak command. Bracket text will be
> parenthesized after a line break.
> """
>
> Bracket text will be parenthesized after a line break.
>
> It cannot simply mean that HorizontalBracketText can break a line (the
> parenthesis will be closed after the line break). So what else is trying to
> say?

Forgive the bad ASCII art:


/-- a --


--- (a) -\


>
> Another question: why the markups added using "\tweak text" are not printed?
> (bars 2, 3 and 4)
>

A change was introduced after the docs were written: you have to write
\tweak HorizontalBracketText.text for this to work.

The snippet you're seeing was fixed, but scripts/auxiliar/makelsr.py
needs to be run for the changes to show up in the documentation.

So nothing you need to worry about!

-David

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


Re: Can an augmentation dot be parenthesized?

2017-05-24 Thread David Nalesnik
Hi,

On Wed, May 24, 2017 at 12:47 PM, Lukas-Fabian Moser  wrote:
> Hi Robert,
>
>>
>> I would tather like to parenthesize these added augmenation dots but I've
>> not found a way to do that.
>
>
> I don't know how to parenthesize them, but here is a solution yielding
> brackets around them:

You can use the function parenthesize-stencil to do this.
>
> \version "2.19.44"
>
> #(define (special-bracketify original-stencil len thick protusion padding)
>   (let* (
>  (left-bracket (ly:bracket Y (cons (- len) len) thick (-
> protusion)))
>  (right-bracket (ly:bracket Y (cons (- len) len) thick protusion)))
> (set! original-stencil
>  (ly:stencil-combine-at-edge original-stencil X RIGHT right-bracket (- -0.73
> padding)))
> (set! original-stencil
> (ly:stencil-combine-at-edge original-stencil X RIGHT left-bracket padding))
> original-stencil))
>
> bracketDot = \once \override Dots.stencil = #(lambda (grob)
> (special-bracketify (ly:dots::print grob) 0.4 0.1 0.2 0))
> % first number (0.4): bracket length
> % second number (0.1): thickness
> % third number (0.2): protrusion
> % fourth number (0.1): space between dot and brackets
>
>
>  {
>   c''4.
>   r8
>   \bracketDot
>   a'4.
>   r8
> }
>
>
> Question to the experts: If I unterstand my own code correctly :-), the
> right-hand edge of the dot stencil (used by stencil-combine-at-edge) is the
> right-most part of the dot itself, while the left-hand edge seems to be the
> right-most part of the note the dot is attached to.
> For this reason I took (for the left bracket) the *right* hand edge of the
> dot and added offsets with trial-and-error, which should be fine since I
> assume the dot will have the same size wherever it occurs. But nevertheless
> there must be a more conceptual way?

The dots are created by a character in the font which consists of the
actual dot and whitespace to the left.  (This means that the space
between dots can't be adjusted.  I wonder if it would be better to
trim the character and add a property, like 'dot-separation.)

You can go your route, adding the brackets individually with an
offset, or you could make your own dots, gleaning information from the
dots.dot glyph. That's what I do below.  (You can get either
parentheses or brackets.)

%
\version "2.19.44"

#(define (parenthesized-dots grob)
   (let ((mol empty-stencil)
 (c (ly:grob-property grob 'dot-count)))
 (if (number? c)
 (let* ((d (ly:font-get-glyph (ly:grob-default-font grob) "dots.dot"))
(thick (ly:output-def-lookup (ly:grob-layout grob)
'line-thickness))
(Y-ext (ly:stencil-extent d Y))
(replacement-dot (make-circle-stencil
  (/ (- (interval-length Y-ext) thick) 2)
  thick
  #t))
(dw (interval-length (ly:stencil-extent d X)))
(mol-lst (make-list c replacement-dot))
(mol (reduce
  (lambda (elem prev) (ly:stencil-combine-at-edge
prev X RIGHT elem dw))
  point-stencil
  mol-lst))
; to make brackets instead
; stencil, axis, thick, protrusion, padding
;(mol (bracketify-stencil mol Y thick 0.2 0))
; stencil, half-thickness, width, angularity, padding
(mol (parenthesize-stencil mol (/ thick 2) 0.2 0 0))
(mol (ly:stencil-translate-axis mol (+ dw thick) X)))
   mol

parenthesizeDots = \override Dots.stencil = #parenthesized-dots

{
  \parenthesizeDots
  c''4 r
  c''4. r8
  c''4.. r16
  c''4... r32
  c''4 r64
  c''4. r128
}

%%%

Hope this helps,
David

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


Re: changing alignment of augmentation dots across multiple voices in the same staff

2017-05-24 Thread David Nalesnik
On Tue, May 23, 2017 at 2:51 PM, Kieren MacMillan
 wrote:
> Hi David,
>
>> I would say so.  However, the situation is more complicated:
>
> #ugh #IsntItAlways
>
>> [Simon:] maybe a context property to turn off alignment of dotted rests 
>> would be useful?
>
> That sounds like it might work!
>

 I agree with the idea of a context property, but it would switch
between the current default (alignment by Staff always) and a new
default which respects Gould's recommendations, which apply to more
than rests.  An alignment by voice would also be used if the dotted
quarter rest in Kieren's image were replaced by a dotted note or
notes.  Additionally, by Gould's recommendation, the dots should align
in cases where the voices have single notes (as in my counterexample
above).

-David

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


Re: changing alignment of augmentation dots across multiple voices in the same staff

2017-05-23 Thread David Nalesnik
On Tue, May 23, 2017 at 11:28 AM, Kieren MacMillan
 wrote:
> Hi David,
>
>> You provide no example to try this on
>
> Didn’t want anyone to go through any coding effort; just needed someone smart 
> to point me in the right direction.  =)
>
>> but what about moving the Dot_column_engraver to the Voice context instead 
>> of Staff?
>
> Worked like a charm — thanks!
>
> Should this be the default?

I would say so.  However, the situation is more complicated:

\version "2.19.59"

\layout {
  \context {
\Staff
\remove "Dot_column_engraver"
  }
  \context {
\Voice
\consists "Dot_column_engraver"
  }
}

<< c''2. \\ a'2. \\ b' >>

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


Re: changing alignment of augmentation dots across multiple voices in the same staff

2017-05-23 Thread David Nalesnik
Kieren,

On Tue, May 23, 2017 at 11:10 AM, Kieren MacMillan <
kieren_macmil...@sympatico.ca> wrote:

> Hello all,
>
> In the two-voice situation (bottom staff) shown in the attached
> screenshot, I’d like the dot on the rest to *not* be vertically aligned
> with the dots on the notes.
>
> 1. I tried to find such a setting in the manual, but failed — what should
> I be looking for?
>
>
You provide no example to try this on, but what about moving the
Dot_column_engraver to the Voice context instead of Staff?

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


Re: Apply a music-function script to all elements of a list

2017-05-10 Thread David Nalesnik
On Wed, May 10, 2017 at 10:18 AM, David Nalesnik
 wrote:
> Hi,
>
> On Wed, May 10, 2017 at 9:31 AM, David Nalesnik
>  wrote:
>>
>>
>> On Wed, May 10, 2017 at 9:23 AM, daviau ewen  wrote:
>>>
>>> Is that okay ?
>>> http://lilypond.1069038.n5.nabble.com/file/n203059/incdiato82.ly
>>>>
>>>>
>>
>> Yes, thank you.
>>
>
> Your original:
>
> % ici on défini les points qu'on fait sur le piano
> #(define (make-dot-list l1)
>(if (null? l1)
>empty-stencil
>(ly:stencil-add
>   (make-dot (ly:pitch-notename (car l1)))
>
>   )))
>
> OK, your function is intended to return a list of dots, but you only
> call make-dot on the first element of the list.
>
> You need to apply make-dot to every element of your pitch list, and
> then combine these into a stencil.  To combine stencils, I use reduce:
> (Documentation here:
> https://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/SRFI_002d1-Fold-and-Map.html#index-append_002dmap-3619).
> I found reduce and fold somewhat difficult to grasp at first, but they
> definitely repay study.
>
> My rewrite:
>
> #(define (make-dot-list l1)
>(reduce
> ly:stencil-add
> empty-stencil
> (map
>  (lambda (dl) (make-dot (ly:pitch-notename dl)))
>  l1)))
>
> %
>
> Your original:
>
> #(define-markup-command (complete layout props the-chord)
>(ly:music?)
>
>  (ly:stencil-scale
>   ( ly:stencil-add
> (engrave-back)
> (make-dot-list (map (lambda (m) (ly:music-property m 'pitch))
>   (extract-named-music the-chord 'NoteEvent)))
>  )
>   1
>   1))
>
> Here, the error messages are instructive.  The function ly:stencil-add
> expects its arguments to be individual stencils, but you are providing
> it with *lists* of stencils (the result of calling engrave-back and
> make-dot-list--the latter corrected as I show above, of course!)
>
> The solution once again is to first create a list of stencils, then
> combine them using reduce:
>
> #(define-markup-command (complete layout props the-chord)
>(ly:music?)
>(ly:stencil-scale
> (reduce
>  ly:stencil-add
>  empty-stencil
>  (cons
>   (make-dot-list (map (lambda (m) (ly:music-property m 'pitch))
>(extract-named-music the-chord 'NoteEvent)))
>   (engrave-back)))
> 1 1))
>
> %%
>

Actually, maybe this makes more sense (for the two functions), since
make-dot-list ought to, well, return a list instead of a combined
stencil.  I've just quoted the two functions I adapted:

#(define (make-dot-list l1)
   (map
(lambda (dl) (make-dot (ly:pitch-notename dl)))
l1))

#(define-markup-command (complete layout props the-chord)
   (ly:music?)
   (ly:stencil-scale
(reduce
 ly:stencil-add
 empty-stencil
 (append
  (make-dot-list (map (lambda (m) (ly:music-property m 'pitch))
   (extract-named-music the-chord 'NoteEvent)))
  (engrave-back)))
1 1))

-David

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


Re: Apply a music-function script to all elements of a list

2017-05-10 Thread David Nalesnik
Hi,

On Wed, May 10, 2017 at 9:31 AM, David Nalesnik
 wrote:
>
>
> On Wed, May 10, 2017 at 9:23 AM, daviau ewen  wrote:
>>
>> Is that okay ?
>> http://lilypond.1069038.n5.nabble.com/file/n203059/incdiato82.ly
>>>
>>>
>
> Yes, thank you.
>

Your original:

% ici on défini les points qu'on fait sur le piano
#(define (make-dot-list l1)
   (if (null? l1)
   empty-stencil
   (ly:stencil-add
  (make-dot (ly:pitch-notename (car l1)))

  )))

OK, your function is intended to return a list of dots, but you only
call make-dot on the first element of the list.

You need to apply make-dot to every element of your pitch list, and
then combine these into a stencil.  To combine stencils, I use reduce:
(Documentation here:
https://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/SRFI_002d1-Fold-and-Map.html#index-append_002dmap-3619).
I found reduce and fold somewhat difficult to grasp at first, but they
definitely repay study.

My rewrite:

#(define (make-dot-list l1)
   (reduce
ly:stencil-add
empty-stencil
(map
 (lambda (dl) (make-dot (ly:pitch-notename dl)))
 l1)))

%

Your original:

#(define-markup-command (complete layout props the-chord)
   (ly:music?)

 (ly:stencil-scale
  ( ly:stencil-add
(engrave-back)
(make-dot-list (map (lambda (m) (ly:music-property m 'pitch))
  (extract-named-music the-chord 'NoteEvent)))
 )
  1
  1))

Here, the error messages are instructive.  The function ly:stencil-add
expects its arguments to be individual stencils, but you are providing
it with *lists* of stencils (the result of calling engrave-back and
make-dot-list--the latter corrected as I show above, of course!)

The solution once again is to first create a list of stencils, then
combine them using reduce:

#(define-markup-command (complete layout props the-chord)
   (ly:music?)
   (ly:stencil-scale
(reduce
 ly:stencil-add
 empty-stencil
 (cons
  (make-dot-list (map (lambda (m) (ly:music-property m 'pitch))
   (extract-named-music the-chord 'NoteEvent)))
  (engrave-back)))
1 1))

%%

Of course, scaling the stencil to 100% is both axes is a bit redundant!

Another observation: the greenish dots are hard to see.

I've attached the whole file (with some formatting changes that helped
me read it better).

Hope this helps,

David
%2) On dessine les points

%--

% ici on défini les points qu'on fait sur le piano
#(define (make-dot-list l1)
   (reduce
ly:stencil-add
empty-stencil
(map
 (lambda (dl) (make-dot (ly:pitch-notename dl)))
 l1)))

% ici on défini i on fait des ronds noirs ou blancs
#(define (make-dot key)
   (ly:stencil-in-color
(ly:stencil-translate
 (make-circle-stencil 0.25 0.1 #f)
 (key-to-pos key))
(car (key-to-color key))
(cadr (key-to-color key))
(caddr (key-to-color key  % pour les ronds noirs


% ici on défini les couleurs R V B associés à chaque notes
#(define (key-to-color key )
   (let ((keycolor (caddr (assq key Color-KEY-LIST
 (if (not keycolor)
 (ly:error (_ "Color diagram error - unkown note '~a'") key)
 (caddr (assq key Color-KEY-LIST)

% ici on défini les positions des points du clavier en y
#(define (key-to-pos key )
   (let ((keypos (assq key KEY-POS-LIST)))
 (if (not keypos)
 (ly:error (_ "keyboard diagram error - unkown note '~a'") key)
 (caddr (assq key KEY-POS-LIST)

#(define KEY-POS-LIST
   '(
  (-8   .  '( 0  . 0))
  (-7   .  '( 0  . 1))
  (-6   .  '( 0  . 2))
  (-5   .  '( 0  . 3))
  (-4   .  '( 1  . 0))
  (-3   .  '( 1  . 1))
  (-2   .  '( 1  . 2))
  (-1   .  '( 1  . 3))
  (0   .  '( 0  . 0))
  (1   .  '( 0  . 1))
  (2   .  '( 0  . 2))
  (3   .  '( 0  . 3))
  (4   .  '( 1  . 0))
  (5   .  '( 1  . 1))
  (6   .  '( 1  . 2))
  (7   .  '( 1  . 3))
  (8   .  '( 0.71  . 1))
  (9   .  '( 0.71  . 1))
  (10  .  '( 0.71  . 1))
  (11  .  '( 0.71  . 1))
  (12  .  '( 0.71  . 1))
  (13  .  '( 0.71  . 1))
  (14  .  '( 0.71  . 1))
  (15  .  '( 0.71  . 1))
  (16  .  '( 0.71  . 1))
  (17  .  '( 0.71  . 1))
  (18  .  '( 0.71  . 1))
  (19  .  '( 0.71  . 1))
  (20  .  '( 0.71  . 1))
  (21  .  '( 0.71  . 1))
  (22  .  '( 0.71  . 1))
  (23  .  '( 0.71  . 1))
  ))


#(define Color-KEY-LIST
   '(
  (-11 .  '( 0.71 11))
  (-10 .  '( 0.71 11))
  (-9  .  '( 0.71 11))
  (-8  .  '( 0.71 11))
  (-7  .  '( 

Re: Apply a music-function script to all elements of a list

2017-05-10 Thread David Nalesnik
On Wed, May 10, 2017 at 9:23 AM, daviau ewen  wrote:

> Is that okay ? http://lilypond.1069038.n5.nabble.com/file/n203059/
> incdiato82.ly
>
>>
>>
Yes, thank you.

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


Re: Apply a music-function script to all elements of a list

2017-05-10 Thread David Nalesnik
Hi ewen.


On Wed, May 10, 2017 at 8:01 AM, zaord  wrote:
> Hi Simon,
>
> Thanks for your answer. I tryied to add a score in my file to have a
> bebugging compilable file.
>
> I get an error when I compile your code (join file) : Wrong type (expecting
> Stencil): (# # # # incdiato82.ly
>   > # # # #)
>
> If I take off the 'apply' from 'apply ly:stencil-add , then the lines you
> add works but not the make-dot-list function, and if I delete it, the
> make-dot-list works but not the background..

Could you please include an example which can be compiled?

I'd like to try to help, but I need to see all your code in a single
message, not scattered about a thread.

Best,

David

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


Re: Center-align a score

2017-05-06 Thread David Nalesnik
On Sat, May 6, 2017 at 6:40 PM, David Nalesnik  wrote:
> Kieren,
>
> On Thu, Apr 27, 2017 at 8:43 AM, Kieren MacMillan
>  wrote:
>> David,
>>
>>>> A little trial-and-error is required if doing it manually, but there might 
>>>> be a way to automate the process.
>>> Here you go:
>>
>> You da man! This is *exactly* what I was envisioning. Nicely done.
>>
>> Now…   ;)
>>
>> Perhaps there’s a way your new-found [?] knowledge/skill in this area can 
>> help with a long-time feature request I’ve had: an \offset-like way to nudge 
>> systems — especially the explicit Y-offset property, but also the 
>> alignment-distances if possible. Avoiding trial-and-error there would be a 
>> huge savings.
>>
>
> When 2.19.61 comes out, you'll be able to write

2.19.60, that would be.

>
> \overrideProperty
> Score.NonMusicalPaperColumn.line-break-system-details #'((extra-offset
> . (0.0 . 1.0)))
>
> to "nudge" a system one staff-space down the page, for example.
>
> That should be a bit easier to work with than 'Y-offset.
>
> DN

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


Re: Center-align a score

2017-05-06 Thread David Nalesnik
Kieren,

On Thu, Apr 27, 2017 at 8:43 AM, Kieren MacMillan
 wrote:
> David,
>
>>> A little trial-and-error is required if doing it manually, but there might 
>>> be a way to automate the process.
>> Here you go:
>
> You da man! This is *exactly* what I was envisioning. Nicely done.
>
> Now…   ;)
>
> Perhaps there’s a way your new-found [?] knowledge/skill in this area can 
> help with a long-time feature request I’ve had: an \offset-like way to nudge 
> systems — especially the explicit Y-offset property, but also the 
> alignment-distances if possible. Avoiding trial-and-error there would be a 
> huge savings.
>

When 2.19.61 comes out, you'll be able to write

\overrideProperty
Score.NonMusicalPaperColumn.line-break-system-details #'((extra-offset
. (0.0 . 1.0)))

to "nudge" a system one staff-space down the page, for example.

That should be a bit easier to work with than 'Y-offset.

DN

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


Re: Staccato Dot Size

2017-05-05 Thread David Nalesnik
On Fri, May 5, 2017 at 2:10 PM, Urs Liska  wrote:
>
>
> Am 5. Mai 2017 20:52:35 MESZ schrieb Karlin High :
>>On 5/5/2017 1:16 PM, Benjamin Strecker wrote:
>>> How would I go about globally reducing the size of the staccato dot?
>>
>>The solution is probably going to involve a \context { } block. Maybe
>>something like this:
>>
>>% BEGIN LILYPOND CODE
>>\version "2.19.59"
>>
>>\score {
>>   c'4 -.
>>
>>   \layout {
>> \context {
>>   \Score
>>   \override Script.font-size = #-2
>> }
>>   }
>>}
>>% END LILYPOND CODE
>
> This does *not* cover the condition to leave *other* scripts untouched.
>

The best way available to get at just the staccato dot would be
through the snippet here:

http://lilypond.org/doc/v2.19/Documentation/snippets/tweaks-and-overrides#tweaks-and-overrides-overriding-articulations-of-destinct-type

-David

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


Re: Center-align a score

2017-04-28 Thread David Nalesnik
On Fri, Apr 28, 2017 at 9:15 AM, Kieren MacMillan
 wrote:
> Hi Hendrik,
>
>> David N's solution works pretty well, although I, too, am having trouble 
>> with vertical positioning. In my attached min example, the lyrics came out 
>> wrong.
>
> That *is* a curious result…
>
> Naively, I would assume this is part of the same vertical spacing issue that 
> plagues me with regard to maintaining a predictable space below the last 
> lyric of a vocal group (because non-staff contexts aren’t considered, cf. 
> docs: “The distance between the last staff of the current staff-group and the 
> staff just below it in the same system, even if one or more non-staff lines 
> (such as Lyrics) exist between the two staves.”)
>
> I’ll be interested to see the diagnosis and fix.
> Sorry I couldn’t offer it myself: this is definitely above my pay-grade!
>

I would imagine the problem is the same one that I mentioned above in
the thread.  Calling ly:grob-extent to determine the printed width of
the staff causes side-effects.  I'm sorry, but I don't know of any way
to determine the staff width without running into this problem.

It would be relatively easy to alter the function make-page-stencil in
scm/page.scm to do what you want.  The stencils of the individual
systems are already made at this point, and it's just a matter of
moving them around to your liking.  Unfortunately, this requires a
change to program files.  I've had no luck copy/pasting code from that
file into the LY file.  It will be a lot--if it can even be
done--because so much of it is non-public.

Did you get a good result with the markup-based solutions?

Best,
David N

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


Re: relative offset of systems [WAS: Center-align a score]

2017-04-27 Thread David Nalesnik
On Thu, Apr 27, 2017 at 4:07 PM, David Nalesnik
 wrote:
> Hi Harm,
>
> On Thu, Apr 27, 2017 at 3:57 PM, Thomas Morley  
> wrote:
>> Hi David,
>>
>> nice stuff!
>>
>> Some comments, though:
>>
>> 2017-04-27 19:27 GMT+02:00 David Nalesnik :
>>> On Thu, Apr 27, 2017 at 12:22 PM, David Nalesnik
>>>  wrote:
>>>
>>>>
>>>> I'll just quote the relevant changes with some context.
>>>>
>>>> Within the function make-page-stencil:
>>>>
>>>> [...]
>>>>
>>
>> I see no advantage to add 'extra-y' to the arguments.
>> Why not do the calculation in 'add-system' ...
>
> Good point.  Actually, I already incorporated this suggestion in a
> patch I'm currently testing.  (Middle of make doc.)  I decided to use
> an "extra-offset" property which allows for displacements along both
> axes.
>
>>
>>>>  (add-to-page (lambda (stencil x y extra-y)
>>>
>>> Oh, "nota bene" the above line too!
>>>
>>>> (set! page-stencil
>>>>   (ly:stencil-add page-stencil
>>>> (ly:stencil-translate stencil
>>>>   (cons
>>>>(+
>>>> system-xoffset x)
>>>>(-
>>>> 0 y extra-y (prop 'top-margin))) ; NB
>>>>
>>>>   )
>>>>  (add-system
>>>>   (lambda (system)
>>>> (let* ((stencil (paper-system-stencil system))
>>>>(y (ly:prob-property system 'Y-offset 0))
>>>>(extra-y (ly:prob-property system 'extra-Y-offset 0)) ; NB
>>>>(is-title (paper-system-title?
>>>>   system)))
>>>>   (add-to-page stencil
>>>> (ly:prob-property system 'X-offset 0.0)
>>>> y
>>>> extra-y) ; NB
>>
>>
>> It will fail if system-separator-markup is used.
>>
>> Here my attempt (for comparison I added greyed stencils)
>>
>>  (add-system
>>   (lambda (system)
>> (let* ((stencil (paper-system-stencil system))
>>(y (ly:prob-property system 'Y-offset 0))
>>(extra-y (ly:prob-property system 'extra-Y-offset 0)) ;; NB
>>(is-title (paper-system-title?
>>   system)))
>>
>>  For comparison: print the greyed system-stencil without extra-y
>>   (add-to-page (stencil-with-color stencil '(0.8 0.8 0.8))
>> (ly:prob-property system 'X-offset 0.0)
>> y)
>>  The moved system-stencil
>>   (add-to-page stencil
>> (ly:prob-property system 'X-offset 0.0)
>> (+ y extra-y)) ;; NB
>>
>> (if (and (ly:stencil? system-separator-stencil)
>>  last-system
>>  (not (paper-system-title? system))
>>  (not (paper-system-title? last-system)))
>> (begin
>>  For comparison: print the greyed system-separator-stencil without 
>> 'extra-y
>>   (add-to-page
>>(stencil-with-color system-separator-stencil '(0.8 0.8 
>> 0.8))
>>0
>>
>>(average (- last-y
>>(car (paper-system-staff-extents 
>> last-system)))
>> (- y
>>(cdr (paper-system-staff-extents system)
>>
>>  The moved system-separator-stencil
>>   (add-to-page
>>system-separator-stencil
>>0
>>
>>(+
>>  (average (- last-y
>>  (car (paper-system-staff-extents 
>> last-system)))
>>   (- y
>>  (cdr (paper-system-staff-extents system
>>  (/ extra-y 2)  ;; NB
>> (set! last-system system)
>>  set last-y, taking extra-y into account
>> (set! last-y (+ y extra-y)  ;; NB
>>
>> 

Re: relative offset of systems [WAS: Center-align a score]

2017-04-27 Thread David Nalesnik
Hi Harm,

On Thu, Apr 27, 2017 at 3:57 PM, Thomas Morley  wrote:
> Hi David,
>
> nice stuff!
>
> Some comments, though:
>
> 2017-04-27 19:27 GMT+02:00 David Nalesnik :
>> On Thu, Apr 27, 2017 at 12:22 PM, David Nalesnik
>>  wrote:
>>
>>>
>>> I'll just quote the relevant changes with some context.
>>>
>>> Within the function make-page-stencil:
>>>
>>> [...]
>>>
>
> I see no advantage to add 'extra-y' to the arguments.
> Why not do the calculation in 'add-system' ...

Good point.  Actually, I already incorporated this suggestion in a
patch I'm currently testing.  (Middle of make doc.)  I decided to use
an "extra-offset" property which allows for displacements along both
axes.

>
>>>  (add-to-page (lambda (stencil x y extra-y)
>>
>> Oh, "nota bene" the above line too!
>>
>>> (set! page-stencil
>>>   (ly:stencil-add page-stencil
>>> (ly:stencil-translate stencil
>>>   (cons
>>>(+
>>> system-xoffset x)
>>>(-
>>> 0 y extra-y (prop 'top-margin))) ; NB
>>>
>>>   )
>>>  (add-system
>>>   (lambda (system)
>>> (let* ((stencil (paper-system-stencil system))
>>>(y (ly:prob-property system 'Y-offset 0))
>>>(extra-y (ly:prob-property system 'extra-Y-offset 0)) ; NB
>>>(is-title (paper-system-title?
>>>   system)))
>>>   (add-to-page stencil
>>> (ly:prob-property system 'X-offset 0.0)
>>> y
>>> extra-y) ; NB
>
>
> It will fail if system-separator-markup is used.
>
> Here my attempt (for comparison I added greyed stencils)
>
>  (add-system
>   (lambda (system)
> (let* ((stencil (paper-system-stencil system))
>(y (ly:prob-property system 'Y-offset 0))
>(extra-y (ly:prob-property system 'extra-Y-offset 0)) ;; NB
>(is-title (paper-system-title?
>   system)))
>
>  For comparison: print the greyed system-stencil without extra-y
>   (add-to-page (stencil-with-color stencil '(0.8 0.8 0.8))
> (ly:prob-property system 'X-offset 0.0)
> y)
>  The moved system-stencil
>   (add-to-page stencil
> (ly:prob-property system 'X-offset 0.0)
> (+ y extra-y)) ;; NB
>
> (if (and (ly:stencil? system-separator-stencil)
>  last-system
>  (not (paper-system-title? system))
>  (not (paper-system-title? last-system)))
> (begin
>  For comparison: print the greyed system-separator-stencil without 
> 'extra-y
>   (add-to-page
>(stencil-with-color system-separator-stencil '(0.8 0.8 
> 0.8))
>0
>
>(average (- last-y
>(car (paper-system-staff-extents last-system)))
> (- y
>(cdr (paper-system-staff-extents system)
>
>  The moved system-separator-stencil
>   (add-to-page
>system-separator-stencil
>0
>
>(+
>  (average (- last-y
>  (car (paper-system-staff-extents 
> last-system)))
>   (- y
>  (cdr (paper-system-staff-extents system
>  (/ extra-y 2)  ;; NB
> (set! last-system system)
>  set last-y, taking extra-y into account
> (set! last-y (+ y extra-y)  ;; NB
>
> As an example I used:
>
> \paper {
>   system-separator-markup = \slashSeparator
>   ragged-last-bottom = ##t
> }
> top = \repeat unfold 5 { c''4 d'' e'' f'' }
>
> bottom = {
>   \clef bass
>   \repeat unfold 5 { c,1 }
>   \break
> }
>
> \new PianoStaff <<
>   \new Staff {
> \top
> \top
> \top
>   }
>   \new Staff {
> \bottom
> \overrideProperty
> Score.NonMusicalPaperColumn.line-break-system-details
> #'((extra-Y-offset . 2))
> \bottom
> \overrideProperty
> Score.NonMusicalPaperColumn.line-break-system-details
> #'((extra-Y-offset . 5))
> \bottom
>   }
>>>
>
> png attached
>

Thanks so much for pointing this out.  I didn't notice that the
variable "y" was used elsewhere.  As soon as the patch testing has run
its course, I'll add this in.

Wish I could use the greyed background in the regtest, but that's not possible.

Best,
David

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


Re: relative offset of systems [WAS: Center-align a score]

2017-04-27 Thread David Nalesnik
On Thu, Apr 27, 2017 at 12:22 PM, David Nalesnik
 wrote:

>
> I'll just quote the relevant changes with some context.
>
> Within the function make-page-stencil:
>
> [...]
>
>  (add-to-page (lambda (stencil x y extra-y)

Oh, "nota bene" the above line too!

> (set! page-stencil
>   (ly:stencil-add page-stencil
> (ly:stencil-translate stencil
>   (cons
>(+
> system-xoffset x)
>(-
> 0 y extra-y (prop 'top-margin))) ; NB
>
>   )
>  (add-system
>   (lambda (system)
> (let* ((stencil (paper-system-stencil system))
>(y (ly:prob-property system 'Y-offset 0))
>(extra-y (ly:prob-property system 'extra-Y-offset 0)) ; NB
>(is-title (paper-system-title?
>   system)))
>   (add-to-page stencil
> (ly:prob-property system 'X-offset 0.0)
> y
> extra-y) ; NB
>
> [...]
>


-DN:

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


relative offset of systems [WAS: Center-align a score]

2017-04-27 Thread David Nalesnik
On Thu, Apr 27, 2017 at 8:43 AM, Kieren MacMillan
 wrote:
> David,
>
> Perhaps there’s a way your new-found [?] knowledge/skill in this area can 
> help with a long-time feature request I’ve had: an \offset-like way to nudge 
> systems — especially the explicit Y-offset property, but also the 
> alignment-distances if possible. Avoiding trial-and-error there would be a 
> huge savings.
>
> Thanks,
> Kieren.
>

A little experiment leaves me hopeful.

(So far) it looks like it's a relatively simple matter to add another
line-break-system-detail: "extra-Y-offset" which will move a system
from its calculated position (whether left to the default, or
positioned with 'Y-offset).

Just like an explicit setting of Y-offset, it will act without regard
to vertical collisions.

To try this out, you will (unfortunately) either need to (1) apply the
attached patch or (2) make changes to your scm/page.scm by hand.  (I'd
suggest commenting out the original make-page-stencil with #!  [...]
!# and adding a copy with the changes, so it's easy to revert if need
be.)

I'll just quote the relevant changes with some context.

Within the function make-page-stencil:

[...]

 (add-to-page (lambda (stencil x y extra-y)
(set! page-stencil
  (ly:stencil-add page-stencil
(ly:stencil-translate stencil
  (cons
   (+
system-xoffset x)
   (-
0 y extra-y (prop 'top-margin))) ; NB

  )
 (add-system
  (lambda (system)
(let* ((stencil (paper-system-stencil system))
   (y (ly:prob-property system 'Y-offset 0))
   (extra-y (ly:prob-property system 'extra-Y-offset 0)) ; NB
   (is-title (paper-system-title?
  system)))
  (add-to-page stencil
(ly:prob-property system 'X-offset 0.0)
y
extra-y) ; NB

[...]

%%

Try it out with this:

%%
top = \repeat unfold 5 { c''4 d'' e'' f'' }

bottom = {
  \clef bass
  \repeat unfold 5 { c,1 }
  \break
}

\new PianoStaff <<
  \new Staff {
\top
\top
\top
  }
  \new Staff {
\bottom
\overrideProperty
Score.NonMusicalPaperColumn.line-break-system-details
#'((extra-Y-offset . -2))
\bottom
\overrideProperty
Score.NonMusicalPaperColumn.line-break-system-details
#'((extra-Y-offset . 12))
\bottom
  }
>>
%%%

Sorry for the awkwardness, but I hope this is useful to you!

-David


0001-Allow-extrs-y-offset-for-systems.patch
Description: Binary data
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Center-align a score

2017-04-27 Thread David Nalesnik
On Thu, Apr 27, 2017 at 8:43 AM, Kieren MacMillan
 wrote:
> David,
>
>>> A little trial-and-error is required if doing it manually, but there might 
>>> be a way to automate the process.
>> Here you go:
>
> You da man! This is *exactly* what I was envisioning. Nicely done.
>
> Now…   ;)
>
> Perhaps there’s a way your new-found [?] knowledge/skill in this area can 
> help with a long-time feature request I’ve had: an \offset-like way to nudge 
> systems — especially the explicit Y-offset property, but also the 
> alignment-distances if possible. Avoiding trial-and-error there would be a 
> huge savings.
>

Well, the horizontal is a much different beast than the vertical.
Horizontal is easy in LilyPond, vertical not at all so.

Directly contradicting what I just wrote, there is an issue with
vertical positioning in my little experiment.  Try this:

\version "2.19.59"

\paper {
  ragged-right = ##t
  indent = 0
}

\layout {
  \context {
\Score
\override NonMusicalPaperColumn.after-line-breaking =
#(lambda (grob)
   (if (eqv? (ly:item-break-dir grob) 1) ; line beginning
   (let* ((sys (ly:grob-system grob))
  (sys-width (ly:grob-extent sys sys X))
  (layout (ly:grob-layout grob))
  (line-full-width (ly:output-def-lookup layout 'line-width)))
 (ly:grob-set-nested-property! grob
'(line-break-system-details X-offset)
   (/ (- line-full-width (interval-length sys-width)) 2)
  }
}

music = {
  \repeat unfold 500 { c,4 }
}

\score { \music }

%%

Notice that with the override, systems are placed lower on the page
and the bottom margin is lost.

The problem occurs with the call to ly:grob-extent.  In my experience,
calling this function for the X-axis doesn't result in (visible) side
effects, but here they are.

-DN

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


Re: Center-align a score

2017-04-26 Thread David Nalesnik
On Wed, Apr 26, 2017 at 3:08 PM, Kieren MacMillan
 wrote:
> Hi all,
>
>> I think this request is idiosyncratic enough to be left to a
>> two-stage process, some thing along the lines of:
>
> That would work, of course… but I think it would be easier (and better for 
> long-term maintainability) to do it all in Lilypond, e.g.,
>
> %%  SNIPPET BEGINS
> \version "2.19.17"
>
> \paper {
>   ragged-right = ##t
>   indent = 0
> }
>
> music = {
>   \overrideProperty Score.NonMusicalPaperColumn.line-break-system-details 
> #'((X-offset . 38))
>   \repeat unfold 8 c'' \break
>   \overrideProperty Score.NonMusicalPaperColumn.line-break-system-details 
> #'((X-offset . 33))
>   \repeat unfold 12 c'' \break
>   \overrideProperty Score.NonMusicalPaperColumn.line-break-system-details 
> #'((X-offset . 46))
>   \repeat unfold 4 c'' \break
>   \overrideProperty Score.NonMusicalPaperColumn.line-break-system-details 
> #'((X-offset . 39.5))
>   \repeat unfold 8 c'' \break
> }
>
> \score { \music }
> %%  SNIPPET ENDS
>
> A little trial-and-error is required if doing it manually, but there might be 
> a way to automate the process.
>

Here you go:

%

\version "2.19"

\paper {
  ragged-right = ##t
  indent = 0
}

\layout {
  \context {
\Score
\override NonMusicalPaperColumn.after-line-breaking =
#(lambda (grob)
   (if (eqv? (ly:item-break-dir grob) 1) ; line beginning
   (let* ((sys (ly:grob-system grob))
  (sys-width (ly:grob-extent sys sys X))
  (layout (ly:grob-layout grob))
  (line-full-width (ly:output-def-lookup layout 'line-width)))
 (ly:grob-set-nested-property! grob
'(line-break-system-details X-offset)
   (/ (- line-full-width (interval-length sys-width)) 2)
  }
}

music = {
  \repeat unfold 8 c'' \break
  \repeat unfold 12 c'' \break
  \repeat unfold 4 c'' \break
  \repeat unfold 8 c'' \break
}

\score { \music }

%%

Hope this helps,

David

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


Re: is the lyric tie tweakable?

2017-04-25 Thread David Nalesnik
On Tue, Apr 25, 2017 at 7:45 PM, David Nalesnik
 wrote:
> On Tue, Apr 25, 2017 at 7:16 PM, Kieren MacMillan
>  wrote:
>> Hi David,
>>
>>> \markup \tied-lyric \override #'(word-space . 2) #"le,~au”
>>
>> Bingo! Didn’t even need to add the extra parameters!
>>
>>> Don't know at the moment how to make this less cumbersome.
>>
>> I don’t need this to be less cumbersome — this completely solves my original 
>> problem.
>> (But this exercise did serve to fractionally increase my Scheme-fu…)
>>
>
> Nice to hear!
>
> In any case, here's an experiment.  It allows for varying the
> parameters within the lyricmode expression:
>
> \version "2.19.59"
>
> #(define (lyric-text::special-print overrides)
>(lambda (grob)
>  (let ((text (ly:grob-property grob 'text)))
>(grob-interpret-markup
> grob
> (if (string? text)
> (fold
>  make-override-markup
>  (make-tied-lyric-markup text)
>  overrides)
> text)
>
> tiedLyricOverrides =
> #(define-music-function (overrides) (list?)
>#{
>  \override Lyrics.LyricText.stencil = #(lyric-text::special-print 
> overrides)
>#})
> {
>   \relative {
> \autoBeamOff
> r8 b' c fis, fis c' b e,
>   }
>   \addlyrics {
> \tiedLyricOverrides #'((word-space . 5) (left-pad . 3))
> Che~in ques -- ta~e~in quel -- l'al -- tr'on -- da
>   }
> }
>
> %%
>
> Of course, you'd need to add the left-pad property and functionality
> to \tied-lyric for it to have any effect.
>

One more thing: you can use \once too.

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


Re: is the lyric tie tweakable?

2017-04-25 Thread David Nalesnik
On Tue, Apr 25, 2017 at 7:16 PM, Kieren MacMillan
 wrote:
> Hi David,
>
>> \markup \tied-lyric \override #'(word-space . 2) #"le,~au”
>
> Bingo! Didn’t even need to add the extra parameters!
>
>> Don't know at the moment how to make this less cumbersome.
>
> I don’t need this to be less cumbersome — this completely solves my original 
> problem.
> (But this exercise did serve to fractionally increase my Scheme-fu…)
>

Nice to hear!

In any case, here's an experiment.  It allows for varying the
parameters within the lyricmode expression:

\version "2.19.59"

#(define (lyric-text::special-print overrides)
   (lambda (grob)
 (let ((text (ly:grob-property grob 'text)))
   (grob-interpret-markup
grob
(if (string? text)
(fold
 make-override-markup
 (make-tied-lyric-markup text)
 overrides)
text)

tiedLyricOverrides =
#(define-music-function (overrides) (list?)
   #{
 \override Lyrics.LyricText.stencil = #(lyric-text::special-print overrides)
   #})
{
  \relative {
\autoBeamOff
r8 b' c fis, fis c' b e,
  }
  \addlyrics {
\tiedLyricOverrides #'((word-space . 5) (left-pad . 3))
Che~in ques -- ta~e~in quel -- l'al -- tr'on -- da
  }
}

%%

Of course, you'd need to add the left-pad property and functionality
to \tied-lyric for it to have any effect.

Hope this is useful.  I'm not sure!

David

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


Re: is the lyric tie tweakable?

2017-04-25 Thread David Nalesnik
On Tue, Apr 25, 2017 at 6:38 PM, Kieren MacMillan <
kieren_macmil...@sympatico.ca> wrote:

> Hi David,
>
> \override is actually a markup command here,
>
> and as such needs to be preceded by \markup.
>
>
> But then it doesn’t execute the lyric tie function *at all*:
>
>
>
>
\markup \tied-lyric \override #'(word-space . 2) #"le,~au"

Don't know at the moment how to make this less cumbersome.

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


Re: is the lyric tie tweakable?

2017-04-25 Thread David Nalesnik
On Tue, Apr 25, 2017 at 5:50 PM, Kieren MacMillan
 wrote:
> Hi David,
>
>> These properties are accessed like
>> \override #'(left-pad . -1)
>> as any markup override.
>
> I tried that, of course — it returns
>
> error: not a key
>   \override
> #'(left-pad . -1) le,~au soir, __ à __ la chan -- del -- le, __
>
> This is in a \lyricmode block, if that makes a difference.
>

\override is actually a markup command here, and as such needs to be
preceded by \markup.

-David

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


Re: is the lyric tie tweakable?

2017-04-25 Thread David Nalesnik
On Tue, Apr 25, 2017 at 4:09 PM, Kieren MacMillan
 wrote:
> Hi David (et al.),
>
 Is the built-in** lyric tie/elision tweakable?
>>
>>> There's no LyricTie grob, so no convenient way to tweak it.   You
>>> could modify "tied-lyric" in scm/define-markup-commands.scm, since
>>> that's what's engaged with the tilde.
>>
>> I can’t seem to figure out how to add left-pad and right-pad as properties 
>> (with default 0)
>
> Okay, I believe I’ve solved that problem:
>
>   #:properties ((word-space)
> (left-pad 0)
> (right-pad 0))
>
> But how do I tweak the parameter in my input? I’ve tried things like
>
> \tweak left-pad #-1 le,~au
>

These properties are accessed like

\override #'(left-pad . -1)

as any markup override.

-David

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


Re: strict notespacing with lyrics

2017-04-24 Thread David Nalesnik
On Mon, Apr 24, 2017 at 11:13 AM, Kieren MacMillan
 wrote:
> Abraham,
>
>> So, the real question is this: can we make LyricText.self-alignment-X 
>> dynamic instead of static? In other words, can we use a springs-like 
>> mechanism between LyricText syllables, but that are more flexible than the 
>> springs-and-rods between NoteColumns? That way, the NoteColumns would more 
>> likely get into their normal rhythmic positions and the LyricText grobs 
>> could float horizontally a bit, pushing each other around within their -1 to 
>> 1 self-alignment-X range.
>
> This sounds really familiar…  ;)
>
>> Looking forward to everyone's thoughts on the matter.
>
> Love the basic idea — now let’s polish it, and implement it!
>
> 1. There should be a way to “group” a set of notes [with attached lyrics] — 
> from 2 adjacent notes all the way up to “the whole score” — and then set the 
> rigidity of the note-springs and lyric-springs as separate parameters.
>
> 2. There should be a parameter for how much “flex" the block has. Say you set 
> notes.spring-rigidity = #1, so that Lilypond forces the notes to be “in 
> perfect proportion” (essentially ignoring the lyrics). If the block of lyrics 
> underneath are (e.g.) twice as wide as the set of notes, it would be nice for 
> Lilypond to take that into account. Naively: perhaps Lily should try to 
> compute the minimum amount of horizontal space required for the associated 
> lyrics, and use that width as a ‘frame’ in which the notes are then 
> distributed “perfectly”?
>

This seems to me to be an extremely complex undertaking, involving a
rewrite of a lot of spacing code.  I would vote to implement something
more modest, a simple adjustment of self-alignment-X, as per Abraham's
suggestion.  Much more likely to get takers.

Maybe we could revive the stalled lyric project?  Janek did a lot of
work breaking lyric issues down into manageable chunks.

My 2 cents...

David

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


Re: Hairpin endings

2017-04-23 Thread David Nalesnik
On Sun, Apr 23, 2017 at 6:15 PM, Thomas Morley  wrote:
> 2017-04-23 12:34 GMT+02:00 Andrew Bernard :
>
>> Next thing to do is to achieve the half dashed/half solid appearance - or
>> can this be done already, in the same way that slurs can?
>
> How about:

This is great!

>
> #(define (solid-dashed-print-proc grob startx starty endx endy)
>   (let* ((dash-def (ly:grob-property grob 'dash-definition))
>  (thick
>(* (layout-line-thickness grob)
>   (ly:grob-property grob 'thickness 0.1
> (if (null? dash-def)
> (ly:line-interface::line grob startx starty endx endy)
> (apply ly:stencil-add empty-stencil

Why not reduce instead of apply?  Tiny point, but then you won't have
the extra empty stencil in the stencil expression.

>   (map
> (lambda (dash-def-elt)
>   (let* ((start-x
>(+ startx (* (- endx startx) (first dash-def-elt
>  (start-y
>(+ starty (* (- endy starty) (first dash-def-elt
>  (end-x
>(+ startx (* (- endx startx) (second dash-def-elt
>  (end-y
>(+ starty (* (- endy starty)  (second dash-def-elt)
> (ly:stencil-translate
>   (ly:make-stencil
> (list 'dashed-line
>   ;; thickness
>   thick
>   ;; on
>   (third dash-def-elt)
>   ;; off
>   (- 1 (fourth dash-def-elt)) ;; calculation correct?
>   ;; x-dest
>   (- end-x start-x)
>   ;; y-dest
>   (- end-y start-y)
>   ;; phase
>   0)
> ;; x-ext
> (cons start-x (- end-x start-x))
> ;; y-ext
> (ordered-cons 0 (- end-y start-y)))
>   (cons start-x start-y
> dash-def)
>
> #(define ((open-hairpin open-gap close-gap) grob)
>(let* ((stencil (ly:hairpin::print grob))
>   (thick (layout-line-thickness grob))
>   (dir (ly:grob-property grob 'grow-direction))
>   (X-ext (ly:stencil-extent stencil X))
>   (Y-ext (ly:stencil-extent stencil Y))
>   (width (- (interval-length X-ext) thick))
>   (height (- (interval-length Y-ext) thick))
>   (scaled-height (* height (max open-gap close-gap)))
>   (scaled-gap (* height (min open-gap close-gap)))
>   (upper-stil-part
> (solid-dashed-print-proc
>   grob
>   0
>   (/ (if (= dir -1) scaled-height scaled-gap) 2)
>   width
>   (/ (if (= dir -1) scaled-gap scaled-height) 2
>  (ly:stencil-translate
>(ly:stencil-add
>  upper-stil-part
>  (ly:stencil-scale upper-stil-part 1 -1))
>(cons (interval-start X-ext) (interval-start Y-ext)
>
> {
>   c'1\> c'1 c'1\!
>   \once \override Hairpin.dash-definition =
> #'((0  0.300.4)
>(0.30.711)
>(0.71.00.4  0.75))
>   %% order of arguments for 'open-hairpin' doesn't matter!
>   \override Hairpin.stencil = #(open-hairpin 0.2 1.0)
>   c'1\fff\> c'1 c'2 c'2\\!
>   \once \override Hairpin.dash-definition =
> #'((0  0.300.4)
>(0.30.4511)
>(0.71.00.4  0.3))
>   \once \override Hairpin.thickness = 2
>   c'1\< c'1 c'1\!
>   \revert Hairpin.dash-definition
>   \override Hairpin.style = #'dashed-line
>   \once \override Hairpin.stencil = #(open-hairpin 1.0 0.5)
>   c'1\> c'1 c'1\!
>   \override Hairpin.dash-fraction = 0.3
>   \override Hairpin.dash-period = 1.5
>   \once \override Hairpin.stencil = #(open-hairpin 0.5 0.0)
>   c'1-\tweak thickness 3 \> c'1 c'1\!
> }
>
> HTH,
>   Harm

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


Re: Hairpin endings

2017-04-23 Thread David Nalesnik
On Sun, Apr 23, 2017 at 5:34 AM, Andrew Bernard
 wrote:
> Hi David and Nathan,
>
> Apologies for a tardy response.
>
> Sincere thanks to both of you for your work on this. It's really useful to
> me. I prefer using the ly:line-interface::line version because of the way it
> inherits the grob properties.
>
> David, you naturally asked for the use cases I have for this, because it is
> very non-standard, for sure. There are several situations where this comes
> up in the scores I set. One common case is where the composer indicates a
> very long cresc. or decresc. between levels with open hairpins near an
> absolute mark such as ff, rather than cluttering page after page with
> immensely long hairpins. The attached snippet of an image gives some idea of
> this.

Thanks -- makes a lot more sense to me now.

>
> Once more, sincere thanks and appreciation.
>
> Next thing to do is to achieve the half dashed/half solid appearance - or
> can this be done already, in the same way that slurs can?
>

Not currently.  I suppose the best way would be to allow for
dash-definition in lily/line-interface.cc, so it could be read from
the grob.  But you could go the replacement stencil route.  I'm
guessing that you could make good use of Harm's code above as a
framework.

No time right now, but I should post my Scheme version of
ly:hairpin::print, so you can meddle directly with hairpins without
building a stencil solely for dimension info, then throwing it away.

-David

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


Re: Lines to edges of \center-column

2017-04-22 Thread David Nalesnik
On Sat, Apr 22, 2017 at 5:56 PM,   wrote:
> This is great, thanks! I was trying to mess around with \hbracket and
> \whiteout, but this is far better.
>
> Just a few questions:
> Is it possible to scale the protrusions (and other things) by font size?
> How can I change the color of the lines?
> What does "mols" mean?

I'd guess "molecules," referring here to stencils.  I've seen "atom"
used in Scheme programming.  In any case, I just copied from the
source.

Looks like you answered your other questions below

Best,
David

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


Re: Lines to edges of \center-column

2017-04-22 Thread David Nalesnik
On Sat, Apr 22, 2017 at 3:22 PM,   wrote:
> Is there some way to make a center-column draw lines from slightly outside
> the text to the edges of the column (see example)?
>
> In this specific case, I have both English and Japanese names for stuff, and
> without those lines, I think it's a bit unclear exactly what part the
> Japanese refers to.
>
> ```
> subtitle = \markup \bold \large \line {
>   "from"
>   \center-column {
> "Legend of Heroes"
> \smaller \smaller \smaller
> "英雄伝説"
>   }
>   "VI:"
>   \center-column {
> "Trails in the Sky"
> \smaller \smaller \smaller
> "空の軌跡"
>   }
> }
> ```

Try this:

\version "2.19.59"

% based on general-column from scm/define-markup-commands.scm
#(define (general-column align-dir baseline mols)
   (let* ((aligned-mols
   (map (lambda (x) (ly:stencil-aligned-to x X align-dir))
 mols))
  (max-extent (ly:stencil-extent (car aligned-mols) X))
  (aligned-mols
   (cons (car aligned-mols)
 (map (lambda (x)
(let ((stil-ext (ly:stencil-extent x X)))
  (ly:stencil-add
   (make-line-stencil 0.1 (car max-extent) 0 (1-
(car stil-ext)) 0)
   (make-line-stencil 0.1 (1+ (cdr stil-ext)) 0
(cdr max-extent) 0)
   (make-line-stencil 0.1 (car max-extent) 0 (car
max-extent) 1.5)
   (make-line-stencil 0.1 (cdr max-extent) 0 (cdr
max-extent) 1.5)
   x)))
   (cdr aligned-mols
  (stacked-stencil (stack-lines -1 0.0 baseline aligned-mols))
  (stacked-extent (ly:stencil-extent stacked-stencil X)))
 (ly:stencil-translate-axis stacked-stencil (- (car stacked-extent)) X)))

#(define-markup-command (center-column layout props args)
   (markup-list?)
   #:category align
   #:properties ((baseline-skip))
   (general-column CENTER baseline-skip (interpret-markup-list layout
props args)))

\header {
  subtitle = \markup \bold \large \line {
"from"
\center-column {
  "Legend of Heroes"
  \smaller \smaller \smaller
  "英雄伝説"
  "英雄伝説"
  \huge
  "英雄伝説"
}
"VI:"
\center-column {
  "Trails in the Sky"
  \smaller \smaller \smaller
  "空の軌跡"
}
  }
}

{ c }

You might want to adjust some of the hard-coded values
(line-thickness, length of "protrusions," offset of bracket from
text), but this should get you started.

-David

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


Re: Hairpin endings

2017-04-21 Thread David Nalesnik
Hi Nathan,

On Fri, Apr 21, 2017 at 12:54 PM, Nathan Ho  wrote:
> On 2017-04-21 05:39, David Nalesnik wrote:
>>
>> Instead of using a markup, why not use ly:line-interface::line
>> (available from 2.19.27)? This gets thickness from the grob--and any
>> other line attributes you want, so you can create dashed hairpins,
>> whatever.  There's no need adjust thickness in this case.
>
>
> Hi David,
>
> Thanks for the info. I still prefer markups for this kind of thing because
> more people understand them and they're (somewhat) better documented. Less
> ly:foo stuff I have to look up, the better. Good to know the proper way
> though!
>

OK, I see.

Anyway, in case anyone wonders, here is how your function would look:

\version "2.19.59"

#(define ((open-hairpin left-open right-open) grob)
   (let* ((stencil (ly:hairpin::print grob))
  (X-ext (ly:stencil-extent stencil X))
  (Y-ext (ly:stencil-extent stencil Y))
  (width (interval-length X-ext))
  (height (interval-length Y-ext)))
 (ly:stencil-translate
  (ly:stencil-add
   (ly:line-interface::line
 grob
 0 (* height (- 0.5 (* 0.5 left-open)))
 width (* height (- 0.5 (* 0.5 right-open
   (ly:line-interface::line
grob
0 (* height (+ 0.5 (* 0.5 left-open)))
width (* height (+ 0.5 (* 0.5 right-open)
 (cons 0 (interval-start Y-ext)

{
  c'1\> c'1 c'1\!
  \once \override Hairpin.stencil = #(open-hairpin 1.0 0.5)
  c'1\> c'1 c'1\!
  \once \override Hairpin.stencil = #(open-hairpin 0.5 0.0)
  c'1\> c'1 c'1\!
  \override Hairpin.style = #'dashed-line
  \once \override Hairpin.stencil = #(open-hairpin 1.0 0.5)
  c'1\> c'1 c'1\!
  \once \override Hairpin.stencil = #(open-hairpin 0.5 0.0)
  c'1-\tweak thickness 3 \> c'1 c'1\!
}

%%%

-David

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


Re: Hairpin endings

2017-04-21 Thread David Nalesnik
Hi,

On Fri, Apr 21, 2017 at 1:07 AM,   wrote:
> Am 2017-04-21 07:41, schrieb Nathan Ho:
>>
>> On 2017-04-20 20:42, Andrew Bernard wrote:
>>>
>>> I posted a while ago with a query about hairpins, to which no
>>> response.
>>>
>>> Would there be any way to have hairpins that don't start, or end in
>>> the other direction, with the lines converging to the same point? I
>>> have need from time to time of hairpins where the end points are still
>>> separated, rather than coming to a termination together. Sure this can
>>> be done with a whiteout box, but that is always fiddly and the
>>> position tends to move when the score is repaginated etc etc. In the
>>> same way as the 'height' property allows you to specify the separation
>>> at the open end, it would be useful to have some property for this
>>> sort of thing at the pointy end. Yes, definitely not Common Era
>>> engraving practice, but this keeps coming up in the New Complexity
>>> scores I work with.

Besides Nathan's code below, you might be able to use the
"Ferneyhough" hairpins.

Can you provide an usage example of these partial hairpins?  How would
they behave over line breaks?

>>
>> hi andrew,
>>
>> check it out:
>>
>> #(define ((open-hairpin left-open right-open) grob)
>>(let* ((stencil (ly:hairpin::print grob))
>>   (X-ext (ly:stencil-extent stencil X))
>>   (Y-ext (ly:stencil-extent stencil Y))
>>   (width (interval-length X-ext))
>>   (height (interval-length Y-ext)))
>>  (ly:stencil-translate
>>(grob-interpret-markup grob
>>  (markup
>>(#:path 0.1
>>  (list (list 'moveto 0 (* height (- 0.5 (* 0.5 left-open
>>(list 'lineto width (* height (- 0.5 (* 0.5
>> right-open
>>(list 'moveto 0 (* height (+ 0.5 (* 0.5 left-open
>>(list 'lineto width (* height (+ 0.5 (* 0.5
>> right-open
>>(cons 0 (interval-start Y-ext)
>>
>> {
>>   c'1\> c'1 c'1\!
>>   \once \override Hairpin.stencil = #(open-hairpin 1.0 0.5)
>>   c'1\> c'1 c'1\!
>>   \once \override Hairpin.stencil = #(open-hairpin 0.5 0.0)
>>   c'1\> c'1 c'1\!
>> }
>>
>> respects height, but not thickness. anyone know how to convert a
>> thickness value into staff spaces?
>
>
> If I'm not mistaken this actually is a missing piece of information in
> LilyPond.
> The thickness is interpreted as relative to the staffline thickness, and
> there's no general property for it.
> It should be possible to use something like (untested)
>
> (hairpin-thickness (* (ly:staff-symbol-line-thickness grob)
> (ly:grob-property grob 'thickness)))
>
> in the let-block and use hairpin-thickness in the markup generation.
>

Yes, this would work

Instead of using a markup, why not use ly:line-interface::line
(available from 2.19.27)? This gets thickness from the grob--and any
other line attributes you want, so you can create dashed hairpins,
whatever.  There's no need adjust thickness in this case.

HTH,
David

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


Re: is the lyric tie tweakable?

2017-04-20 Thread David Nalesnik
On Thu, Apr 20, 2017 at 6:02 PM, Kieren MacMillan
 wrote:
> Hi all,
>
> Is the built-in** lyric tie/elision tweakable? I’ve found that the 
> kerning/positioning changes fairly dramatically depending on the font being 
> used. I’d like to try to set its position globally (rather than having to 
> adjust each lyric pair it appears under), but couldn’t find the appropriate 
> grobs/interfaces/properties to attack.
>
> Thanks,
> Kieren.
>
> ** I know I can roll my own undertie glyph — I was doing that as early as 
> 2006 — but I’d rather adjust the built-in glyph/curve.
> 
>

There's no LyricTie grob, so no convenient way to tweak it.   You
could modify "tied-lyric" in scm/define-markup-commands.scm, since
that's what's engaged with the tilde.

-David

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


<    1   2   3   4   5   6   7   8   9   10   >