lilypond-user
[Top][All Lists]
Advanced

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

Re: Translating stencils


From: Thomas Morley
Subject: Re: Translating stencils
Date: Tue, 24 Sep 2019 21:20:20 +0200

Am Di., 24. Sept. 2019 um 12:06 Uhr schrieb Michael Käppler <address@hidden>:
>
> Hi Harm,
> many thanks for your advice!
> The \table command was completely new to me.
> Here is my current state of work:
>
> #(define (mm->staff-spaces mm)
>     (let ((ss (ly:output-def-lookup $defaultpaper 'staff-space)))
>       (/ mm ss)))
>
> #(define musiclist (list
>                      #{ { \clef bass e'4 } #}
>                      #{ { \clef treble a'2 } #}
>                      #{ { \key as \major \clef alto es' } #}
>                      #{ { \clef bass e'4 } #}
>                      #{ { \clef treble a'2 } #}
>                      #{ { \key as \major \clef alto es' } #}
>                      #{ { \clef bass e'4 } #}
>                      #{ { \clef treble a'2 } #}
>                      #{ { \key as \major \clef alto es' } #}
>                      ))
>
> \layout {
>    indent = #0
>    \context {
>      \Staff
>      \remove "Time_signature_engraver"
>      \remove "Bar_engraver"
>      \override StaffSymbol #'width = #(mm->staff-spaces 20)
>    }
> }
>
> #(define (make-score music)
>     (let* ((score (scorify-music music))
>            (layout (ly:output-def-clone $defaultlayout)))
>       (ly:score-add-output-def! score layout)
>       score))
>
> #(define-markup-command (scoretomarkup layout props s)
>     (ly:score?)
>     (interpret-markup layout props (make-score-markup s)))
>
> #(define-markup-list-command (scores-to-markup-list layout props scores)
>     (list?)

Below is not needed, instead do

(interpret-markup-list layout props (map make-score-markup scores))

>     (map (lambda (s) (interpret-markup layout props s))
>       (map make-score-markup scores)))
>
> #(define scores (map make-score musiclist))
>
> \markuplist { \table #'(0 0 0) \scores-to-markup-list \scores }
>
> Some new questions arose:
> 1. Is there an easier way of converting a list of music expressions into
> markups? Did I miss some built-in function
> that would do the job, too?

Apart from the above, you could obviously code your `make-score´ to
work on a list of music-expressions:

#(define (make-scores list-of-musics)
    (let* ((scores (map scorify-music list-of-musics))
           (layout (ly:output-def-clone $defaultlayout)))
      (for-each
        (lambda (score) (ly:score-add-output-def! score layout))
        scores)
      scores))

And call it like (I added some padding):

\markuplist
  \override #'(padding . 5)
  \table #'(0 0 0) \scores-to-markup-list #(make-scores musiclist)

But I doubt it's easier.

> 2. I stumbled upon some functions I was not able to find in the source code.
> First I wanted to see how the built-in \score markup-function does it's job.
> I saw that it calls a function called score-lines-markup-list, which I
> was unable to find in the repository.
> Or take (make-score-markup) which I had seen in an older thread.
> But a "git grep make-score-markup" returns nothing.
> What am I missing?

>From each markup-(list-)command two other procedures are derived.
\score -> score-markup and make-score-markup
\score-lines -> score-lines-markup-list and make-score-lines-markup-list

See the definitions for the macros: define-markup-command and
define-markup-list-command in markup-macros.scm.


Cheers,
  Harm



reply via email to

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