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)
(ly: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))
output-defs)))))
(indent (get-sym 'indent)))
(display indent)
(newline)
(display title)
(newline)
(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,
Michael
Am 08.10.2019 um 16:27 schrieb jaap de wolff:
Hello,
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
And
simplemusic = { valid music}
simplescore = \score (
\simplemusic
\layout {}
}
\musicxml \simplescore
First question:
I want to be able to do:
simplemusic = {valid music}
\score (
\simplemusic
\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
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user