If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Today, the audio objects really need to be statically allocated. Some distant future version will feature working object destructors, and constructors capable of adding objects and connections into a live system.

I do understand that this might not be easily achieved in the current version but could someone provide me with a starting point or a basic example of how one could implement dynamic construction and destruction of audio nodes? E.g. dynamically creating a mixer, an audio connection and re-routing audio through them? At the moment we can only .connect() and .disconnect()AudioConnections on the fly. I could try to implement dynamic audio nodes.

Why not create an object pool of desired audio objects? Actually, I'm not sure this approach would make sense in this case. Why don't you figure out the maximal number of oscillators you need and use the amp or mixer to turn a voice off? For example you could use the midisynth example and adapt each voice to have up to 4 oscillators per voice mixer. Then you can simply use the built in polyphony for that sketch and you will have the maximal number of oscillators for your particular teensy

https://forum.pjrc.com/threads/59092...ht=notes+volts here is an example expanding the mono synth from the Notes and Volts tutorial. You can simply add more oscillators to a given voice i think he has 2 osc + 1 noise per mixer. You could remove the noise and add two more oscillators per voice. Adding unison would be as simple as duplicating a voice on any one of the 16 midi channels. I can't think of a use case where you would really need more than 4 oscillators per voice. I haven't seen many if any synthesizers with more than 4 that aren't FM operators. If for some reason you wanted say 16 osc on one voice though you would simply need to chain the mixers eg 4 4 osc mixers into a mixer = 16 osc, add another mixer layer and you have 64 oscillators, etc

Unless your objective is more a midi player using the midisynth examples polyphonic setup you can just create a bank of effects and use amps and dynamic patching for your individual voices. 8 - 10 fx banks seems reasonable as you only have 10 fingers. If you are after a midi player specifically as opposed to a synth you might be better off using a raspberry pi 0 and a hifiberry or some similar dac breakout.