lilypond-user
[Top][All Lists]
Advanced

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

Re: markup and midi


From: Thomas Morley
Subject: Re: markup and midi
Date: Wed, 14 Jun 2017 23:53:38 +0200

2017-06-14 17:47 GMT+02:00 Gianmaria Lari <address@hidden>:
> Why this code does not generate any midi file?
>
> \version "2.19.60"
> \markup {
>   \score {
>     {c' d'}
>     \midi{}
>     \layout{}
>   }
> }



As others already said, markup can't create midi, but I looked for a
method to extract the scores from markup and to reprocess them as
midi.

Probably:

\version "2.19.61"

%% the markup-definition
mrkp =
\markup \box \line {
    \score { { c' d' } \layout {} }
    \score { { cis' dis' } \layout {} }
    \score { { d' e' } \layout {} }
}

%% call the markup
\mrkp

getMidiFromScoreMarkup =
#(define-void-function (mrkp)(markup?)
"Takes a markup, filters for scores, puts them out each in a new bookpart as
midi"
  (let* ((scores
           (filter
             (lambda (arg) (ly:score? arg))
             ;; brute-force ...
             (flatten-list mrkp)))
        (midi-scores
           (map
             ;; TODO
             ;; is it possible to insert \midi into a ready score, other than
             ;; recreating the score?
             (lambda (e) #{ \score { #(ly:score-music e) \midi {} } #})
             (reverse scores))))
    ;; TODO
    ;; better/shorter method?
    (ly:book-process
      (ly:make-book-part midi-scores)
      $defaultpaper
      $defaultmidi
      (ly:parser-output-name))))

%% put out the midis
\getMidiFromScoreMarkup \mrkp


Cheers,
  Harm



reply via email to

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