Best practices for where to put synth parts

I'm working on upgrading the demo plugin into a basic VA synth.  I've added a filter and anti-aliased saw oscillators but as it stands I have everything in just lobbed into the SineWaveVoice class ( functions, arrays, params and all).  I wondering what the best practaces for this type of thing are, should I just put things like oscillators, filters, and envelopes in child classes?  Should I inline them?  Is keeping them where they are better for speed?  It seems like there are tons of ways of doing this and I understand that there may be no "best practices" and it might make sense to treat diffent things differentley (i.e. child class envelopes and inline ocillators) but if my question has no direct answer can I get someone to tell me the tradeoffs.

Well, if you put everything in a SynthesiserVoice, I believe you'll have several "copies" of each thing for however many voices you play. You usually don't want things like filters, effects, or even envelopes to be polyphonic. That can use a lot of resources. I don't know what the best way to do it is, but one way could be to just chain them together in the audio processor.

I definatly am going for true polyphony and I think making envs and filters not one-per-voice would make it paraphonic.  The reason true poly is desirable is that it make it things like staggered chords possible and when combined with keytracking it make patches that can be played two handed on all 88 key possible.

>You usually don't want things like filters, effects, or even envelopes to be polyphonic. 

i would disagree.  envelopes and filters would usually be per-voice. 

but yeah, fx would commonly go on the master output. 


In regards to classes, i prefer to have my oscillators, filters, envelopes, LFO's...whatever, all as separate classes., so they can be reused when needed. 
It also makes it easy to change, for example, the type of filter, without having to dig too much into spaghetti code. 



Actually, yeah envelopes probably should be polyphonic so they work with each voice on each key press. My bad. Idk about filters though. I don't think they should be polyphonic, unless you want each voice to use them differently. i his that's up to the designer though. 

in traditional subtractive synthesis, you'd almost always put some sort of envelope and/or LFO modulation on the filter.  The envelope modulation is dependant on when you hit the key, and with velocity sensitive keyboards, how hard you hit the key.  So yeah, usually on a polysynth you're gonna want a filter on each voice.  
There were a couple of synths in the 80's that didn't have filter-per voice.  The Korg Poly800 springs to mind.  It was not highly rated though!


I was thinking about that too after my last comment. You're probably right. It's been too long since I've worked with audio so I can't remember exactly how things are usually done. I've been trying to gain skills in other areas. I used to work in Reaktor and I thought i remembered most synths having mono filters. I'll have to check that one out. I'm quite curious. 

Surely you'd want each voice to have its own filter so you can set the corner frequency according to the current note?

Now I have the filter, midi handling,  and angle calculations in the voice class and the "saw of angle" function and the envelope in seperate class.  The voice class has two envelope objects which are treated normally and a "saw calulator" object with its functions inlined.  Does this seem reasonable?