Re: openLilyLib website

2020-02-22 Thread Urs Liska
Am Freitag, den 21.02.2020, 18:52 -0800 schrieb ma...@masonhock.com:
> On 02/20, Urs Liska wrote:
> > What I really *want* to have but have no idea so far how to achieve
> > is
> > additional code/API documentation retrieved from the actual source
> > files. There should be a tool to retrieve that from comments (or
> > actual
> > signatures?), resulting in either HTML or Markdown documentation
> > that
> > can be automatically integrated in the "manual-style"
> > documentation.
> 
> Do you want something similar [Sphinx][1] or [Doxygen][2]?  

Yes, something similar, but IISC these tools (which I had of course
taken notice of earlier) are limited to their set of languages.
Parsing documentation comments or docstrings and producing API
reference is what is still needed.

One aspect that might be different from "traditional" API reference
documentation in a case like openLilyLib (also like LaTeX packages) is
that there are *end-user*-facing commands and *internal* commands.
Internal commands (i.e. auxiliary functions) may or may not be
interesting for users outside the package development, but probably the
documentation should be kept separate in some way. For example by
providing totally separate pages/trees or listing the end-user
functionality first on a page, followed by the internal stuff. In
addition I think the end-user functionality whould be documented on a
package-based page while the internal API should be documented per
source file. But I haven't fully thought through that topic yet.

Craig Dabelstein did some research and suggested NaturalDocs (
https://www.naturaldocs.org/) which looks nice and suitably
extensible/configurable for our purpose. I'm a little bit wary about
the fact that it's a project with a single contributor, and I know what
I'm talking about ...
(also I *think* it would be good to have a Python-based tool because it
might be easier to extend and to integrate with the other stuff.

> Are the
> source files in Scheme, Lilypond, or a combination of both?

Of course both.
The end-user interface is usually LilyPond, but the functionality is 
all LilyPond, Scheme-in-LilyPond, and Scheme-in-Scheme-files.

Urs

> 
> [1]: https://en.wikipedia.org/wiki/Sphinx_(documentation_generator)
> 
> [2]: https://en.wikipedia.org/wiki/Doxygen




Chord options in leadsheets

2020-02-22 Thread hendry.mich...@gmail.com
 

I use Lilypond to prepare jazz leadsheets. Most of the time, this is
straightforward, but the screenshot illustrates three additions I'd like to
be able to include.

1. The ability to provide alternative chords (shown in parentheses above the
first two bars).
2. The ability to indicate optional modifications, as in Am7(b5) and D7(#5).
3. Putting in an optional turnaround (the G7 in the last bar). This is a
special case of 1., where the chord from the previous bar is carried through
if the option isn't taken.

There has been some discussion of these ideas some years back, but it
appears to have petered out, possibly because the posters have resolved
their problems, or perhaps because they got fed up trying!



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



Re: Chord options in leadsheets

2020-02-22 Thread Wols Lists
On 22/02/20 09:11, hendry.mich...@gmail.com wrote:
> 
>  
> 
> I use Lilypond to prepare jazz leadsheets. Most of the time, this is
> straightforward, but the screenshot illustrates three additions I'd like to
> be able to include.
> 
> 1. The ability to provide alternative chords (shown in parentheses above the
> first two bars).

I tried to do this, and it didn't get accepted. I struggle with Scheme
and the more esoteric lilypond syntax. That said, I did get it working,
what it needed was clean-up.

I attach the patches, if you or someone else would like to take it on
and get it in ...

Cheers,
Wol
>From 60972eafba7f58fc0792529efc4e7b5f269f4cd1 Mon Sep 17 00:00:00 2001
From: Carl Sorensen 
Date: Fri, 22 Jul 2011 03:52:28 -0600
Subject: [PATCH] Add capo chord names

Got capo-handler working properly
---
 lily/chord-name-engraver.cc   |4 ++--
 scm/chord-name.scm|   28 
 scm/define-context-properties.scm |2 ++
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc
index d0ced5a..2442cdb 100644
--- a/lily/chord-name-engraver.cc
+++ b/lily/chord-name-engraver.cc
@@ -124,8 +124,8 @@ Chord_name_engraver::process_music ()
 
   pitches = scm_sort_list (pitches, Pitch::less_p_proc);
 
-  SCM name_proc = get_property ("chordNameFunction");
-  markup = scm_call_4 (name_proc, pitches, bass, inversion,
+  SCM capo_proc = ly_lily_module_constant ("capo-handler");
+  markup = scm_call_4 (capo_proc, pitches, bass, inversion,
   context ()->self_scm ());
 }
   /*
diff --git a/scm/chord-name.scm b/scm/chord-name.scm
index 79b0189..98506d0 100644
--- a/scm/chord-name.scm
+++ b/scm/chord-name.scm
@@ -170,3 +170,31 @@ FOOBAR-MARKUP) if OMIT-ROOT is given and non-false.
 	 (alist (map chord-to-exception-entry elts)))
 (filter (lambda (x) (cdr x)) alist)))
 
+(define-public (capo-handler pitches bass inversion context)
+  (let ((chord-function
+  (ly:context-property context 'chordNameFunction 'jazz-chord-names))
+(capo-pitch (ly:context-property context 'capoPitch '(
+(if (not capo-pitch)
+(chord-function pitches bass inversion context)  ;; call the chordNameFunction as of old
+(let* ((new-pitches   ;; else transpose the pitches and do the chord twice
+(map (lambda (p)
+   (ly:pitch-transpose p capo-pitch))
+ pitches))
+   (new-bass
+ (if (ly:pitch? bass)
+ (ly:pitch-transpose bass capo-pitch)
+ '()))
+   (new-inversion
+ (if (ly:pitch? inversion)
+ (ly:pitch-transpose inversion capo-pitch)
+ '()))
+   (capo-markup
+ (make-parenthesize-markup
+   (chord-function new-pitches new-bass new-inversion context)))
+   (name-markup (chord-function pitches bass  inversion context))
+  (capo-vertical (ly:context-property context 'capoVertical #f)))
+  (if capo-vertical
+  (make-column-markup (list name-markup capo-markup))
+  (make-line-markup (list name-markup
+  (make-hspace-markup 1)
+  capo-markup)))
diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm
index dab5211..d17f72f 100644
--- a/scm/define-context-properties.scm
+++ b/scm/define-context-properties.scm
@@ -135,6 +135,8 @@ that normally end on beats.")
  (beatStructure ,list? "List of @code{baseMoment}s that are combined
 to make beats.")
 
+ (capoPitch ,ly:pitch? "The pitch to transpose chords down by when using the capo.")
+ (capoVertical ,boolean? "Whether to display actual and transposed pitches above each other or not.")
  (chordChanges ,boolean? "Only show changes in chords scheme?")
  (chordNameExceptions ,list? "An alist of chord exceptions.
 Contains @code{(@var{chord} . @var{markup})} entries.")
-- 
1.7.2.2

>From 5da87456d11663f10ff2aab0e3e2ea63b6b42c36 Mon Sep 17 00:00:00 2001
From: Wol 
Date: Wed, 6 Jul 2011 23:42:34 +0100
Subject: [PATCH 3/3] Documentation for the capoPitch chordname property

---
 Documentation/notation/chords.itely |   27 +++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/Documentation/notation/chords.itely b/Documentation/notation/chords.itely
index 1109075..12e9390 100644
--- a/Documentation/notation/chords.itely
+++ b/Documentation/notation/chords.itely
@@ -506,6 +506,33 @@ Rests passed to a @code{ChordNames} context will cause the
 }
 @end lilypond
 
+@cindex Transposing guitar chords for capo
+
+If the @code{capoPitch} property is set, then the chords will additionally be printed
+transposed for a guitar with the c

Re: Chord options in leadsheets

2020-02-22 Thread Jacques Menu
Hello Hendry,

You can have several ChordNames contexts and use \parenthesize in the 
corresponding \chordmode definitions.

What I don’t know is how to have only a single pair of parentheses around the 
two harmonies in the attached.

HTH!

JM





AlternateHarmoniesAttempt.ly
Description: Binary data



> Le 22 févr. 2020 à 11:39, Wols Lists  a écrit :
> 
> On 22/02/20 09:11, hendry.mich...@gmail.com wrote:
>> 
>>  
>> 
>> I use Lilypond to prepare jazz leadsheets. Most of the time, this is
>> straightforward, but the screenshot illustrates three additions I'd like to
>> be able to include.
>> 
>> 1. The ability to provide alternative chords (shown in parentheses above the
>> first two bars).
> 
> I tried to do this, and it didn't get accepted. I struggle with Scheme
> and the more esoteric lilypond syntax. That said, I did get it working,
> what it needed was clean-up.
> 
> I attach the patches, if you or someone else would like to take it on
> and get it in ...
> 
> Cheers,
> Wol
> <0001-Add-capo-chord-names.patch><0003-Documentation-for-the-capoPitch-chordname-property.patch>



Re: Chord options in leadsheets

2020-02-22 Thread Michael Hendry
> On 22 Feb 2020, at 10:39, Wols Lists  wrote:
> 
> On 22/02/20 09:11, hendry.mich...@gmail.com wrote:
>> 
>>  
>> 
>> I use Lilypond to prepare jazz leadsheets. Most of the time, this is
>> straightforward, but the screenshot illustrates three additions I'd like to
>> be able to include.
>> 
>> 1. The ability to provide alternative chords (shown in parentheses above the
>> first two bars).
> 
> I tried to do this, and it didn't get accepted. I struggle with Scheme
> and the more esoteric lilypond syntax. That said, I did get it working,
> what it needed was clean-up.
> 
> I attach the patches, if you or someone else would like to take it on
> and get it in ...
> 
> Cheers,
> Wol
> <0001-Add-capo-chord-names.patch><0003-Documentation-for-the-capoPitch-chordname-property.patch>

Thanks, Wol.

This isn’t quite what I’m after, which is to have completely different chords 
on offer as an option. Sometimes you want more complex chords when backing the 
melody and simpler ones for solos - giving more freedom for the soloist.

Michael




Re: Chord options in leadsheets

2020-02-22 Thread Michael Hendry
> On 22 Feb 2020, at 11:01, Jacques Menu  wrote:
> 
> Hello Hendry,
> 
> You can have several ChordNames contexts and use \parenthesize in the 
> corresponding \chordmode definitions.
> 
> What I don’t know is how to have only a single pair of parentheses around the 
> two harmonies in the attached.
> 
> HTH!
> 
> JM
> 
> 
> 
> 

Thanks, Jacques.

This gives me something to work on.

The Am7(b5) from my screenshot could be represented as Am7b5 in the alternative 
slot and Am7 as the default.

Michael




Re: How can I shorten the space for a final single note

2020-02-22 Thread Thomas Morley
Am Sa., 22. Feb. 2020 um 13:27 Uhr schrieb Robert Blackstone
:
>
> I have attached a picture of  “original” and what I have made of it in case 
> you are curious what it is all about.
>

Hi Robert,

your code would be helpful ;)

Anyway I've set parts of the exercise.
I don't really get what's wrong with it (first score below).
Anyway, a second score with some tweaking is added.
Does it help?

Cheers,
  Harm

\score {
  {
\time 4/2
f'2 g'
e' f'~
f' g' e'1
fis'\breve
\bar "||"
d'1 f'2 a'
g' bes' a' e'
fis'\breve
\bar "|."
  }
  \layout {
ragged-right = ##f
  }
}


\score {
  {
\time 4/2
f'2 g'
e' f'~
f' g' e'1
\newSpacingSection
\temporary \override Score.SpacingSpanner.base-shortest-duration =
  #(ly:make-moment 1 1)
fis'\breve
\newSpacingSection
\revert Score.SpacingSpanner.base-shortest-duration
\bar "||"
d'1 f'2 a'
g' bes' a' e'
%% If not applied in layout use this syntax:
%\overrideProperty
%  Score.NonMusicalPaperColumn.full-measure-extra-space 6.0
\newSpacingSection
\override Score.SpacingSpanner.base-shortest-duration =
  #(ly:make-moment 1 1)
fis'\breve
\newSpacingSection
\revert Score.SpacingSpanner.base-shortest-duration
\bar "|."
  }
  \layout {
ragged-right = ##f
\compressFullBarRests
\override Score.NonMusicalPaperColumn.full-measure-extra-space = 3.0
  }
}



Re: How can I shorten the space for a final single note

2020-02-22 Thread David Wright
On Sat 22 Feb 2020 at 13:25:36 (+0100), Robert Blackstone wrote:
> > On 21 Feb 2020, at 12:18, Pierre Perol-Schneider 
> >  wrote:
> > 
> > A workaround could be: 
> > 
> > {
> >   a'\breve*1/4
> >   \bar "|."
> > }
> 
> Thanks. This does work for me but it comes at a cost: Lilypond apparently 
> does not want to waste the space that results from shrinking the space for 
> the breve and that results in a number of empty bars between the breve and 
> \bar “|.”. 
>  I tried to remove them by adding  \layout {\ RemoveEmptyBars} but that does 
> nothing at all. 
> The best result I got this far is by separating the two horizontally 
> connected scores and combine them in one “piece”.
> I almost get what I want but for two empty staves that I cannot hide or 
> delete with LilyPond tools. They can probably be erased from the .pdf.
> 
> I have attached a picture of  “original” and what I have made of it in case 
> you are curious what it is all about.

You have to make the change in every voice. It sounds as if you've
altered the voice that carries the notes, but have left, say, a
voice of spacers that's carrying keys/time signatures/dynamics etc.

But, as others have said, a MWE is essential to know what's really
happening.

Cheers,
David.



Re: Partcombine without slurs or ties?

2020-02-22 Thread Thomas Morley
Am Fr., 21. Feb. 2020 um 18:40 Uhr schrieb Richard Shann
:
>
> In the following example:
> 8><8><8><8><8><8><8><8><8><8><8><8><8><
> \version "2.18.0"
> MI = { \time 3/4
>  \override Voice.Slur.stencil = ##f
>  \override Voice.Tie.stencil = ##f
>   %comment out the next bar to suppress the slur and tie
>   c'8~ c' c' c' c' c'
>   c'8( a'8) c'' c''8 c'' c''8
>  }
> MII = { \time 3/4
>  \override Voice.Slur.stencil = ##f
>  \override Voice.Tie.stencil = ##f
>   %comment out the next bar to suppress the slur and tie
>  c'8~ c' c' c' c' c'
>  c'8~ c' c' c' c' c'
>   }
> \score {
>   \new Staff <<
>\partcombine
>\MI
>\MII
>  >>
>}
> 8><8><8><8><8><8><8><8><8><8><8><8><8><
>
> I find the slurs and ties are drawn despite no stencil. Stranger still,
> the *are* suppressed if I comment out the first bars.
>
> Any ideas?
>
> Richard Shann
>
>

\partcombine may create several Voices. Which may not continue the
initial one. Thus your overrides are not preserved.
Same here:

{
  \omit Slur
  b4( b)
  <<
{ c'( c') }
\\
{ a( a) }
  >>
}

Use \omit _Staff_.Slur/Tie instead.

Cheers,
  Harm



Re: Partcombine without slurs or ties?

2020-02-22 Thread David Kastrup
Thomas Morley  writes:

> Am Fr., 21. Feb. 2020 um 18:40 Uhr schrieb Richard Shann
> :
>>
>> In the following example:
>> 8><8><8><8><8><8><8><8><8><8><8><8><8><
>> \version "2.18.0"
>> MI = { \time 3/4
>>  \override Voice.Slur.stencil = ##f
>>  \override Voice.Tie.stencil = ##f
>>   %comment out the next bar to suppress the slur and tie
>>   c'8~ c' c' c' c' c'
>>   c'8( a'8) c'' c''8 c'' c''8
>>  }
>> MII = { \time 3/4
>>  \override Voice.Slur.stencil = ##f
>>  \override Voice.Tie.stencil = ##f
>>   %comment out the next bar to suppress the slur and tie
>>  c'8~ c' c' c' c' c'
>>  c'8~ c' c' c' c' c'
>>   }
>> \score {
>>   \new Staff <<
>>\partcombine
>>\MI
>>\MII
>>  >>
>>}
>> 8><8><8><8><8><8><8><8><8><8><8><8><8><
>>
>> I find the slurs and ties are drawn despite no stencil. Stranger still,
>> the *are* suppressed if I comment out the first bars.
>>
>> Any ideas?
>>
>> Richard Shann
>>
>>
>
> \partcombine may create several Voices. Which may not continue the
> initial one. Thus your overrides are not preserved.
> Same here:
>
> {
>   \omit Slur
>   b4( b)
>   <<
> { c'( c') }
> \\
> { a( a) }
>   >>
> }
>
> Use \omit _Staff_.Slur/Tie instead.

Not going to help since the Tie_engraver and Slur_engraver live at Voice
level and won't see those overrides.

I think specifically with respect to piano music where the
Voice/Slur/Tie relation is a lot more fluid we will eventually have to
come up with something more flexible with regard to how properties and
engravers are tied at the context level.

-- 
David Kastrup



Re: Partcombine without slurs or ties?

2020-02-22 Thread Thomas Morley
Am Sa., 22. Feb. 2020 um 15:45 Uhr schrieb David Kastrup :
>
> Thomas Morley  writes:

> > \partcombine may create several Voices. Which may not continue the
> > initial one. Thus your overrides are not preserved.
> > Same here:
> >
> > {
> >   \omit Slur
> >   b4( b)
> >   <<
> > { c'( c') }
> > \\
> > { a( a) }
> >   >>
> > }
> >
> > Use \omit _Staff_.Slur/Tie instead.
>
> Not going to help since the Tie_engraver and Slur_engraver live at Voice
> level and won't see those overrides.

Well, yes. Though

{
  \omit Staff.Slur
  b4( b)
  <<
{ c'( c') }
\\
{ a( a) }
  >>
}

works as wished.

>
> I think specifically with respect to piano music where the
> Voice/Slur/Tie relation is a lot more fluid we will eventually have to
> come up with something more flexible with regard to how properties and
> engravers are tied at the context level.
>
> --
> David Kastrup

Cheers,
  Harm



Re: Partcombine without slurs or ties?

2020-02-22 Thread David Kastrup
Thomas Morley  writes:

> Am Sa., 22. Feb. 2020 um 15:45 Uhr schrieb David Kastrup :
>>
>> Thomas Morley  writes:
>
>> > \partcombine may create several Voices. Which may not continue the
>> > initial one. Thus your overrides are not preserved.
>> > Same here:
>> >
>> > {
>> >   \omit Slur
>> >   b4( b)
>> >   <<
>> > { c'( c') }
>> > \\
>> > { a( a) }
>> >   >>
>> > }
>> >
>> > Use \omit _Staff_.Slur/Tie instead.
>>
>> Not going to help since the Tie_engraver and Slur_engraver live at Voice
>> level and won't see those overrides.
>
> Well, yes. Though
>
> {
>   \omit Staff.Slur
>   b4( b)
>   <<
> { c'( c') }
> \\
> { a( a) }
>   >>
> }
>
> works as wished.

Ah yes, stupid of me: Slur and Tie stencils are established _globally_,
so since the Voice does not have stencils of its own, it does see the
Staff-wide stencils.

At any rate, it might be a nice side project to see whether our defaults
are established as high as possible.

For example, if we have different Slur/Tie shapes behavior for
Tablature, that should be established at TabStaff level rather than at
TabVoice level.  Looking at ly/engraver-init.ly and the kind of stuff
done with overrides at TabStaff/TabVoice level, that seems to be
preaching to the ChoirStaff: that already is how things are organised.

>
>>
>> I think specifically with respect to piano music where the
>> Voice/Slur/Tie relation is a lot more fluid we will eventually have to
>> come up with something more flexible with regard to how properties and
>> engravers are tied at the context level.

But I maintain that this remains a good idea.


-- 
David Kastrup



Re: Partcombine without slurs or ties?

2020-02-22 Thread Richard Shann
On Sat, 2020-02-22 at 15:33 +0100, Thomas Morley wrote:
> Am Fr., 21. Feb. 2020 um 18:40 Uhr schrieb Richard Shann
> :
> > 
> > In the following example:
> > 8><8><8><8><8><8><8><8><8><8><8><8><8><
> > \version "2.18.0"
> > MI = { \time 3/4
> >  \override Voice.Slur.stencil = ##f
> >  \override Voice.Tie.stencil = ##f
> >   %comment out the next bar to suppress the slur and tie
> >   c'8~ c' c' c' c' c'
> >   c'8( a'8) c'' c''8 c'' c''8
> >  }
> > MII = { \time 3/4
> >  \override Voice.Slur.stencil = ##f
> >  \override Voice.Tie.stencil = ##f
> >   %comment out the next bar to suppress the slur and tie
> >  c'8~ c' c' c' c' c'
> >  c'8~ c' c' c' c' c'
> >   }
> > \score {
> >   \new Staff <<
> >    \partcombine
> >    \MI
> >    \MII
> >  >>
> >    }
> > 8><8><8><8><8><8><8><8><8><8><8><8><8><
> > 
> > I find the slurs and ties are drawn despite no stencil. Stranger
> > still,
> > the *are* suppressed if I comment out the first bars.
> > 
> > Any ideas?
> > 
> > Richard Shann
> > 
> > 
> 
> \partcombine may create several Voices. Which may not continue the
> initial one. Thus your overrides are not preserved.
> Same here:
> 
> {
>   \omit Slur
>   b4( b)
>   <<
> { c'( c') }
> \\
> { a( a) }
>   >>
> }
> 
> Use \omit _Staff_.Slur/Tie instead.

Ah, yes - that works, thanks!

Richard





Using showStaffSwitch only for non-beamed notes

2020-02-22 Thread Gilberto Agostinho
Hi all,

Would anyone have an idea of how could I use \showStaffSwitch only for
non-beamed notes? I think these switch lines tend to be omitted when notes
are beamed, since the voicing is obvious in those cases. Right now I can
manually create them using \glissando lines, but would there be a more
automatic way of doing it? See the example below. 

\version "2.19.82"

\markup{"Just \autochange without \showStaffSwitch"}
\autochange {
  c2 g'4 f8. f'16 b'8 a fis2.
}

\markup{"With \showStaffSwitch, adding lines to all switches including
beamed ones"}
\autochange {
  \showStaffSwitch
  c2 g'4 f8. f'16 b'8 a fis2.
}

\markup{"Desired behaviour: switches are shown only for non-beamed notes,
created manually using \glissando"}
\autochange {
  c2\glissando g'4\glissando f8. f'16 b'8 a fis2.
}

Producing:

 

Best,
Gilberto



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



Re: Using showStaffSwitch only for non-beamed notes

2020-02-22 Thread Aaron Hill

On 2020-02-22 10:47 am, Gilberto Agostinho wrote:

Would anyone have an idea of how could I use \showStaffSwitch only for
non-beamed notes? I think these switch lines tend to be omitted when 
notes

are beamed, since the voicing is obvious in those cases.


Something like this might work:


\version "2.19.82"

whenSharedBeam = #(lambda (grob)
  (define (beam-from-notehead nh)
(let* ((nc (ly:grob-parent nh X))
   (stem (ly:grob-object nc 'stem)))
  (if (ly:grob? stem) (ly:grob-object stem 'beam) '(
  (let* ((lb (beam-from-notehead (ly:spanner-bound grob LEFT)))
 (rb (beam-from-notehead (ly:spanner-bound grob RIGHT
(and (ly:grob? lb) (ly:grob? rb) (eq? lb rb

\layout {
  \context {
\Voice
\override VoiceFollower.transparent = \whenSharedBeam
  }
}

\autochange {
  \showStaffSwitch
  c2 g'4 f8. f'16 b'8 a fis2.
}


The principle is to check whether the NoteHeads being connected by the 
VoiceFollower have a shared Beam.



-- Aaron Hill



Re: Chord options in leadsheets

2020-02-22 Thread Robin Bannister

Jacques Menu wrote:



What I don’t know is how to have only a single pair of parentheses around the 
two harmonies in the attached.



This is discussed here and in the linked threads:
https://lists.gnu.org/archive/html/lilypond-user/2018-12/msg2.html


Cheers,
Robin



Multi Measure Rest with a following leading cue note

2020-02-22 Thread Dave Higgins

Is there a more elegant solution to this problem?

\version "2.19.84"
\relative c' {
\compressFullBarRests
R1*2 \bar "" \cadenzaOn \once \omit Score.TimeSignature \time 
1/4 << { s4 } \new CueVoice { c4 } >> \cadenzaOff \bar "|" | 


\once \omit Score.TimeSignature \time 4/4 c1 |
}
--
Dave Higgins
--
Are you a parent?  Do you sometimes find yourself unsure as to what to
say in those awkward situations?  Worry no more...

Do as I say, not as I do.
Do me a favour and don't tell me about it.  I don't want to know.
What did you do *this* time?
If it didn't taste bad, it wouldn't be good for you.
When I was your age...
I won't love you if you keep doing that.
Think of all the starving children in India.
If there's one thing I hate, it's a liar.
I'm going to kill you.
Way to go, clumsy.
If you don't like it, you can lump it.
<>

box-stencil (was: Drawing boxes around grobs)

2020-02-22 Thread Paolo Prete
(This is for Aaron (and anyone who shows interest...)

Hi Aaron,

I need a little fix on the wonderful function you implemented.
As you can see, in case of dynamic, the box has a little unwanted overlay.
How we could avoid this?

Thanks,
Best
P


\version "2.19.83"

#(define (box-stencil stencil thickness padding color expand?)
  "Add a box around @var{stencil}, producing a new stencil."
  (define (css-style-padding padding)
;; padding => (top right bottom left)
(cond
  ((or (null? padding) (eqv? #f padding)) '(0 0 0 0))
  ((number? padding) (make-list 4 padding))
  ((number-pair? padding)
(list (car padding) (cdr padding)
  (car padding) (cdr padding)))
  ((and (number-list? padding) (<= (length padding) 4))
(case (length padding)
  ((1) (make-list 4 (first padding)))
  ((2) (list (first padding) (second padding)
 (first padding) (second padding)))
  ((3) (list (first padding) (second padding)
 (third padding) (second padding)))
  (else padding)))
  (else
(begin (ly:warning "Ignoring invalid padding: ~a" padding)
   '(0 0 0 0)
  (let* ((padding (css-style-padding padding))
 (padding-top (first padding))
 (padding-right (second padding))
 (padding-bottom (third padding))
 (padding-left (fourth padding))

 (x-ext-orig (ly:stencil-extent stencil X))
 (y-ext-orig (ly:stencil-extent stencil Y))
 (x-ext-inner
   (cons (- (interval-start x-ext-orig) padding-left)
 (+ (interval-end x-ext-orig) padding-right)))
 (y-ext-inner
   (cons (- (interval-start y-ext-orig) padding-bottom)
 (+ (interval-end y-ext-orig) padding-top)))
 (x-ext-outer (interval-widen x-ext-inner thickness))
 (y-ext-outer (interval-widen y-ext-inner thickness))
 (x-ext-new (if expand? x-ext-outer x-ext-orig))
 (y-ext-new (if expand? y-ext-outer y-ext-orig))

(x-rule (make-filled-box-stencil (cons 0 thickness) y-ext-inner)) (y-rule
(make-filled-box-stencil x-ext-outer (cons 0 thickness)))
 (box (stencil-with-color
   (ly:stencil-add
(ly:stencil-translate-axis y-rule (interval-end y-ext-inner) Y)
(ly:stencil-translate-axis x-rule (interval-end x-ext-inner) X)
(ly:stencil-translate-axis y-rule (interval-start y-ext-outer) Y)
(ly:stencil-translate-axis x-rule (interval-start x-ext-outer) X))
   color)))
(ly:make-stencil
  (ly:stencil-expr (ly:stencil-add stencil box))
  x-ext-new y-ext-new)))

#(define* (make-stencil-boxer thickness padding callback
   #:optional (color red) (expand? #t))
  "Return function that adds a box around the grob passed as argument."
  (lambda (grob)
(box-stencil (callback grob) thickness padding color expand?)))

{
  \override DynamicText.stencil =
#(make-stencil-boxer 0.4 0 ly:text-interface::print)
c'_\mf
}



Re: box-stencil (was: Drawing boxes around grobs)

2020-02-22 Thread Paolo Prete
I just checked that this unwanted behavior happens in the
default make-stencil-boxer function too.

Is there a fix for this?
Thanks


{
  \override DynamicText.stencil =
#(make-stencil-boxer 0.4 0 ly:text-interface::print)
c'_\mf
}



On Sun, Feb 23, 2020 at 1:19 AM Paolo Prete  wrote:

> (This is for Aaron (and anyone who shows interest...)
>
> Hi Aaron,
>
> I need a little fix on the wonderful function you implemented.
> As you can see, in case of dynamic, the box has a little unwanted overlay.
> How we could avoid this?
>
> Thanks,
> Best
> P
>
> 
> \version "2.19.83"
>
> #(define (box-stencil stencil thickness padding color expand?)
>   "Add a box around @var{stencil}, producing a new stencil."
>   (define (css-style-padding padding)
> ;; padding => (top right bottom left)
> (cond
>   ((or (null? padding) (eqv? #f padding)) '(0 0 0 0))
>   ((number? padding) (make-list 4 padding))
>   ((number-pair? padding)
> (list (car padding) (cdr padding)
>   (car padding) (cdr padding)))
>   ((and (number-list? padding) (<= (length padding) 4))
> (case (length padding)
>   ((1) (make-list 4 (first padding)))
>   ((2) (list (first padding) (second padding)
>  (first padding) (second padding)))
>   ((3) (list (first padding) (second padding)
>  (third padding) (second padding)))
>   (else padding)))
>   (else
> (begin (ly:warning "Ignoring invalid padding: ~a" padding)
>'(0 0 0 0)
>   (let* ((padding (css-style-padding padding))
>  (padding-top (first padding))
>  (padding-right (second padding))
>  (padding-bottom (third padding))
>  (padding-left (fourth padding))
>
>  (x-ext-orig (ly:stencil-extent stencil X))
>  (y-ext-orig (ly:stencil-extent stencil Y))
>  (x-ext-inner
>(cons (- (interval-start x-ext-orig) padding-left)
>  (+ (interval-end x-ext-orig) padding-right)))
>  (y-ext-inner
>(cons (- (interval-start y-ext-orig) padding-bottom)
>  (+ (interval-end y-ext-orig) padding-top)))
>  (x-ext-outer (interval-widen x-ext-inner thickness))
>  (y-ext-outer (interval-widen y-ext-inner thickness))
>  (x-ext-new (if expand? x-ext-outer x-ext-orig))
>  (y-ext-new (if expand? y-ext-outer y-ext-orig))
>
> (x-rule (make-filled-box-stencil (cons 0 thickness) y-ext-inner)) (y-rule
> (make-filled-box-stencil x-ext-outer (cons 0 thickness)))
>  (box (stencil-with-color
>(ly:stencil-add
> (ly:stencil-translate-axis y-rule (interval-end y-ext-inner) Y)
> (ly:stencil-translate-axis x-rule (interval-end x-ext-inner) X)
> (ly:stencil-translate-axis y-rule (interval-start y-ext-outer) Y)
> (ly:stencil-translate-axis x-rule (interval-start x-ext-outer) X))
>color)))
> (ly:make-stencil
>   (ly:stencil-expr (ly:stencil-add stencil box))
>   x-ext-new y-ext-new)))
>
> #(define* (make-stencil-boxer thickness padding callback
>#:optional (color red) (expand? #t))
>   "Return function that adds a box around the grob passed as argument."
>   (lambda (grob)
> (box-stencil (callback grob) thickness padding color expand?)))
>
> {
>   \override DynamicText.stencil =
> #(make-stencil-boxer 0.4 0 ly:text-interface::print)
> c'_\mf
> }
> 
>


Arbitrary MIDI

2020-02-22 Thread Cam

Is there any way to inject arbitrary bytes of data into the stream of generated 
MIDI? There are times this would be convenient.

Thanks

Cam




Re: Arbitrary MIDI

2020-02-22 Thread David Kastrup
Cam  writes:

> Is there any way to inject arbitrary bytes of data into the stream of
> generated MIDI?

No.

> There are times this would be convenient.

You'll probably need a Midi sequencer or processor to get this done with
LilyPond output.

-- 
David Kastrup
My replies have a tendency to cause friction.  To help mitigating
damage, feel free to forward problematic posts to me adding a subject
like "timeout 1d" (for a suggested timeout of 1 day) or "offensive".



Re: Arbitrary MIDI

2020-02-22 Thread Cam

David,

Thanks for the quick reply. At least your answer is clear and unequivocal :)

I will work around.

Cheers

Cam

On 2020-02-22 9:22 p.m., David Kastrup wrote:

Cam  writes:


Is there any way to inject arbitrary bytes of data into the stream of
generated MIDI?


No.


There are times this would be convenient.


You'll probably need a Midi sequencer or processor to get this done with
LilyPond output.