Graphical markup between objects?

2024-05-28 Thread Fennel
I would like to draw lines between fingerings to indicate shifts, pivots, etc. 
on an unfretted string instrument.

Say I have something like the following:

\version "2.24.3"
\relative c' {
c4-1 d-2
}

I would like to produce something similar to the following:
[image.png]
I know that this is achievable using markup and \draw-line as specified 
[here](https://lilypond.org/doc/v2.23/Documentation/notation/graphic), but as 
changes are made to my project and the spacing between notes changes, I’d have 
to go back and manually tweak all of the coordinates for all of the lines in 
the project, and there will be quite a few. I also need notation like this:

[image.png]
indicating a “fork”, or the use of two different fingers across strings at the 
same “fret”. Is attaching lines like this a supported feature at the moment, 
and if not, does anyone have any ideas on what writing scripts to support this 
behavior would look like?

-fennel

​

Re: Graphical markup between objects?

2024-05-28 Thread Fennel
Hi Kieren,

Yes, this is a good start! I’d like the fingerings to be engraved as they would 
if they were actual fingering objects. For example, the desired result for the 
following snippet would ideally look like below:

\version "2.24.3"
\relative c' {
 c-1 d''-2
}

[image.png]
instead of being displayed purely horizontally as a TextSpanner would.

-fennel

​
On Tuesday, May 28th, 2024 at 2:35 PM, Kieren MacMillan 
kie...@kierenmacmillan.info wrote:

> Hi Fennel,
>
>> I would like to draw lines between fingerings to indicate shifts, pivots, 
>> etc. on an unfretted string instrument.
>> Say I have something like the following:
>> \version "2.24.3"
>> \relative c' {
>> c4-1 d-2
>> }
>>
>> I would like to produce something similar to the following:
>> 
>> I know that this is achievable using markup and \draw-line as specified 
>> here, but as changes are made to my project and the spacing between notes 
>> changes, I’d have to go back and manually tweak all of the coordinates for 
>> all of the lines in the project, and there will be quite a few.
>
> Maybe this will point you in the right direction?
>
> %%% SNIPPET BEGINS
> \version "2.25.11"
>
> oneTotwo = \relative c' {
> \once \override TextSpanner.style = #'line
> \once \override TextSpanner.thickness = #2
> \once \override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER
> \once \override TextSpanner.bound-details.right.stencil-align-dir-y = #CENTER
> \once \override TextSpanner.bound-details.left.text = \markup \fontsize #-3 
> \concat { \number "1" \hspace #0.2 }
> \once \override TextSpanner.bound-details.right.text = \markup \fontsize #-3 
> \concat { \hspace #0.2 \number "2" }
> c4\startTextSpan d\stopTextSpan
> }
>
> \score { \oneTotwo }
>
> \score {
> \oneTotwo
> \layout { ragged-right = ##f }
> }
> %%% SNIPPET ENDS
>
> You’d probably want to build a music function to wrap all that stuff so you’d 
> just have to write
>
> \fingspan #'(1 2)
>
> or some such thing.
>
> Hope that helps!
> Kieren.
> __
>
> My work day may look different than your work day. Please do not feel 
> obligated to read or respond to this email outside of your normal working 
> hours.

Re: Graphical markup between objects?

2024-05-28 Thread Fennel
Ooh ooh ooh!

This is exactly what I was looking for! I was unaware that this existed; I 
would have never thought to look for glide.

Thank you

-fennel



Re: Graphical markup between objects?

2024-05-29 Thread Fennel
I was looking for something like "shift line" or "line between fingerings", the 
latter of which seems to point to the correct page. 

-fennel



Re: autocompletion with vim

2024-06-06 Thread Fennel
The plugin that Kenneth mentions (which I am also using at the moment) is 
rather quite broken as far as Emacs or Frescobaldi-style autocompletion is 
concerned.

[nvim-lilypond-suite](https://github.com/martineausimon/nvim-lilypond-suite) 
strongly recommends the use of `coc.nvim`, which is not as performant as non 
JS-based completion engines like cmp-nvim. The plugin author makes available a 
path to working autocomplete via the provided dictionary files that come 
bundled with Lilypond, but in order to make that work with `nvim-cmp`, an 
additional plugin must be used to integrate dictionary files as a completion 
source. AFAIK, [cmp-dictionary](https://github.com/uga-rosa/cmp-dictionary) is 
the only plugin that provides this functionality, and it is archived/not being 
developed, and it is broken. I cannot get it to load without throwing an error.

I really don't feel like asking us to use TabNine as a suitable autocomplete 
engine is really the solution, especially because it's not very great at 
handling specialized languages like LilyPond. I also don't feel like moving all 
of my completion configuration over to `coc.nvim` is really something that 
makes sense for one language out of many that I write in my vim config. I'm 
kind of at a loss for what I can use in vim to get proper autocomplete working 
other than fix the broken archived plugin myself, which I'm not exactly trying 
to do at the moment.

- Fennel


publickey - fennel@everwild.dev - 0x1FA97B0B.asc
Description: application/pgp-keys


Adjust analysis bracket continuations?

2024-06-06 Thread Fennel
I’m using analysis brackets as shown in the snippet below:

\version "2.24.3"
\layout {
  \context { \Voice \consists Horizontal_bracket_engraver } }

\relative c' {c1 \startGroup | \break
  c1 \stopGroup
}

which produces the following output:
[image.png]

I would like for the bracket continuation in bar 2 to begin after the bar 
number, clef, key, and time signature information at the start of the staff. I 
found break-overshoot on [this reference 
page](https://lilypond.org/doc/v2.25/Documentation/internals/horizontalbracket) 
which seems to suggest that it’s what I’m looking for:

> A pair of numbers specifying how much a broken spanner sticks out of its 
> bounds horizontally on the broken side(s). For broken beams and broken tuplet 
> brackets, the bounds are given by the prefatory matter on the left and/or the 
> rightmost column on the right. For broken horizontal brackets, the bounds are 
> the leftmost and/or rightmost column; for broken measure spanners, the left 
> and/or right edge of the staff.

Here is the result when that option is applied:

\version "2.24.3"

\layout {
  \context {
\Voice
\consists Horizontal_bracket_engraver
\override HorizontalBracket.break-overshoot = #'(5 . 5)
  }
}

\relative c' {c1\startGroup | \break
c1\stopGroup}

[image.png]

largely unchanged. What should I do?

Fennel

​

Re: autocompletion with vim

2024-06-06 Thread Fennel
It seems like cmp-dictionary​ doesn’t play nice with oil.nvim, and I am not 
removing that to make this work unfortunately. Here’s a stack trace if you’re 
interested:

Error executing luv callback:
 ...vim/lazy/cmp-dictionary/lua/cmp_dictionary/dict/trie.lua:43: bad argument 
#1 to 'decode' (string expect
 ed, got nil)
 stack traceback:
 [C]: in function 'decode'
 ...vim/lazy/cmp-dictionary/lua/cmp_dictionary/dict/trie.lua:43: in function 
<...vim/lazy/cmp-dicti
 onary/lua/cmp_dictionary/dict/trie.lua:42>

[C]: in function 'nvim_buf_delete'
 .../fennel/.local/share/nvim/lazy/oil.nvim/lua/oil/util.lua:159: in function 
'rename_buffer'
 .../fennel/.local/share/nvim/lazy/oil.nvim/lua/oil/init.lua:746: in function 
'maybe_hijack_directo
 ry_buffer'
 .../fennel/.local/share/nvim/lazy/oil.nvim/lua/oil/init.lua:1265: in function 
'setup'
 /home/fennel/.config/nvim/init.lua:209: in main chunk

if you have any suggestions, I’d love to hear them! This has been very 
frustrating for me.

Fennel

​

Spanner start and end in different voices or hack

2024-06-13 Thread Fennel
I have this snippet:

\version "2.24.3"
\layout {
\context { \Voice
\consists Horizontal_bracket_engraver
}
}

\relative c'' {
a8 a b\startGroup b\stopGroup << {c4 d} \\ {a2} >>
}

[image.png]
I’d like for the bracket to extend to the end of the bar. Of course the “simple 
solution” a8 a b\startGroup b << {c4 d\stopGroup} \\ {a2} >> or in the other 
voice compiles but throws a warning and fails to produce the correct output 
because the start and stop are scoped differently. I include the beams on the 
first 2 beats because the project I’m working on requires that beam remain 
intact and have correct stem direction. If at all possible, keeping the first 
half of the bar in the single outer voice would be fantastic. Is there a way 
around the voice problem or a way to tweak the length of the spanner beyond the 
specified endpoint?

Fennel

​

Re: autocompletion with vim

2024-06-14 Thread Fennel
Okay, managed to get the configuration working (making sure that your paths are 
specified correctly helps!) but now that I have completion I get the following 
every time I select a result:

Error executing vim.schedule lua callback: 
...lar/neovim/0.10.0/share/nvim/runtime/lua/vim/_system.lua:244: ENOENT: no 
such file or directory
stack traceback: [C]: in function 'error'
...lar/neovim/0.10.0/share/nvim/runtime/lua/vim_system.lua:244: in function 
'spawn'
...lar/neovim/0.10.0/share/nvim/runtime/lua/vim_system.lua:335: in function 
'system'
...are/nvim/lazy/cmp-dictionary/lua/cmp_dictionary/util.lua:7: in function 
'system'
...e/nvim/lazy/cmp-dictionary/lua/cmp_dictionary/source.lua:100: in function 
'resolve'
...ennel/.local/share/nvim/lazy/nvim-cmp/lua/cmp/source.lua:384: in function 
'resolve'
...fennel/.local/share/nvim/lazy/nvim-cmp/lua/cmp/entry.lua:505: in function 
'resolve'
.../fennel/.local/share/nvim/lazy/nvim-cmp/lua/cmp/view.lua:287: in function 
'fn'
.../.local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/async.lua:71: in function 
<.../.local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/async.lua:69

I’ll throw my [current neovim 
config](https://gist.github.com/fenneltheloon/6703a17e584ec61958b6e0a61920e12a) 
in here as I’m rather confused as to why this is being such a pain.

Fennel

​

Adjust line spacing in markup column for fingerings

2024-06-20 Thread Fennel
Hi all,

Getting this behavior when trying to put fingerings in column format on chords:

\version "2.24.3"
\relative c'' {
 \set fingeringOrientations = #'(left)
 
}

I’d like the 1 to be much closer to the 2. Does anyone know the correct 
property to adjust to make this happen / where in the docs should I be looking 
as my current efforts are not going too well.

-Fennel

​

Re: Graphical markup between objects?

2024-06-23 Thread Fennel


Wondering if it's possible to override the behavior of the glide line such that 
the glide will draw to the next fingering regardless of what the second number 
is.

- Fennel

On Thursday, May 30th, 2024 at 12:28 AM, Werner LEMBERG  wrote:

> 
> 
> > I was looking for something like "shift line" or "line between
> > fingerings", the latter of which seems to point to the correct page.
> 
> 
> https://gitlab.com/lilypond/lilypond/-/merge_requests/2357
> 
> 
> Werner



Vertically align objects of same class?

2024-06-25 Thread Fennel
I have a bunch of objects of the same type that I’d like to all be aligned to 
the same Y-level on a per staff basis.

Here’s an example:

\version "2.24.3"
\relative c'' {
c_"I" c'_"II" c,,_"III" c'_"IV"\break
g_"A" g'_"B" g,,_"C" g'_"D"
}

I would like for all of the markup objects on each staff to align with the 
lowest default placement, so in this example in the first staff all text would 
vertically align with the “III” and in the second staff all test would 
vertically align with the “C”. I know that lyricMode would work well in this 
example, but I would also like to do the same thing with HorizontalBrackets and 
I’m mainly using this for string indications which do not appear on every note, 
making lyricmode somewhat of a pain to use in this scenario.

-Fennel

​

Re: Graphical markup between objects?

2024-06-25 Thread Fennel
Thanks. As far as the "fork" style is concerned, Aaron, your example is great! 
Learning a lot :)

It seems like it would be great if the stencil that you've made could be 
wrapped into the style property, as that's what Lilypond seems to want the 
user-settable property. The [documentation 
page](https://lilypond.org/doc/v2.24/Documentation/internals/fingerglidespanner)
 suggests that valid styles depend on valid stencils, but I can't seem to find 
a snippet in LSR showing how to actually make that happen.

-Fennel

Re: Vertically align objects of same class?

2024-06-25 Thread Fennel
Knute, to your point I think that the Dynamics context, while slightly better 
than lyricMode for this use case still has a similar issue given that the 
project I'm working on is of considerable size and would require a significant 
refactor. Feasible but I'd like to avoid doing this if at all possible.

Werner, it seems like I'd have to do trial and error to figure out what the 
minimum viable staff-padding is for each line and then set it each time. If I 
calibrate it once for the most extreme staff (the second in the given example), 
then there will be quite a bit of excess space between the first staff and the 
line of markup objects.

Any change to other objects on the staff after the initial per-staff 
calibration would also require another calibration of the staff-specific 
padding value. Is there a way to query the maximum extent of a staff/calculate 
what the value of the staff padding should be such that all of the objects are 
vertically aligned?

~Fennel

RE: Vertically align objects of same class?

2024-06-25 Thread Fennel
I wonder if this is hackable if I just duplicate the current staff context as a 
dynamic context and then remove all of the markup objects from the staff 
context…

~Fennel

​
On Tuesday, June 25th, 2024 at 12:52 PM, carsonm...@ca.rr.com 
 wrote:

> Fennel,
>
> Go to:
> https://lilypond.org/doc/v2.24/Documentation/notation/expressive-marks-attached-to-notes#dynamics
>
> And scroll down to “A dynamics context”.
>
> Mark
>
> From: lilypond-user-bounces+carsonmark=ca.rr@gnu.org 
>  On Behalf Of Fennel
> Sent: Tuesday, June 25, 2024 9:06 AM
> To: Lilypond-User Mailing List 
> Subject: Vertically align objects of same class?
>
> I have a bunch of objects of the same type that I’d like to all be aligned to 
> the same Y-level on a per staff basis.
>
> Here’s an example:
>
> \version "2.24.3"
>
> \relative c'' {
>
> c_"I" c'_"II" c,,_"III" c'_"IV"\break
>
> g_"A" g'_"B" g,,_"C" g'_"D"
>
> }
>
> I would like for all of the markup objects on each staff to align with the 
> lowest default placement, so in this example in the first staff all text 
> would vertically align with the “III” and in the second staff all test would 
> vertically align with the “C”. I know that lyricMode would work well in this 
> example, but I would also like to do the same thing with HorizontalBrackets 
> and I’m mainly using this for string indications which do not appear on every 
> note, making lyricmode somewhat of a pain to use in this scenario.
>
> -Fennel
>
> ​

Tweak size of Script objects

2024-06-25 Thread Fennel
I’d like to adjust the size of certain script marks like trills and bowings 
relative to the staff size. The 
[script](https://lilypond.org/doc/v2.25/Documentation/internals/script) class 
doesn’t seem to let you change the symbol’s size.

~Fennel

​

Re: autocompletion with vim

2024-07-14 Thread Fennel
Unfortunately, I haven't managed to get this working on neovim v0.10.0 . My 
guess is that the breaking changes introduced in this version break the 
archived cmp-dictionary plugin and unless someone forks the project to fix the 
issues, proper completion in neovim using cmp will be broken for quite a while. 
I'll keep an ear open in case anything changes, or if you all hear anything 
please send of course.

-Fennel



Re: Vertically align objects of same class?

2024-07-14 Thread Fennel
The dynamics context seems to work well enough for text markup objects. I’d 
also like to throw a lot of analysis brackets into a Dynamics context above the 
staff with similar output. Here’s what I would imagine working

\version "2.24.3"

\layout {
  \context {
\Voice % Or \Dynamics ? There's no mention of a dynamics context on the 
relevant doc page.
\consists Horizontal_bracket_engraver
\override HorizontalBracket.direction = #UP

  }
}

music = \context Staff \relative c'' {
  \repeat unfold 8 {c4}
}

brackets = \context Dynamics {
  \override VerticalAxisGroup.staff-affinity = #DOWN
  s4 s\startGroup s s\stopGroup | s\startGroup s s\stopGroup s
}

\score { << \music \brackets >> }

[image.png]

This snippet fails to engrave the analysis brackets, as shown. Is it possible 
to do so?

-Fennel

​

Re: Vertically align objects of same class?

2024-07-14 Thread Fennel
Per-system vertical alignment of all horizontal brackets is the goal. This can 
almost be achieved by adjusting the staff padding property (to a value large 
enough that no other objects will interfere with the brackets), but then we 
have the problem of the brackets being too far off of the staff for almost 
every system.

I’ll take a look at what you suggested, Valentin. Hopefully it works for what I 
need!

-Fennel

​

Re: Vertically align objects of same class?

2024-07-16 Thread Fennel
> So what you’d

> need to do is to replace the skips by notes:
>
> brackets = \new Dynamics {
> \override VerticalAxisGroup.staff-affinity = #DOWN
> c4 c\startGroup c c\stopGroup | c\startGroup c c\stopGroup c
> }
>
> Then this will still not work, as the Dynamics context does not create any
> NoteColumns by default. So you’ll need to add Rhythmic_column_engraver. But to
> actually have something to encompass you’d need to have a stencils, so you’d
> need to also add the Note_heads_engraver.
>
> Then you’d need to get rid of the note heads, but you still need a stencil, so
> do something like
>
> \layout {
> \context {
> \Dynamics
> \consists Horizontal_bracket_engraver
> \override HorizontalBracket.direction = #UP
> \consists Note_heads_engraver
> \consists Rhythmic_column_engraver
>
> \override NoteHead.stencil = #(ly:make-stencil '() '(0 . 0) '(0 . 0))
> }
>
> }

This snippet gives the following output:

[image.png]It seems that the staff-affinity option is being ignored?
-Fennel

>

​

Re: Vertically align objects of same class?

2024-07-20 Thread Fennel
Valentino,

Your function seems to not work for polyphonic passages as in the example 
below. Is there a fix for the function, would using \voiceOne and \voiceTwo 
explicitly for this polyphonic context make a difference?

\version "2.24.3"
#(define (outside-staff-collecting-engraver context)
   (let* ((span_up #f) (span_down #f))
   (make-engraver
((initialize engraver)
 (set! span_up (ly:engraver-make-grob engraver 'TextSpanner '()))
 (ly:grob-set-property! span_up 'transparent #t)
 (ly:grob-set-property! span_up 'direction UP)
 (set! span_down (ly:engraver-make-grob engraver 'TextSpanner '()))
 (ly:grob-set-property! span_down 'transparent #t)
 (ly:grob-set-property! span_down 'direction DOWN))
(acknowledgers
 ((outside-staff-interface engraver grob source-engraver)
  (if (assoc-get 'align (ly:grob-property grob 'details))
  (let* ((d (ly:grob-property grob 'direction))
 (span (if (= d UP) span_up span_down)))
(ly:grob-set-parent! grob Y span)
(if (null? (ly:spanner-bound span LEFT))
(ly:spanner-set-bound! span LEFT
   (if (ly:spanner? grob)
   (ly:spanner-bound grob LEFT)
   grob)))
(ly:spanner-set-bound! span RIGHT
   (if (ly:spanner? grob)
   (ly:spanner-bound grob LEFT)
   grob))
(ly:grob-set-property! grob 'outside-staff-priority #f)
(ly:grob-set-property! grob 'Y-offset 0

\layout {
  \context {
\Staff
\consists #outside-staff-collecting-engraver
  }
  \context {
\Voice
\consists Horizontal_bracket_engraver
\override HorizontalBracket.direction = #UP

  }
}

\relative c {
\override HorizontalBracket.details.align = ##t
  << {
<< {
c\startTextSpan c c c\stopTextSpan |

} \\ {
g g g g |
}
a a a a
>> } >>
{ s\startGroup s s s\stopGroup | s s s s }
}

-Fennel

​

Re: Vertically align objects of same class?

2024-07-25 Thread Fennel
Any ideas as to why the staff-affinity option is being ignored here?

\layout {
\context {
\Dynamics
\consists Horizontal_bracket_engraver
\override HorizontalBracket.direction = #UP
\consists Note_heads_engraver
\consists Rhythmic_column_engraver
\override NoteHead.stencil = #(ly:make-stencil '() '(0 . 0) '(0 . 0))
}
}

brackets = \new Dynamics {
\override VerticalAxisGroup.staff-affinity = #DOWN
c4 c\startGroup c c\stopGroup | c\startGroup c c\stopGroup c
}

Produced output:
[image.png]

Setting staff-affinity = #DOWN should mean that the brackets appear above the 
staff instead of below, right?

-Fennel

​

Re: Graphical markup between objects?

2024-07-29 Thread Fennel
Hi all,

Fixed the fork objects such that they correctly render the apex of the fork 
halfway on the part of the two fingerings. Check it out!

-Fennel

On Tuesday, June 25th, 2024 at 12:34 PM, Fennel  wrote:

> Thanks. As far as the "fork" style is concerned, Aaron, your example is 
> great! Learning a lot :)
>
> It seems like it would be great if the stencil that you've made could be 
> wrapped into the style property, as that's what Lilypond seems to want the 
> user-settable property. The [documentation 
> page](https://lilypond.org/doc/v2.24/Documentation/internals/fingerglidespanner)
>  suggests that valid styles depend on valid stencils, but I can't seem to 
> find a snippet in LSR showing how to actually make that happen.
>
> -Fennel

test.ly
Description: Binary data


test.pdf
Description: Adobe PDF document


Multiple fingering and glides

2024-08-01 Thread Fennel
Hi all,

I'm working on a project that involves multiple fingerings for each note, and 
shift lines or glides between some notes. Since lilypond will only engrave 
glides between notes with the same fingering, I'm using finger 5 to be the 
placeholder fingering and overriding the Fingering text property to the desired 
value.

Can anyone say why this is producing the attached output? There are two main 
issues.
1. The glide line is engraving not as expected. I'd like it to run from the 
first "5" to the next (adjacent) "5", and I don't have a clue as to why it is 
behaving the way that it does.
1. The \once text override is applying to the entire NoteEvent, not the next 
Fingering, which is the intended behavior. Is there a workaround for this?

-Fennel

test_fingering.pdf
Description: Adobe PDF document


test_fingering.ly
Description: Binary data


Re: Multiple fingering and glides

2024-08-05 Thread Fennel
Multiple fingerings are being used because I'm working on a heavily annotated 
edition of a work that suggests multiple sets of fingerings for a single 
passage. I'm currently choosing to engrave harmonic symbols (the flageolets) as 
fingering objects as well because I need them to behave like fingering objects 
instead of script objects.

I will open an issue! Though I fear the solution for me right now will be 
monkeying around in an SVG editor to make the notation.

-Fennel

Change size of note object in markup

2024-08-29 Thread Fennel
I have a note object in markup, like so:

\version "2.24.4"

\markup { "blah blah" \note {2} #1 "blah blah" }

I’d like the note to be a bit smaller relative to the text. How do I do this?

Fennel

​