Hi Andrew,

What I want to achieve  is to obtain a template for easy spacing objects
vertically. This spacing is very hard to achieve when there are many layers
of objects. And it becomes even harder when you realize that you have to
change the order of the positions. Instead, with my system, I think it's
possible to do it very easily. I just completed the template. Here is the
new version. Please look at the result, and see how the spacing is made in
the code (in a "graphic" way too).

(Lilybin preview)
http://lilybin.com/bt0t2d/4

(code)

%%%%%%%%%%%%%%%%%%%%%%%%

spacer =  #(define-music-function (dir pos length) (string? number? number?)
(let ()
  (begin
    (cond
 ((string=? dir "UP")
        #{ \tweak TextScript.color #grey \tweak
TextScript.outside-staff-priority #(* 100 pos) ^\markup{ \translate #(cons
1 0) \draw-line #(cons 0 length)} #})
      (else
   #{ \tweak TextScript.color #grey \tweak
TextScript.outside-staff-priority #(* 100 pos) _\markup{ \translate #(cons
1 0) \draw-line #(cons 0 length)} #})))))

setPosition = #(define-music-function (obj pos mus) (string? number?
ly:music?)
(let ()
  (begin
    (cond
      ((string=? obj "TextScript")
        #{ \tweak TextScript.outside-staff-priority #(* 110 pos) #mus #})
 (else
        #{ \once \override #obj .outside-staff-priority = #(* 110 pos)
 #})))))

{
\time 2/4
\set Staff.pedalSustainStyle = #'mixed
\once \override TupletBracket.direction = #UP

%
% Assign a position to each object
%
% Objects above staff
\setPosition "Script" 1 {}
\setPosition "TupletBracket" 2 {}
\setPosition "Slur" 3 {}
\setPosition "Staff.OttavaBracket" 4 {}
% Objects below staff
\setPosition "DynamicLineSpanner" 1 {}
\setPosition "Staff.SustainPedalLineSpanner" 2 {}
\setPosition "Staff.SostenutoPedalLineSpanner" 3 {}

\tuplet 3/2 { \ottava #1 c''''

-\spacer "UP" 5 4 -\setPosition "TextScript" 5 ^\markup { "Espressivo" }
-\spacer "UP" 4 2
-\spacer "UP" 3 3 ^(
-\spacer "UP" 2 2
-\spacer "UP" 1 0.7 ^>
%------------------------------------------$
%------------------------------------------$
%------------------------------------------$
%------------------------------------------$
%------------------------------------------$
-\spacer "DOWN" 1 2 \mf
-\spacer "DOWN" 2 3 \sustainOn
-\spacer "DOWN" 3 4 \sostenutoOn
-\spacer "DOWN" 4 3 -\setPosition "TextScript" 4 _\markup { "Use pedal with
care!"}

c'''' c'''')\sustainOff\sostenutoOff \ottava #0 }

}


On Thu, Feb 6, 2020 at 5:14 AM Andrew Bernard <andrew.bern...@gmail.com>
wrote:

> Hello Paolo,
>
> What are you trying to achieve?
>
> Andrew
>
> On Thu, 6 Feb 2020 at 11:48, Paolo Prete <paolopr...@gmail.com> wrote:
>
> > I just had this idea about a *new* method of spacing.
>

Reply via email to