Allow multiple parts inside of an event sequence / variable definition? #441
Replies: 11 comments 3 replies
-
Hm... to me this seems a little bit inconsistent... after all instruments are the environments in which event sequences are played. Though it would be an interesting feature; one would just have to work out the mechanics in order to avoid something like this
or perhaps more problematically
|
Beta Was this translation helpful? Give feedback.
-
It looks like with Alda 1.0.0-rc57, the parser accepts both of these scores ( 🏆 ), and they sound the same when you play them. What's really happening under the hood is that strings like
I'll admit that the score looks a little strange, and it might be slightly misleading -- for example, one might expect that adding additional notes at the end of the second score would result in them being played on violin, but instead, the current instrument is still the guitar. I'm open to adding some additional logic to the way this works, if it's what the people want™ and it's not too difficult to implement. Another issue:
One might expect the
So there is a caveat with organizing your score this way, by sections. The score compiler still expects you to keep the parts in sync, e.g. by adding rests to make sure that all of the parts are the same length:
I can see this being a little cumbersome to keep up with -- it might be nice if we could find a reasonable way to keep the parts in sync automatically, without breaking the way variables work in general. |
Beta Was this translation helpful? Give feedback.
-
I'm curious as to how variables are currently defined right now, since I always understood them to be event sequences, but if instrument calls are allowed in variable declarations then it's more like variables are like a sort of code injection, which seems to be what's going on here. I'm not sure if this is a better way of handling variables, but either way, it's something that needs work on. |
Beta Was this translation helpful? Give feedback.
-
The missing piece of info there is that an instrument call is simply an event that says "switch to this instrument." A variable is indeed a sequence of events, and with the new parser in 1.0.0-rc57, those events can now include a "change part" event, i.e. an instrument call. |
Beta Was this translation helpful? Give feedback.
-
Moving this issue back into the "Discussion" column. It's essentially fixed as of 1.0.0-rc57, but it's not 100% intuitive how to write scores this way, since you have to make sure the parts are all synchronized. I'm curious if we can improve the experience somehow. |
Beta Was this translation helpful? Give feedback.
-
Maybe a synchronize command like this one would make sense. I use it all the time when writing Midica files. |
Beta Was this translation helpful? Give feedback.
-
I think I would want a "synchronize" function/operator to be more like a scope, almost like Java's synchronized keyword: // other synchronized threads have to wait until I'm done with this
synchronized(someObject) {
doSomethingWith(someObject);
}
// now other synchronized threads can do their thing Here's a half-baked idea: what if Alda had something similar that allowed you to specify that all of the parts inside of a block of code should be "in sync" at the end of the block? I'm not tied to this syntax, but imagine if we had
would be equivalent to this:
Inside of the "sync block," the clarinet part is much longer than the flute part, but the first notes of each part right after the sync block are in sync. (This is actually very similar to how voice groups work. After you use Thinking this example through a little more, imagine if we wanted to define
I think it would be important to do this in a way that allows you to specify which parts are to be synchronized. That way, you could, for example, write a percussion part entirely separate from the clarinet and flute parts, and not be bound to the same rigid verse/chorus structure. I'm not totally sure if the above would work, syntactically, but just an idea worth considering. Would love to hear feedback from interested parties. |
Beta Was this translation helpful? Give feedback.
-
This feels like it might be useful enough that I would break my usual "don't add additional syntax, provide Lisp functions instead" rule and be on board with adding syntactic sugar. Like perhaps something like this:
...could be syntactic sugar for this:
|
Beta Was this translation helpful? Give feedback.
-
This feature remains until Alda 1.5.0. It was removed in Alda 2 without proper documentation (maybe). Shouldn't that appear in the Alda 2 migration guide? |
Beta Was this translation helpful? Give feedback.
-
Whoops! That wasn't a deliberate removal. I forgot that Alda 1 would let you include instrument calls inside of an event sequence. Thinking about it more now, I find it confusing, and I think it might over-complicate things for now if I attempted to add it back. I would like to come up with a good solution to the synchronization problem discussed above, and maybe that will point us in the right direction when it comes to variable definitions that include multiple parts. I'm beginning to wonder if this should be a different kind of variable, because right now, variables in Alda are interpreted within the context of a part, and I think maybe it should stay that way. |
Beta Was this translation helpful? Give feedback.
-
Here are some of my insights although this is a very old discussion. Variables that contain multiple parts and do not sync are necessary. Consider: there are many instruments that serve as the accompaniment, and there is one instrument that plays as the lead. The accompaniment is very repetitive, and the lead is very non-repetitive or has a different length of the repetition (which is a very common case). Then, it would be natural to define variables separately for the accompaniment and for the lead. These two variable should not sync because we want the accompaniment to repeat for multiple times while the lead repeats only once. Due to this consideration, I definitely prefer the Alda 1 way of handling variables and sequences. The users of Alda should take care of the synchronization themselves. In the situations where a variable contains multiple parts, writing explicitly the rests to synchronize is good for maintainence, readability, and disambiguity. This is better than introducing a different kind of variable for synchronized parts. |
Beta Was this translation helpful? Give feedback.
-
This would allow composers the flexibility to define whole "parts" of the song that include multiple simultaneous instruments, e.g.
Interestingly, as @aengelberg pointed out, it is already possible to get this behavior via a hack:
...which suggests it should be feasible to make changes to the parser to allow doing this directly.
Open question: is this fixed by default with the new parser ( alda-lang/alda-core#37 ) implementation (unreleased)?
Beta Was this translation helpful? Give feedback.
All reactions