awesome you guys are so "on the ball" 🙂
glad I checked before diving into this.... I guess I should have checked the repo first.

Yes Yes Yes! Looking forward to keep my head around one programming-enviroment only.

Would be interesting to see how does it compare with Faust...

7 months later

Bump. Gen on the Hoxton Owl generates 4-6 times more CPU-friendly code, than using Pure Data with Heavy. So i have to ask: What's the current state of Bela and Cycling74 talking? Will there be a sort of online compiler soon? That would be a great relief for not so coding-savvy people like me 🙂
(Sorry if i missed recent developments announced elsewhere.)

right now you can just export your code and run it inside this boilerplate Bela project provided by Cycling 74: https://github.com/Cycling74/genBela.
Unfortunately, from my experience you do not get a great performance improvement with gen over libpd, and it is way slower than Heavy. This is most likely because the code generated by gen works on single-samples buffers, therefore making it harder for the compiler to vectorize it. This was like 6 months ago, perhaps things have improved now.

Some of my notes on how to make it slightly faster:

  • numerical constants exported from gen do not have the "f" suffix and as such are treated as double, while they should be of the same type of sample_t. Maybe the most portable way would be to always prepend the constants with (sample_t) in the gen-generated code, but right now you have to either do it manually (sed is your friend), or use gcc instead of clang and provide the -fsingle-precision-constant flag (not supported by clang).

  • on Bela (and other platforms, such as the Owl) denormals are flushed to zero in hardware, so there is no point in checking for them.
    Therefore we need a way to disable fixdenorm altogether. I can save 5% CPU by replacing

    inline t_sample fixdenorm(t_sample v) { return GENLIB_FIX_DENORM(v); }

    with

    #define fixdenorm(v) (v)

I also had some issues with gen - generated code using stdlib math functions instead of the optimized ones that it tried to provide, so check the output of the pre-processor and see what it is actually calling.

Thanx very much.

• Interesting difference between the Owl and Bela regarding code efficiency of gen code versus Heavy code. However, Heavy's limits (Vanilla incomplete, no expr et al) make it very unsexy to use, i find.

• If i use the github template, how exactly do i fill in my own code?
Will i have to replace contents of all files separately with my own while keeping the template's filenames? Pardon, newbie there.

(Good to know about constants and fixdenorm!)

Once you export your gen code from gen, you should be able to drag and drop it on your Bela project.

I am curious how / why you find [gen~] less limiting than the Heavy-subset of Pd. It must be because I am not experience with gen at all, but I find the Pd-heavy much more usable.