On 2022-06-28 5:17 pm, Petr Pařízek via Discussions on LilyPond
development wrote:
Dan wrote:
Are you aware of \parallelMusic ?
AFAIK, \parallelMusic requires me to write one full measure of each
voice while interleaving the voices.
As long as I'm writing it all into one stave, there's little
difference in doing it this way from enclosing each measure in braces
and putting "\\" between them.
\parallelMusic defines music variables, which is significantly different
than the << \\ >> construct which only instantiates voices.
What's more, even if I did use \parallelMusic, I'm not sure how I
would be supposed to decipher that the "d3-f3-A3-F4" in my example
would sound all at the same time.
To use \parallelMusic, you should only need to rotate your thinking.
Instead of simultaneous notes being in the same row, you are able to
freely space such notes to align them in columns, similar to that of
traditional notation. (I should note that such horizontal alignment is
purely for the sake of the human, as LilyPond largely ignores
whitespace.)
%%%%
\version "2.22.0"
%{
vvv vvv vvv vvv
--- --- --- ---
c3o g3h C4h. E4h
g3h E4h
C4q
d3o f3o A3h F4q
E4h
B3h
D4q
c3o g3o C4o E4o
(swap rows/columns)
>| E4h E4h F4q E4h D4q E4o
>| C4h. C4q A3h B3h C4o
>| g3h g3h f3o g3o
>| c3o d3o c3o
%}
\parallelMusic upperA, upperB, lowerA, lowerB {
e2 e2 f4 e2 d4 e1 |
c2. c4 a2 b2 c1 |
g2 g2 f1 g1 |
c1 d1 c1 |
}
\new PianoStaff <<
\new Staff { \clef treble
<< \relative c' \upperA \\ \relative c' \upperB >>
}
\new Staff { \clef bass
<< \relative c \lowerA \\ \relative c \lowerB >>
}
%%%%
----
It might be possible to support input similar to the original row-based
approach. Consider a possible function:
%%%%
\seriesMusic lowerB, lowerA, upperB, upperA {
| c1 g2 c2. e2
g2 e2
c4
| d1 f1 a2 f4
e2
b2
d4
| c1 g1 c1 e1
}
%%%%
(NOTE: I picked the word "series" as an opposite to "parallel", though I
concede it is likely a dumb name.)
Implementing \seriesMusic amounts to assigning each note to the
specified variables in a round-robin fashion, skipping over those that
have an incomplete duration. After each row of input, the shortest
remaining duration is used as the virtual time step. Bar checks would
be applied to each music variable, and they might also help catch input
errors, as this function would not be able to see the actual rows of
input as delimited by newlines.
Ties, slurs, and articulations should probably work as expected.
However, tuplets become much harder to input. The normal syntax of
\tuplet <fraction> { ... } assumes a left-to-right reading order. It
would never work in a column, so the user would have to use scaled
durations (e.g. d4*2/3). Such durations would have be manually repeated
each row. Similar issues would apply to any construct that surrounds
notes, such as \transpose. And while \overrides and \tweaks could be
assigned to whatever variable is currently awaiting a note, they will
certainly disturb the alignment of notes.
Ultimately, this is probably only a viable input method for simple
music. As things get even slightly more complex, writing parts in the
more traditional manner likely wins out for readability and
maintainability.
-- Aaron Hill