|
From: | Jean Abou Samra |
Subject: | Re: ! Please answer interesting functionality question for PhD Diss |
Date: | Sat, 24 Oct 2020 11:55:01 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
Hi,
Thank you all for your encouragements − it's a pleasure to know that your work is appreciated.
This prompted me to rewrite the thing …
This is a beautiful quick hack!
To avoid the semicircles on the the end of each staff line, you'd likely want to change the definition of the staffline being printed. This is defined in the file lily/staff-symbol.cc as a horizontal line (see lines 92 and 93) of a given thickness, which is drawn with a pen having a blot diameter of the thickness. It's probably possible to rewrite this print function in Scheme and draw the staff line as a round-filled-box (see lily/lookup.cc). If I were trying to do this in the minimum effort way possible, I'd hardcode a blot diameter, and draw a round-filled box of the given thickness using the hardcoded blot diameter. This would be a hack, but would get the job done.
… in a way that, as you say, redraws the StaffSymbol instead of
creating a bunch of RhythmicStaff contexts, so you can pass plain
music without resorting to complicated combinations of \crossStaff
and \change (cross-staff chords are cumbersome to create). This is
indeed done by partly reimplementing and partly reusing the
callback found in lily/staff-symbol.cc. Fortunately, you don't
need the ability to compile LilyPond; all of this is done via
Scheme.
And, you were right: I used \filled-box to control the blot diameter, which is set to a fixed value (you can modify it as a global variable).
The problem so far is that I didn't find a proper way to set the
chord configuration at a given musical moment (note heads placed
at the left or at the right of the stem). For now I've used an
extra-offset, which leads to inconsistent spacing. There is
\override Stem.note-collision-threshold = 50, but that doesn't let
you achieve the fourth chord before the end, where the upper note
is on the left and the lower note is on the right, since the usual
placement is the other way around.
Code attached, with an output that resembles the image you (Michael) sent earlier. Note that you need a development version of LilyPond (lilypond.org/development). Naturally, this is only a start since at this point more details are needed about the specification of what you want to achieve. Nevertheless, I wanted to share this code to avoid duplication of effort in case someone else were willing to take over this topic.
Regards,
Jean
Fancy2.ly
Description: Text Data
Fancy2.pdf
Description: Adobe PDF document
[Prev in Thread] | Current Thread | [Next in Thread] |