alda-lang / alda-core

The core machinery of Alda
80 stars 26 forks source link

Rests are occasionally not parsed properly #52

Closed elydpg closed 7 years ago

elydpg commented 7 years ago

Consider this segment:

thingNR = b-8 f b- f a- g f r
piano: thingNR*2

This will play thingNR twice as intended, however the final rest is clipped and it ends up lasting 14 counts instead of 16.

elydpg commented 7 years ago

It's also worth mentioning that

thingNR = [b-8 f b- f a- g f r]
piano: thingNR*2

plays correctly.

daveyarwood commented 7 years ago

I found the issue -- there was an obscure bug in the parser that shows itself when you have a rest without a duration (r), followed by a newline, at the end of a variable definition. In that scenario, the parser was incorrectly parsing the newline first (I know, right?) and considering the rest to be outside of the variable definition.

I've got it fixed in 1.0.0-rc68. Thanks a lot for reporting this!