Create and mix channels in a drum sampler

#1

I have my drum sampler plugin with only one channel for now, it has a Synthesiser in which i do stuff like file loading and audio rendering.
Now i’d like to create multiple instances of this channel and connect them to a single master processor.
My initial idea (inspired by the tutorial) was to create a ProcessorBase class derived from AudioProcessor; in my PluginProcessor, create multiple instances of this class and then connect them via AudioProcessorGraph.
Unfortunately i think i might have some problems with the set/getStateInformation methods, with parameters, and also i don’t want to have a synth for each channel…so i have to find another way to solve this problem.

How can i make multiple channels without using multiple AudioProcessors in first place? Then how to pass their buffer to the master processor?

0 Likes

#2

I may be barking up the wrong tree, but here’s how I plan to tackle this for a drum synth I am working on.

I have one AudioProcessor, with a bus for each of my 8 drum voices (one voice is the kick, one the snare, etc.) and 8 buses that will remain empty, since I understand that Logic requires 16 buses.

Buses are defined like so:

MyAudioProcessor::MyAudioProcessor()
    : AudioProcessor (BusesProperties()
                .withOutput ("Voice 1/Mix", AudioChannelSet::stereo(), true)
                .withOutput ("Voice 2", AudioChannelSet::stereo(), false)
                .withOutput ("Voice 3", AudioChannelSet::stereo(), false)
                .withOutput ("Voice 4", AudioChannelSet::stereo(), false)
                .withOutput ("Voice 5", AudioChannelSet::stereo(), false)
                .withOutput ("Voice 6", AudioChannelSet::stereo(), false)
                .withOutput ("Voice 7", AudioChannelSet::stereo(), false)
                .withOutput ("Voice 8", AudioChannelSet::stereo(), false)
                .withOutput ("Empty 1", AudioChannelSet::stereo(), false)
                .withOutput ("Empty 2", AudioChannelSet::stereo(), false)
                .withOutput ("Empty 3", AudioChannelSet::stereo(), false)
                .withOutput ("Empty 4", AudioChannelSet::stereo(), false)
                .withOutput ("Empty 5", AudioChannelSet::stereo(), false)
                .withOutput ("Empty 6", AudioChannelSet::stereo(), false)
                .withOutput ("Empty 7", AudioChannelSet::stereo(), false)
                .withOutput ("Empty 8", AudioChannelSet::stereo(), false))
{
    // constructor
}

Within processBlock I fill each bus buffer with the output for a drum voice:

for (int busNumber = 0; busNumber < maxBusses; ++busNumber) {
    auto audioBusBuffer = getBusBuffer (buffer, false, busNumber);
    // fill it...
}

I haven’t gotten around to mixing the buffers yet, since like yours, my plugin currently only has one voice. But the idea is that within the plugin the user will be able to switch between a mixed output or a multi-channel output. If the output is mixed then all voices will be summed and output to bus 1’s buffer. Otherwise each voice will remain in separate buffers, and within their DAW the user can send each bus to a different track to be processed independently.

You mentioned that you don’t want a synth for each channel, and I don’t have any suggestions for that unfortunately, since the one-synth-per-voice approach suits my needs. P.S. I am not using the Synthesiser class, either.

1 Like