Question about AudioProcessor


#1

I’m trying to write an audio plugin, which is essentially made up of a number of blocks or effects. (I’m trying to write something that mimics the Teensy Audio library https://www.pjrc.com/teensy/td_libs_Audio.html). Only one effect does anything interesting, the other effects are simply mixers that blend the outputs and deal with feedback. I have a few questions which would really help me ensure I’m using the correct JUCE classes.

  1. Does it make sense to make each of these blocks an AudioProcessor? Or should I write my own effect base class?
  2. If AudioProcessors make sense, should I connect these up with the AudioProcessorGraph?
  3. Can I set an arbitrary number of in and outs on an AudioProcessor?

Thanks in advance!


#2

This sounds like a job for the DSP module, not the AudioProcessor class


#3

You could split up your effect into several AudioProcessors and then hook them up via the AudioProcessorGraph class but that seems a bit overkill to me. You probably only want to do that if you are actually hosting a third-party plug-in or if you want to rely on all the AudioProcessor features such as programs and parameters.

A slightly more lightweight approach would be to chain up several AudioSources. Each AudioSource can pull audio from the previous AudioSource. You can use the MixerAudioSource to mix everything together.

But depending on how many blocks you have I think I would try to keep it simple and simply compose your overall effect by calling different sub-routines which process some passed-in buffer.


#4

@fabian Ok, thanks Fabian, yes, what I want to do is quite simple, which is why I wanted to check whether I was fighting against the intentions of the API, which it sounds like I was.

I assumed an AudioSource could only produce sound, but I guess there’s nothing to stop me connecting them internally in a bespoke child class. I think you might be right though, that it’s easier just to handle the (relatively simple) graph in non-JUCE specific code.


#5

Look at ReverbAudioSource for example: it pulls it’s input from another audio source, but it’s also an AudioSource in itself, i.e. it’s a source for a reverbed version of the original source.