[Top][All Lists]

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

Re: getting score information

From: Michael Käppler
Subject: Re: getting score information
Date: Thu, 10 Oct 2019 10:24:13 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

Hi Jaap,
as far as I understand,
your first question is difficult to achieve, since the output definition blocks \layout, \midi are hardcoded in the parser.
I think you would have to modify the parser to introduce a new \musicxml keyword.
But maybe more experienced Lily hackers will correct me.

For your second question, try this as a starting point:

\version "2.19.80"

get-layout-header = #(define-scheme-function (score)
                       (let* ((output-defs (ly:score-output-defs score))
                              (header (ly:module->alist (ly:score-header score)))
                              (title (assoc-get 'title header))
                              (composer (assoc-get 'composer header))
                              ;; Look for sym in all output definitions
                              ;; is there a way to determine of which type an output definition is?
                              (get-sym (lambda (sym)
                                         (car (filter (lambda (el)
                                                        (not (null? el)))
                                                      (map (lambda (output-def)
                                                             (ly:output-def-lookup output-def sym))
                              (indent (get-sym 'indent)))
                         (display indent)
                         (display title)
                         (display composer)))

test = \score {
  \new Staff { c4 d e f }
  \layout {
    indent = 2\cm
  \midi { }
  \header {
    title = "Foo"
    composer = "Bar"

\get-layout-header \test

Have a nice day,

Am 08.10.2019 um 16:27 schrieb jaap de wolff:



At this moment I am in the process of creating a lilypond musicxml module.

The module is written in scheme, and at this moment the module is able to handle simple music.


At this moment I am able to handle both


simplemusic = {valid music}


\musicxml \simplemusic




simplemusic = { valid music}


simplescore = \score (


                \layout {}


\musicxml \simplescore


First question:


I want to be able to do:

simplemusic = {valid music}


\score (


                \layout {}

                \musicxml {}

                \midi {}



Can anyone give a hint how to do this?


Second question:


When doing \musicxml \simplescore the scheme function gets an object of the type ly:score.


By digging in code I found out that from this score music can be extracted using ly:score-music

Also header can be extracted using ly:score-header and output-defs using ly:score-output-defs


The extracted music can be used without a problem.

However I can’t figure out how to use the extracted header and output-defs.


I want to be able to extract information like composer and title to put in musicxml


Does anyone have suggestions?


Jaap de Wolff



lilypond-user mailing list

reply via email to

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