Forums > Gen

gen~ error in for-loop I can't explain

Mar 10 2017 | 8:57 am

Based on the gen~.ola.granular example I tried to build a granular based process. However, this code which generates an error I can’t explain. Any pointer much appreciated.

— Pasted Max Patch, click to expand. —
  1. code_error


Mar 10 2017 | 10:54 am

Hi Jvkr,

I am not sure, but for some reason when the code is "compiled" it probably thinks it is not used and just removes it.
If you move it to before the s = peek(internbuf, rdix, 0, interp="linear", boundmode="wrap"); it magically recognizes it, as it is used bellow.
I don’t think it has something to do with your code, it seemds OK. It is probably a bit of a buggy behaviour from [gen~].


Mar 10 2017 | 11:15 am

Thank you Nikolas! Updating accumulators at the end of a loop has become such a ingrained habit that I didn’t even consider this. I learned something. Btw, in the example I speak of, it is at the end but adds in4 (ix += in4); that works fine.

Mar 10 2017 | 11:27 am

yeah, the ‘in’ & ‘out’ operators are special, like they are set in memory, not just a variable, so the ola example works. the only other way would be to make spd a history, which is not what you want.

it does not help that gen~ threw you it’s usual unintelligible and unhelpful errors :-(

i would say it is a gen~ bug and should be reported, as it is such an insane way the language wants you to think.

Mar 10 2017 | 2:34 pm

thanks for the clear example. This is a known bug at the moment, and a rather tricky issue to solve due to how we are code transforming on the GenExpr level.


Viewing 5 posts - 1 through 5 (of 5 total)

Forums > Gen