Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Stack-based attributes #335

Closed
daveyarwood opened this issue Nov 22, 2016 · 2 comments
Closed

Stack-based attributes #335

daveyarwood opened this issue Nov 22, 2016 · 2 comments
Labels

Comments

@daveyarwood
Copy link
Member

Moved from #46.

See that issue for context -- it's an interesting idea that needs more discussion.

@daveyarwood
Copy link
Member Author

I had an interesting thought about this. It might be interesting if event sequences were a scoping mechanism. Meaning: attributes applied inside of an event sequence would be "undone" at the end of the event sequence. For example:

(vol 75) o3

# these notes are played at 75% volume, in octave 3
g a b

# these notes are played at 50% volume, in octave 4
[
  (vol 50) o4
  c d e f
]

# the event sequence is over, so we're back to 75% volume, octave 3
g b g

The only trouble is, this would be a breaking change, and I think it would make a lot of existing scores sound unexpectedly different.

It also seems like if we followed this train of thought, variable definitions would also have their own scope, i.e.:

myVariable = [
  (vol 50) o4
  c d e f g
]

(vol 75) o3

# 75% volume, octave 3
g a b a g a b

# 50% volume, octave 4
myVariable

# 75% volume, octave 3
g b g

But this would also be a breaking change from what we're used to. In particular, I have advocated in the docs that you can use variables as a shorthand for setting specific attribute values, e.g.:

quiet = (vol 50)
reallyQuiet = (vol 30)
loud = (vol 99)

loud c d e f
quiet c d e f
reallyQuiet c d e f

Both of these "scope styles" seem useful to me, and it isn't clear to me how to reconcile them.

Maybe we could add a second kind of event sequence (with a different syntax) that has its own scope for attributes (and maybe voices?), so that we could enable this sort of functionality in a non-breaking way?

@daveyarwood daveyarwood transferred this issue from alda-lang/alda-core Jan 1, 2021
@UlyssesZh
Copy link
Contributor

What about using an exclamation mark to create a scope?

(vol 75) o3 g a b
[! (vol 50) o4 c d e f]
g b g

Maybe we can develop more different sequences (denoted by adding a special symbol behind the [) with different practical functions,
like [~ xxx] to denote a long slur (#378), etc.

@alda-lang alda-lang locked and limited conversation to collaborators Oct 7, 2022
@daveyarwood daveyarwood converted this issue into discussion #426 Oct 7, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

2 participants