I had the same thought! I lifted parts of this code from a polyphonic Mozzi polysynth sketch I found here, so the Oscillators were already instantiated in that clumsy but functional way. The fact that the sketch worked and didn’t overflow the memory led me to believe it was the right way to do it, and I wasn’t really sure how to declare Oscillators in an array using the MOZZi Framework.
In future I would definitely like to process the envelopes, oscillators and notes held/cycles in an array to make adding and processing voices easier and possibly make the code more efficient. Ideally I could rebuild it from the ground up using the onboard NS1 DAC for stronger output (which could also be used for FM and sync.
I have been reading up on Direct Digital Synthesis and trying to make a phase accumulator read through a wavetable but as a musician and amateur coder it is pretty heavy going as far as mathematics. See this link for the article I’ve been reading
I’ll definitely have a go at integrating some for loops into the code in future though.