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

    Mar 10 2017 | 4:57 pm
    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. .j

    • Mar 10 2017 | 6:54 pm
      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 | 7:15 pm
      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. .j
    • Mar 10 2017 | 7:27 pm
      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 | 10: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.
    • Mar 31 2017 | 1:46 am
      you have to declare values for all variables inside the for loop first, outside the for loop. the compiler does not reliably provide this error message.