Function for tweaks

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Function for tweaks

Helge Kruse-4
Hi,

I want to use kneed beams for my score. These look ugly if the system
system distance is too small. Therefor I extend the spacing as in the
following example. Removing the percent character gives a reasonable
spacing.

\version "2.18.2"
\language "deutsch"

staffUpper = { \change Staff="upper" }
staffLower = { \change Staff="lower" }

upper = \relative c'' {
    c1 % -\tweak #'stencil #(ly:make-stencil '() '(0 . 0.1) '(0 . 6.) ) _""
}

lower = \relative c' {
  \clef bass
  \override Beam.auto-knee-gap = #-8
  f,16 [ \staffUpper d'16 \staffLower
  as16 \staffUpper d16 ] \staffLower
  f,16 [ \staffUpper d'16 \staffLower
  as16 \staffUpper d16 ] \staffLower
  fis,16 [ \staffUpper es'16 \staffLower
  a,16 \staffUpper es'16 ] \staffLower
  fis,16 [ a16 \staffUpper es'16 \staffLower a,16 ]
}

\score {
  \new PianoStaff <<
    \new Staff = "upper" \upper
    \new Staff = "lower" \lower
  >>
}

I want to save typing and it's tedious to write the complete tweak each
time. But the Y size must be adapted each time. Therefore a function is
necessary to change the current required value that is 6 in the example.

I've experimented with define-markup-command and define-music-function
by GUILE always outputs errors.

How can this tweak be folded in a function? What kind of function is
required?

Best regards
Helge

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Function for tweaks

Lukas-Fabian Moser
Hi Helge,

> I want to save typing and it's tedious to write the complete tweak each
> time. But the Y size must be adapted each time. Therefore a function is
> necessary to change the current required value that is 6 in the example.
>
> I've experimented with define-markup-command and define-music-function
> by GUILE always outputs errors.
makeSpace = #(define-event-function (size) (number?)
                #{
                  -\tweak #'stencil #(ly:make-stencil '() '(0 . 0.1) `(0
. ,size) ) _""
                #}
                )

upper = \relative c'' {
     c1 \makeSpace 10
}

The two man points being:
- use define-event-function instead of define-music-function
- use a quasiquote ` instead of the quote ' for the pair (0 . [size]),
since size must be evaluated, hence unquoted by a comma (,size).

Best
Lukas

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Function for tweaks

Helge Kruse-4
Am 06.10.2018 um 12:32 schrieb Lukas-Fabian Moser:
> makeSpace = #(define-event-function (size) (number?)
>                #{
>                  -\tweak #'stencil #(ly:make-stencil '() '(0 . 0.1) `(0
> . ,size) ) _""
>                #}
>                )

Hi Lukas,

this works for me. I wasn't aware of the event function.

One remark: This construct doesn't work with Lilypond 2.18. You get an
error:
C:/Program Files
(x86)/Lilypond/usr/share/lilypond/current/scm/ly-syntax-constructors.scm:56:23:Wrong
number of arguments to #<procedure #f(size)>

So I have to switch to the unstable version 2.19.

Thanks
Helge


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Function for tweaks

David Kastrup
Helge Kruse <[hidden email]> writes:

> Am 06.10.2018 um 12:32 schrieb Lukas-Fabian Moser:
>> makeSpace = #(define-event-function (size) (number?)
>>                #{
>>                  -\tweak #'stencil #(ly:make-stencil '() '(0 . 0.1) `(0
>> . ,size) ) _""
>>                #}
>>                )
>
> Hi Lukas,
>
> this works for me. I wasn't aware of the event function.
>
> One remark: This construct doesn't work with Lilypond 2.18. You get an
> error:
> C:/Program Files
> (x86)/Lilypond/usr/share/lilypond/current/scm/ly-syntax-constructors.scm:56:23:Wrong
> number of arguments to #<procedure #f(size)>
>
> So I have to switch to the unstable version 2.19.

makeSpace = #(define-event-function (parser location size) (number?)

...

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user