Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A different behavior between Alda 1 and Alda 2 regarding continuous slashes #383

Closed
UlyssesZh opened this issue Jul 23, 2021 · 3 comments
Closed
Labels

Comments

@UlyssesZh
Copy link
Contributor

In Alda 1, c//e is equivalent to c/e and does not lead to an error, but in Alda 2, it will say

Unexpected separator `/` in chord

I think we should adopt the behavior in Alda 1.
First, sometimes when we write music in alda, we suddenly want to delete a middle note in a chord. After deleting it, we want to let a simple mark to denote that there used to be a note. A double slash can be a good mark for this (maybe?).
Second, in an Alda library, a chord can be defined as a list of events being connected with slashes. Then, if we want to represent something like c/>c, it is probably easier to write it as c/>/c. This will unfortunately lead to the error, exclusively in Alda 2.
Third, I think continuous slashes are probably not an intended feature in Alda (something like undefined behavior), but at least in consideration of backward compatibility, maybe we should make Alda 2 behave similarly to Alda 1.

@UlyssesZh UlyssesZh added the bug label Jul 23, 2021
@daveyarwood
Copy link
Member

I appreciate the suggestion, but I think of c//e and c/>/c as invalid syntax. It was only accepted in Alda 1 by accident. I realize this is a breaking change that we no longer accept it in Alda 2, but I think it's probably uncommon enough that it won't cause too much trouble for folks who may have done this in Alda 1 scores to fix their scores so that they'll continue to work in Alda 2.

@UlyssesZh
Copy link
Contributor Author

I found a similar difference. In Alda 1, something like [c'1/e'1]*1 does not produce errors, but it does in Alda 2.

@daveyarwood
Copy link
Member

I experimented with that example in the Alda REPL for a bit, and I think that's another example of something invalid that Alda 1 allowed, and now Alda 2 rightly considers it invalid.

The '1 syntax is an example of variations. Any event (e.g. a note, a chord, an event sequence) can be followed by a single quote followed by either a number or one or more ranges of numbers separated by commas, like '1,2-4,7-9. This designates which times through a repeated phrase that event should be included in the repetition. If the intent is:

  • An event sequence, repeated once
  • The event sequences consists of a single chord, C/E
  • The C/E chord is to played only on repetition number 1

Then the way to write this is:

[c/e'1]*1

The '1 signifies that the chord c/e is to played on repetition number 1.

If you write this:

# invalid
[c'1/e'1]*1

The parser complains because you cannot say that only certain notes in the chord are to be played only on certain repetitions. You can only say that the chord is to be played only on certain repetitions.

Hopefully that makes sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants