generating midi and simplify code

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

generating midi and simplify code

Gianmaria Lari
I already asked some question about \markup and \midi and get some usefull answer. Here I attached the real code I'm working on.

I would like to generate the midi and I would appreciate some suggestion.

Kieren suggest to separate the layout and midi. Pro: clear and easy to do; Cons: a bit verbose and difficult to maintain.

Thomas Morley proposed a scheme method to extract the score from the markup. Pro: it works nicely with some test examples. Cons: complex.

I personally would prefer Kieren solution because I can handle it better.  But maybe organizing the code differently gives better solution....?

* * *

My code looks to me very redundant. For example:

\markup \justify-line {
  \score {{ \set Staff.instrumentName = #(nextcount) 
            \clef bass \override Score.TimeSignature #'stencil = ##f 
            \cadenzaOn 
            \tetrachordOneUp
            \cadenzaOff}
  }
  \score {{ \set Staff.instrumentName = #(nextcount) 
            \clef bass \override Score.TimeSignature #'stencil = ##f
            \cadenzaOn 
            \tetrachordOneDn
            \cadenzaOff}
  }
  \score {{ \set Staff.instrumentName = #(nextcount) 
            \clef bass \override Score.TimeSignature #'stencil = ##f 
            \cadenzaOn 
            \tetrachordOneUpDn
            \cadenzaOff}
  }
}

This repeats three times the same thing except for referencing different variables: 

\tetrachordOneUp 
\tetrachordOneDn 
\tetrachordOneUpDn

Is this the correct way to go or is there any way to simplify it?
Thank you, g.

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

test.ly (12K) Download Attachment
Capture.PNG (108K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: generating midi and simplify code

Michael Gerdau
Hi Gianmaria,

I definitely would go with Thomas Morley's function. You already have
all your music in variables so creating your midi files is just a
oneliner per file.

I don't understand your reservation w/r to complexity. To me this seems
to be a perception problem on your part. After all you happily use lots
of different and presumably more complex scheme functions all over the
place in your lilypond files. In that sense I'd like to remind you that
a scheme function does not become less complex simply because it arrived
on your computer as part of the lilypond distribution. Quite a few of
the functions that are percieved as "normal" lilypond functions started
as enhancement requests by users (or the contributors themselves).

Just assume Thomas's new function would reside somewhere inside the
lilypond distribution. Would that reduce complexity for you?1

> Is this the correct way to go or is there any way to simplify it?
I doubt there is "the correct way to go" in the first place. After all
usually TIMTOWTDI (there is more than one way to do it)

Kind regards,
Michael
--
 Michael Gerdau       email: [hidden email]
 GPG-keys available on request or at public keyserver

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Loading...