Re: Capturing out-of-music markup for music braille

2024-03-28 Thread Timothy Lanfear

On 27/03/2024 22:03, Maurits Lamers wrote:

Hi Timothy,

Thanks so much for your answer! With $defaultheader I can indeed get 
the main/global header fields in the initialize stage of the engraver, 
which is already a very important step. I looked up where 
$defaultheader is defined, and tried toplevel-scores and 
toplevel-bookparts as well as $current-book and $current-bookpart but 
these sadly do not contain any info (yet) when in the initialize step 
of the score context engraver.


Your solution for the score level headers is sadly unusable for me, as 
the concept of the braille conversion as a simple include only 
addition doesn't allow me to require users to create variables to get 
references to these score blocks. It should work without any user-side 
change to the Lilypond code the user delivers.


I tried to see what the difference is between what 
(ly:translator-context engraver) returns and what the value is of your 
\myscore variable, and see that the first is # where 
\myscore is #. Is there any way that I would be able to get the 
value # from somewhere inside that initialize step of the 
engraver?


That would allow me to use the (ly:score-header) function, and get 
things that way.


The best I can come up with is this, which requires an explicit \book 
and insertion of some code inside the \book.


\version "2.24.0"

Header_export =
#(lambda (context)
  (make-engraver
    ((initialize translator)
  (ly:message "Print global headers with engraver\n")
  (printheader $defaultheader

#(define (headerfield header field)
  (if (and header (module-defined? header field))
    (ly:message "header field: ~a — value: ~a \n" field (module-ref 
header field


#(define (printheader header)
  (headerfield header 'opus)
  (headerfield header 'title)
  (headerfield header 'piece))

\layout { \context { \Score \consists \Header_export } }

\header {
  title = "Title"
  opus = "Op 1"
}

\book {
  \score { \header { piece = "Piece 1" } { c'1 } }
  \score { \header { piece = "Piece 2" } { c'1 } }
  #(for-each (lambda (s) (printheader (ly:score-header s))) (reverse 
(ly:book-scores $current-book)))

}

--
Timothy Lanfear, Bristol, UK.


Re: a small correction in arithmetic expressions

2024-03-28 Thread Werner LEMBERG


> Here is a small correction in the documentation which does not affect
> the use of Lilypond, just for the sake of correctness of the
> formulas... [...]

Thanks, this is now part of a merge request, see

  https://gitlab.com/lilypond/lilypond/-/merge_requests/2291


 Werner