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

Repetition variations don't behave well in a sequence containing repeats #401

Open
daveyarwood opened this issue Oct 3, 2021 · 0 comments

Comments

@daveyarwood
Copy link
Member

🐞 Bug report 🐞

Description

We are storing a single currentRepetition value (see repeat.go and repetitions.go) and using it to track the current repetition number that we are going through a repeated sequence of events.

However, a repeated sequence can itself contain repeated events, and the nesting can be arbitrarily deep.

I think it would probably make sense to refactor so that instead of a single "current repetition" value, we are working with a stack of "current repetition" values, where we use the topmost one and discard it when we exit the loop.

Steps to Reproduce

Repro case, adapted from the one @wesen provided on Slack:

period = r16
motif = a b c

(tempo! 100)

piano:
  V1: o4 [{motif}8 period period <'2 ]*4

This behaves as expected. The motif is played twice in octave 4, then twice in octave 3, because on the second repetition, the "octave down" event is applied.

period = r16
motif = a b c

(tempo! 100)

piano:
  V1: o4 [{motif}8 period*2 <'2 ]*4

This should behave the same, however the "octave down" event ends up getting applied on every repetition, so we play the motif in octave 4, then 3, then 2, then 1.

Environment

Alda version:

$ alda version
alda 2.0.5
$ alda-player info
alda-player 2.0.5
log path: /home/dave/.cache/alda/logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant