AudioProcessor within a SynthetiserVoice, modular design


Hello everybody,

I am making a vst synth which I want modular, with modulators (envelopes, lfos…) that can connect to oscillators, filters… I am wondering what is the best way to do this… I also want to be able to save or reload the plugin state.

I built the synth using juce classes, in particular SynthetiserVoice. Each synthetiser voice is using an oscillator, and I can add a filter, the envelopes… but I want to be able to connect an envelope to the filter or the amplifier, or disconnect it. So I thought it would be a good idea to use an AudioProcessorGraph living in the SynthetiserVoice, but I am not sure if the AudioProcessor can be modulated internally or if it’s a good idea (my envelopes would be AudioProcessor ??).

Also the SynthetiserVoice is using :
renderNextBlock (AudioBuffer< float > &outputBuffer, int startSample, int numSamples)

While the AudioProcessor is using
processBlock (AudioBuffer< float > &, MidiBuffer &)

so I am not able to pass the startSample and numSample to my AudioProcessorGraph and AudioProcessors if I use this design, or am I missing something here ?

I have been looking at which I found interesting, with the MOPO
and, which talks about signals and slots, but maybe there is a simpler approach or some Juce built in feature that I am unaware of ?

So my questions are :slight_smile::

  • can I use an AudioProcessor or an AudioProcessorGraph within a SynthetiserVoice, and if yes, please share the magic trick,
  • is it a good idea, in the first place, to make an AudioProcessor an envelope generator? I guess it is not intended to be one, what do you think ?
  • what approach would you use for this problem, using another library ? Which one ? I don’t want to reinvent the wheel…

I have seen very little content on how to handle internal modulations in juce so any advice is appreciated.