[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Q: Irregular alternate repeats and MIDI
From: |
H. S. Teoh |
Subject: |
Re: Q: Irregular alternate repeats and MIDI |
Date: |
Tue, 11 Aug 2020 08:21:50 -0700 |
On Tue, Aug 11, 2020 at 07:29:33AM -0700, Flaming Hakama by Elaine wrote:
> ---------- Forwarded message ----------
> From: Michael Gerdau <[1]mgd@qata.de>
> To: Lilypond User <[2]lilypond-user@gnu.org>
> Date: Sat, 18 Jul 2020 07:57:23 +0200 (CEST)
> Subject: Q: Irregular alternate repeats and MIDI
> Hi List,
>
> I have a score with repeats and irregular alternate endings. I
> can neatly engrave that but I don't seem to be able to produce
> correct MIDI w/o manually arranging all segments.
[...]
I've struggled with this before, and eventually I just gave up and stuck
the segments in variables, and manually arrange them. Lilypond is
primarily a typesetting program, and even though we've made advances in
MIDI generation over the years it's still not quite there. Because of
this I usually use two scores, one just for layout, and one just for
midi, and the music content is stored in variables to be incorporated
into either score as necessary.
> Not exactly what you asked for, but one possible approach is to use
> tags.
>
> Tags allow for conditional use of material.
>
> In this case, you would add a tag that is specific to MIDI and put
> the repetitions in a similar way you did in the "manual" version.
>
> Then, have two different scores, one for PDF and one for MIDI,
> which use different tags.
Definitely recommend this approach. This is what I usually do:
global = {
\time 3/4
\tempo 4 = 100
s1*12
\tempo 4 = 120
s1*12
...
}
voiceA = {
... % music here
\tag #'layout {
% stuff here only for layout, not for MIDI
}
... % more music
}
voiceB = {
... % music here
\tag #'midi {
% stuff here only for MIDI, not for layout
}
... % more music
}
...
% This score is only for layout
\score {
\removeWithTag #'midi
<<
\new Staff {
% Repeats only present in layout score
\repeat volta {
\voiceA
}
...
}
\new Staff {
... % ditto
\voiceB
}
>>
\layout {}
}
% This score only for MIDI
\score {
\removeWithTag #'layout
<<
\new Staff {
% Manually sequence repeats if needed
\repeat unfold {
% Apply global events to every
% staff For more reliable MIDI
% generation
<< \global \voiceA >>
}
}
\new Staff <<
... % ditto
\global \voiceB
>>
>>
\midi {}
}
T
--
Being able to learn is a great learning; being able to unlearn is a greater
learning.