lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Three questions about Scheme functions


From: Thomas Morley
Subject: Re: Three questions about Scheme functions
Date: Thu, 1 Nov 2018 22:44:14 +0100

Am Mo., 29. Okt. 2018 um 15:30 Uhr schrieb Jérôme Plût <address@hidden>:
>
> I have a few questions about using Scheme to build Lilypond data.
>
> 1. I have some Scheme code that builds custom articulations (more
> precisely, it attaches metadata to NoteEvents, and the only way I found
> to make this possible is via putting it in a custom, invisible
> articulation, but let's not digress too much).
>
> The code I use to declare this custom articulation is:
>
> \layout { \context { \Score
>   scriptDefinitions = #(append default-script-alist `(
>   ("void" . ((stencil . #f) (direction . ,UP) (avoid-slur . ignore)))
> )) } }
>
> However, this is Lilypond code, not Scheme code. My code is in a .scm
> file, which is read in the user files as #(load "code.scm").
>
> Does there exist a way to modify the articulations table from inside a
> Scheme code block (such as (begin <code...>) )? I tried wrapping this
> inside #{ ... #}, but to no effect.

Hi Jérôme,

below works for me.
I'm quite confident it will work with (load ...), not tested, though.

\version "2.19.82"

#(define test-stencil
  (make-circle-stencil 0.5 0.1 #f))

#(let ((mod (ly:output-def-scope $defaultlayout)))
  (module-set! mod 'Score
    (ly:context-def-modify
      (module-ref mod 'Score)
      (ly:make-context-mod
        (list
          (list 'assign 'scriptDefinitions
           (cons
             `("void"
               . (
                  ;; to give some ink on the paper...
                  (stencil . ,test-stencil)
                  (direction . ,UP)
                  (avoid-slur . ignore)))
             (ly:output-def-lookup $defaultlayout 'scriptDefinitions))))))))

"void" = #(make-articulation "void")

{
  c''-\"void" c''^\"void" c''_\"void"
}

Cheers,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]